cURL / Mailing Lists / curl-library / Single Mail

curl-library

Problem with old GCC and -Wall: declaration of 'wait' shadows a global declaration

From: Jiří Hruška <jirka_at_fud.cz>
Date: Sun, 17 Feb 2013 23:58:16 +0100

Hi Daniel,

your commit c25383ae "rename "easy" statemachines: call them block
instead" seems to have broken compilation with old GCC and -Werror due
to a conflict between parameter "wait" of the new Curl_pp_statemach()
and system-provided function wait(2).

This was on a quite old and dirty machine when I accidentally used the
ancient, platform-provided GCC 3.4.6, but still I thought I'd better
let you know as you seem to care even about such systems around here.

gcc -DHAVE_CONFIG_H -I../include/curl -I../include -I../include
-I../lib -I../lib -DCURL_HIDDEN_SYMBOLS -DDEBUGBUILD -DCURLDEBUG
-fvisibility=hidden -g -O0 -pedantic -Wall -W -Wpointer-arith
-Wwrite-strings -Wunused -Wshadow -Winline -Wnested-externs
-Wmissing-declarations -Wmissing-prototypes -Wno-long-long
-Wfloat-equal -Wno-multichar -Wsign-compare -Wundef
-Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes
-Wdeclaration-after-statement -Wno-system-headers -Werror -MT
libcurl_la-curl_ntlm_wb.lo -MD -MP -MF
.deps/libcurl_la-curl_ntlm_wb.Tpo -c curl_ntlm_wb.c -fPIC -DPIC -o
.libs/libcurl_la-curl_ntlm_wb.o
In file included from imap.h:25,
                 from urldata.h:170,
                 from curl_ntlm_wb.c:43:
pingpong.h:77: warning: declaration of 'wait' shadows a global declaration
/usr/include/sys/wait.h:115: warning: shadowed declaration is here
make[2]: *** [libcurl_la-curl_ntlm_wb.lo] Error 1

pingpong.h:77:
CURLcode Curl_pp_statemach(struct pingpong *pp, bool wait);

/usr/include/sys/wait.h:115:
extern __pid_t wait (__WAIT_STATUS __stat_loc);

$ cat /etc/redhat-release; gcc -v
Red Hat Enterprise Linux AS release 4 (Nahant Update 7)
gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)

No other problems with GCC 4.6.2 on the same machine, or when I
changed it to e.g. "bool waitx".

Kind regards,
Jiri
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-02-17