cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: examples compiler warnings

From: Vincent Torri <vincent.torri_at_gmail.com>
Date: Thu, 22 Sep 2011 16:27:13 +0200

On Thu, Sep 22, 2011 at 3:54 PM, Guenter <lists_at_gknw.net> wrote:

> Hi,
> as you might have seen from my commits during last days I've tried to get
> the examples compiled with MinGW, and specially also MinGW64.
>
> Currently I get those warnings with 64-bit:
>
> anyauthput.c: In function 'read_callback':
> anyauthput.c:95: warning: format '%d' expects type 'int', but argument 3
> has type 'size_t'
> ...
> ftpupload.c: In function 'read_callback':
> ftpupload.c:59: warning: format '%d' expects type 'int', but argument 3 has
> type 'size_t'
> ...
> httpput.c: In function 'read_callback':
> httpput.c:48: warning: format '%d' expects type 'int', but argument 3 has
> type 'size_t'
> ...
> multi-debugcallback.c: In function 'main':
> multi-debugcallback.c:135: warning: call to '_curl_easy_setopt_err_debug_*
> *cb' declared with attribute warning: curl_easy_setopt expects a
> curl_debug_callback argument for this option
> ...
> post-callback.c: In function 'main':
> post-callback.c:99: warning: call to '_curl_easy_setopt_err_long' declared
> with attribute warning: curl_easy_setopt expects a long argument for this
> option
> ...
> sendrecv.c: In function 'main':
> sendrecv.c:125: warning: format '%u' expects type 'unsigned int', but
> argument 2 has type 'size_t'
> ...
> certinfo.c: In function 'main':
> certinfo.c:57: warning: call to '_curl_easy_getinfo_err_curl_**slist'
> declared with attribute warning: curl_easy_getinfo expects a pointer to
> struct curl_slist * for this info
> ...
> ftpgetinfo.c: In function 'main':
> ftpgetinfo.c:69: warning: call to '_curl_easy_getinfo_err_long' declared
> with attribute warning: curl_easy_getinfo expects a pointer to long for this
> info
> ...
> ftp-wildcard.c: In function 'main':
> ftp-wildcard.c:70: warning: call to '_curl_easy_setopt_err_write_**callback'
> declared with attribute warning: curl_easy_setopt expects a
> curl_write_callback argument for this option
>
> for the size_t format warnings I've no real good idea; inttypes.h has no
> PRI* macro for size_t, so if we go that way we would have to add an own
> macro like CURL_FORMAT_SIZE_T to curlbuild.h[dist] which depends on
> platform/arch so that we can properly build up format strings for printing
> size_t (I would prefer this);

That's what i used when porting the libs i'm working on to win64.

Vincent Torri

> otherwise we could add uint_64 casts to all size_t printfs ...
>

> then the remaining warnings seem to come from typecheck-gcc.h, and those
> make me believe that these checks either dont act properly with 64-bit, or
> things are missing; I tested on 64-bit Linux and get same warnings with
> certinfo.c, ftp-wildcard.c, multi-debugcallback.c:
>
> anyauthput.c: In function ‘read_callback’:
> anyauthput.c:95: warning: format ‘%d’ expects type ‘int’, but argument 3
> has type ‘size_t’
> ...
> certinfo.c: In function ‘main’:
> certinfo.c:57: warning: call to ‘_curl_easy_getinfo_err_curl_**slist’
> declared with attribute warning: curl_easy_getinfo expects a pointer to
> struct curl_slist * for this info
> ...
> ftpupload.c: In function ‘read_callback’:
> ftpupload.c:59: warning: format ‘%d’ expects type ‘int’, but argument 3 has
> type ‘size_t’
> ...
> ftp-wildcard.c: In function ‘main’:
> ftp-wildcard.c:70: warning: call to ‘_curl_easy_setopt_err_write_**callback’
> declared with attribute warning: curl_easy_setopt expects a curl_
> write_callback argument for this option
> ...
> httpput.c: In function ‘read_callback’:
> httpput.c:48: warning: format ‘%d’ expects type ‘int’, but argument 3 has
> type ‘size_t’
> ...
> multi-debugcallback.c: In function ‘main’:
> multi-debugcallback.c:135: warning: call to ‘_curl_easy_setopt_err_debug_*
> *cb’ declared with attribute warning: curl_easy_setopt expects a cur
> l_debug_callback argument for this option
> ...
> sendrecv.c: In function ‘main’:
> sendrecv.c:125: warning: format ‘%u’ expects type ‘unsigned int’, but
> argument 2 has type ‘size_t’
>
> the other *_err_long warnings with MinGW64 might be because surprisingly
> sizeog(long) is 4 instead of 8 ...
>
> Gün.
>
>
>
> ------------------------------**------------------------------**-------
> List admin: http://cool.haxx.se/list/**listinfo/curl-library<http://cool.haxx.se/list/listinfo/curl-library>
> Etiquette: http://curl.haxx.se/mail/**etiquette.html<http://curl.haxx.se/mail/etiquette.html>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-22