Guenter | 4 Jul 2012 13:46

newer gcc -> more sample warnings ( <at> Daniel)

Hi Daniel,
I know you want to keep the samples as simple as possible, but I just 
found that with gcc 4.7.0 we get a bunch of warnings like this:
gcc -I. -I../.. -I../../include -I../../lib -g -O2 -Wall 
-fno-strict-aliasing -DCURL_STATICLIB -c anyauthput.c
anyauthput.c: In function 'main':
anyauthput.c:108:12: warning: variable 'res' set but not used 
[-Wunused-but-set-variable]

I think we should add a minimal check there, something like:
     res = curl_easy_perform(curl);
+    /* Check for errors */
+    if(res != CURLE_OK)
+      printf("curl_easy_perform() failed, code = %d\n", res);

do you agree with that?

Gün.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Guenter | 4 Jul 2012 14:02

Re: newer gcc -> more sample warnings ( <at> Daniel)

Am 04.07.2012 13:46, schrieb Guenter:
> Hi Daniel,
> I know you want to keep the samples as simple as possible, but I just
> found that with gcc 4.7.0 we get a bunch of warnings like this:
> gcc -I. -I../.. -I../../include -I../../lib -g -O2 -Wall
> -fno-strict-aliasing -DCURL_STATICLIB -c anyauthput.c
> anyauthput.c: In function 'main':
> anyauthput.c:108:12: warning: variable 'res' set but not used
> [-Wunused-but-set-variable]
>
> I think we should add a minimal check there, something like:
> res = curl_easy_perform(curl);
> + /* Check for errors */
> + if(res != CURLE_OK)
> + printf("curl_easy_perform() failed, code = %d\n", res);
>
> do you agree with that?
or, maybe verbose:
+    if(res != CURLE_OK)
+      printf("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));

Gün.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Daniel Stenberg | 4 Jul 2012 16:07
Picon
Favicon
Gravatar

Re: newer gcc -> more sample warnings ( <at> Daniel)

On Wed, 4 Jul 2012, Guenter wrote:

> or, maybe verbose:
> +    if(res != CURLE_OK)
> +      printf("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));

I think this is better, and even shows how to use an additional function so I 
think it'd be nice to do.

--

-- 

  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Gmane