curl-library
Re: curl_easy_setopt() typechecker, try2
Date: Wed, 27 Feb 2008 13:46:40 +0100
Daniel Stenberg wrote:
> On Wed, 27 Feb 2008, Michal Marek wrote:
>
>> That's strange, did you compile with optimizations?
>
> Oh, me is silly! I didn't use -O at all, just -W and -Wall... with -O it works
> just fine!
Yes, unfortunately without -O gcc can't prove the constness of the
option code :(
> And I get to see this:
>
> debugit.c:49: warning: call to '_curl_easy_setopt_err_long' declared with
> attribute warning: curl_easy_setopt expects a long argument for this option
>
> ... where line 49 is:
>
> curl_easy_setopt(curl, CURLOPT_FTPLISTONLY, TRUE);
>
> (and TRUE is a #define 1, and this is a 32bit arch)
The warning is currently intended and actually correct, although a bit
pedantic. E.g this is what printf("%ld\n", 1) produces (with recent
enough gcc and glibc):
$ gcc -m32 -Wall print.c
print.c: In function ‘main’:
print.c:5: warning: format ‘%ld’ expects type ‘long int’, but argument 2
has type ‘int’
$ file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for
GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped
The question is whether we will make the world a better place by warning
about this or not. Given that this warning pops up in about every code
using curl, I'm probably leaning towards not warning about this for now.
Received on 2008-02-27