Bruno Haible <[EMAIL PROTECTED]> wrote: > Paul Eggert wrote: >> 2. The "#if ENABLE_NLS" isn't needed, since gettext.h does the right >> thing anyway. > >> -#if ENABLE_NLS >> /* Set the text message domain. */ >> bindtextdomain (PACKAGE, LOCALEDIR); >> textdomain (PACKAGE); >> -#endif > > But with this, configuring with "./configure --disable-nls CPPFLAGS=-Wall", > I get warnings: > > hello.c: In function 'main': > hello.c:53: warning: statement with no effect > hello.c:54: warning: statement with no effect > > So, either add casts to void: > > /* Set the text message domain. */ > (void) bindtextdomain (PACKAGE, LOCALEDIR); > (void) textdomain (PACKAGE); > > or add back the #if ENABLE_NLS. > > Since these (void) casts make the code look ancient and are not very > understandable, my preferrence is for the #if ENABLE_NLS - it's clear > what it means.
Better still, add this in system.h: #if ! ENABLE_NLS # undef textdomain # define textdomain(Domainname) /* empty */ # undef bindtextdomain # define bindtextdomain(Domainname, Dirname) /* empty */ #endif Then your function body isn't "dirtied" with #if directives, the *textdomain functions are defined away, and you don't need the anachronistic-looking (void) casts. 2006-11-10 Jim Meyering <[EMAIL PROTECTED]> * system.h: Avoid warnings when configured with "./configure --disable-nls CFLAGS=-Wall". Reported by Bruno Haible. Index: src/system.h =================================================================== RCS file: /sources/hello/hello/src/system.h,v retrieving revision 1.5 diff -u -r1.5 system.h --- src/system.h 23 Aug 2006 13:55:15 -0000 1.5 +++ src/system.h 10 Nov 2006 16:08:04 -0000 @@ -34,6 +34,13 @@ #define _(str) gettext (str) #define N_(str) gettext_noop (str) +#if ! ENABLE_NLS +# undef textdomain +# define textdomain(Domainname) /* empty */ +# undef bindtextdomain +# define bindtextdomain(Domainname, Dirname) /* empty */ +#endif + /* Check for errors on write. */ #include "closeout.h"