changeset 16983:956d27419f62

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>.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 11 Jul 2012 21:16:27 -0700
parents b2b7a85fce95
children c31ccd2abb3e
files ChangeLog lib/gettext.h
diffstat 2 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-07-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+	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  <eggert@cs.ucla.edu>
 
 	getloadavg: clean out old Emacs and Autoconf cruft
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -183,9 +183,12 @@
 
 #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>