bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] gettext: do not assume '#define ... defined ...' behavior


From: Paul Eggert
Subject: [PATCH] gettext: do not assume '#define ... defined ...' behavior
Date: Wed, 11 Jul 2012 21:21:38 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

Here's a proposed patch to fix a gnulib portability bug uncovered
with gzip 1.5.

---
 ChangeLog     |    9 +++++++++
 lib/gettext.h |    9 ++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b27ef8d..7dacfb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-07-11  Paul Eggert  <address@hidden>
+
+       gettext: do not assume '#define ... defined ...' behavior
+       * lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS):
+       Do not use '#define FOO ... defined BAR ...', as the C standard says
+       it's not portable to expect that this works after macro expansion.
+       Problem reported for gzip by Steven M. Schweda in
+       <http://lists.gnu.org/archive/html/bug-gzip/2012-07/msg00000.html>.
+
 2012-07-10  Paul Eggert  <address@hidden>
 
        getloadavg: clean out old Emacs and Autoconf cruft
diff --git a/lib/gettext.h b/lib/gettext.h
index 1c5cab9..c63d907 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -183,9 +183,12 @@ npgettext_aux (const char *domain,
 
 #include <string.h>
 
-#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
-  (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
-   /* || __STDC_VERSION__ >= 199901L */ )
+#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
+     /* || __STDC_VERSION__ >= 199901L */ )
+# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
+#else
+# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
+#endif
 
 #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
 #include <stdlib.h>
-- 
1.7.6.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]