[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: yet another hello pretest
From: |
Jim Meyering |
Subject: |
Re: yet another hello pretest |
Date: |
Fri, 10 Nov 2006 17:11:04 +0100 |
Bruno Haible <address@hidden> 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 <address@hidden>
* 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"
- yet another hello pretest, Karl Berry, 2006/11/08
- Re: yet another hello pretest, Eric Blake, 2006/11/09
- Re: yet another hello pretest, Ben Pfaff, 2006/11/09
- Re: [bug-gnulib] yet another hello pretest, Bruno Haible, 2006/11/09
- Re: yet another hello pretest, Paul Eggert, 2006/11/09
- Re: yet another hello pretest, Karl Berry, 2006/11/09
- Re: [bug-gnulib] yet another hello pretest, Bruno Haible, 2006/11/10
- Re: yet another hello pretest,
Jim Meyering <=
- Re: yet another hello pretest, Bruno Haible, 2006/11/10
- Re: yet another hello pretest, Jim Meyering, 2006/11/10
- Re: yet another hello pretest, Bruno Haible, 2006/11/10
- Re: yet another hello pretest, Karl Berry, 2006/11/13
Re: yet another hello pretest, Karl Berry, 2006/11/09
Re: yet another hello pretest, Karl Berry, 2006/11/09
Re: yet another hello pretest, Ralf Wildenhues, 2006/11/12