"Joel E. Denny" <[EMAIL PROTECTED]> writes: > Several functions in Gnulib's gettext.h don't use their domain and > category parameters. Bison won't build with --enable-gcc-warnings as a > result.
Thanks for reporting this. I reproduced the problem with CVS Bison by configuring it with --enable-gcc-warnings. Here are the symptoms: gcc -std=gnu99 -I. -I../lib -I../lib -Wall -Wextra -Wno-sign-compare -Wcast-align -Wcast-qual -Wformat -Wpointer-arith -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wshadow -Wstrict-prototypes -Werror -g -O2 -MT LR0.o -MD -MP -MF .deps/LR0.Tpo -c -o LR0.o LR0.c cc1: warnings being treated as errors In file included from system.h:111, from LR0.c:28: ../lib/gettext.h: In function 'pgettext_aux': ../lib/gettext.h:128: warning: unused parameter 'domain' ../lib/gettext.h:130: warning: unused parameter 'category' ../lib/gettext.h: In function 'npgettext_aux': ../lib/gettext.h:147: warning: unused parameter 'domain' ../lib/gettext.h:150: warning: unused parameter 'category' ../lib/gettext.h: In function 'dcpgettext_expr': ../lib/gettext.h:186: warning: unused parameter 'domain' ../lib/gettext.h:188: warning: unused parameter 'category' ../lib/gettext.h: In function 'dcnpgettext_expr': ../lib/gettext.h:231: warning: unused parameter 'domain' ../lib/gettext.h:234: warning: unused parameter 'category' make[2]: *** [LR0.o] Error 1 make[2]: Leaving directory `/home/eggert/src/gnu/bison/src' make[1]: *** [all] Error 2 make[1]: Leaving directory `/home/eggert/src/gnu/bison/src' make: *** [all-recursive] Error 1 Here is a proposed patch to gnulib/lib/gettext.h, which works for me: 2006-11-09 Paul Eggert <[EMAIL PROTECTED]> * lib/gettext.h (dgettext, dcgettext, ngettext) [! ENABLE_NLS]: (dngettext, dcngettext, bindtextdomain) [! ENABLE_NLS]: (bind_textdomain_codeset) [! ENABLE_NLS]: Evaluate all the arguments. That way, callers get compatible behavior if the arguments have side effects. Also, it avoids some GCC diagnostics in some cases; Joel E. Denny reported problems when Bison was configured with --enable-gcc-warnigs. Index: lib/gettext.h =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/gettext.h,v retrieving revision 1.12 diff -p -c -r1.12 gettext.h *** lib/gettext.h 25 Oct 2006 18:56:19 -0000 1.12 --- lib/gettext.h 9 Nov 2006 20:53:32 -0000 *************** *** 64,80 **** On pre-ANSI systems without 'const', the config.h file is supposed to contain "#define const". */ # define gettext(Msgid) ((const char *) (Msgid)) ! # define dgettext(Domainname, Msgid) ((const char *) (Msgid)) ! # define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) # define ngettext(Msgid1, Msgid2, N) \ ! ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) # define dngettext(Domainname, Msgid1, Msgid2, N) \ ! ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ ! ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) # define textdomain(Domainname) ((const char *) (Domainname)) ! # define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) ! # define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) #endif --- 64,85 ---- On pre-ANSI systems without 'const', the config.h file is supposed to contain "#define const". */ # define gettext(Msgid) ((const char *) (Msgid)) ! # define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) ! # define dcgettext(Domainname, Msgid, Category) \ ! ((void) (Category), dgettext (Domainname, Msgid)) # define ngettext(Msgid1, Msgid2, N) \ ! ((N) == 1 \ ! ? ((void) (Msgid2), (const char *) (Msgid1)) \ ! : ((void) (Msgid1), (const char *) (Msgid2))) # define dngettext(Domainname, Msgid1, Msgid2, N) \ ! ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ ! ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) # define textdomain(Domainname) ((const char *) (Domainname)) ! # define bindtextdomain(Domainname, Dirname) \ ! ((void) (Domainname), (const char *) (Dirname)) ! # define bind_textdomain_codeset(Domainname, Codeset) \ ! ((void) (Domainname), (const char *) (Codeset)) #endif