Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)

2010-03-18 Thread Eric Blake
On 03/18/2010 09:45 AM, Grégoire Sutre wrote: >> In >> general, we prefer to avoid #if inside function bodies; it is easier to >> read code where all the #if have been factored out to file scope level >> and function bodies are straight-line code. > > I agree that functions can be difficult to rea

Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)

2010-03-18 Thread Grégoire Sutre
Eric Blake wrote: On 03/17/2010 06:58 PM, Grégoire Sutre wrote: Just out of curiosity: is there a reason for this behavior of AC_CHECK_DECLS, which, quoting the manual, is unlike the other ‘AC_CHECK_*S’ macros? Yes - it looks cleaner to write code like: if (CONDITION) do_something (); than

Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)

2010-03-18 Thread Eric Blake
On 03/17/2010 06:58 PM, Grégoire Sutre wrote: > Just out of curiosity: is there a reason for this behavior of > AC_CHECK_DECLS, which, quoting the manual, is unlike the other > ‘AC_CHECK_*S’ macros? Yes - it looks cleaner to write code like: if (CONDITION) do_something (); than #if CONDITION

Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)

2010-03-17 Thread Grégoire Sutre
Eric Blake wrote: Then you contrast it with AC_CHECK_DECL, which defines HAVE_FUNC_DECL to either 0 or 1, but always defines it. If you use #ifdef in those situations, you lose (you typed 3 more bytes, and you get the wrong result). Ok. Just out of curiosity: is there a reason for this beh

Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)

2010-03-17 Thread Eric Blake
On 03/17/2010 05:00 PM, Grégoire Sutre wrote: > Hi Eric, > >> AC_CHECK_FUNCS leaves HAVE_FUNC undefined if it is missing, but defines >> HAVE_FUNC to 1 if it is present. It is much easier to write: >> >> #if HAVE_FUNC > > In that case you only need to write: > > #ifdef HAVE_FUNC > > which is j

Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)

2010-03-17 Thread Grégoire Sutre
Hi Eric, > AC_CHECK_FUNCS leaves HAVE_FUNC undefined if it is missing, but defines > HAVE_FUNC to 1 if it is present. It is much easier to write: > > #if HAVE_FUNC In that case you only need to write: #ifdef HAVE_FUNC which is just as simple, and is compliant with -Wundef. Moreover, the docu

Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)

2010-03-17 Thread Eric Blake
On 03/16/2010 05:59 PM, Grégoire Sutre wrote: >> In fact, any package which makes good use of Autoconf cannot support >> -Wundef. > > I don't see why. Could you please elaborate? AC_CHECK_FUNCS leaves HAVE_FUNC undefined if it is missing, but defines HAVE_FUNC to 1 if it is present. It is much

Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)

2010-03-16 Thread Grégoire Sutre
Hi, I just discovered your answers [1, 2] on this subject (I'm not registered to the bug-gnulib mailing list). Thanks for the explanations. I take note that Gnulib does not support use of -Wundef. I just want to add that I find it good practice to avoid evaluating undefined identifiers in #if

Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)

2010-01-25 Thread Bruno Haible
Hi, Grégoire Sutre wrote: > ENABLE_NLS is defined in AM_GNU_GETTEXT and the documentation of this > macro [2] does not require ENABLE_NLS to be defined when gettext is not > available. Correct: ENABLE_NLS is not meant to be defined to empty. It is meant to be undefined or defined to 0 (both equ

Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)

2010-01-25 Thread Eric Blake
According to Grégoire Sutre on 1/25/2010 2:53 AM: > Hi, > > This message concerns both gnulib and grub. As discussed on irc and on > the list [1], ENABLE_NLS is not used correctly, which leads to a build > failure when gettext is not detected (or with configure option > --disable-nls). > > ENABL

[PATCH] Fix use of ENABLE_NLS (which is not always defined)

2010-01-25 Thread Grégoire Sutre
Hi, This message concerns both gnulib and grub. As discussed on irc and on the list [1], ENABLE_NLS is not used correctly, which leads to a build failure when gettext is not detected (or with configure option --disable-nls). ENABLE_NLS is defined in AM_GNU_GETTEXT and the documentation of t