# HG changeset patch
# User Pádraig Brady
# Date 1547445910 28800
# Node ID 2b02557843074c322558c00e64bd1a82d18a4dac
# Parent 367366e0baa020dd51dd793278f46b22b1be8ef2
gettext: support disabling use of VLAs
* lib/gettext.h: Disable use of VLAs if GNULIB_NO_VLA is defined
diff -r 367366e0baa0 -r 2b0255784307 ChangeLog
--- a/ChangeLog Sat Jan 19 08:42:53 2019 -0800
+++ b/ChangeLog Sun Jan 13 22:05:10 2019 -0800
@@ -1,3 +1,8 @@
+2019-01-19 Pádraig Brady
+
+ gettext: support disabling use of VLAs
+ * lib/gettext.h: Disable use of VLAs if GNULIB_NO_VLA is defined
+
2019-01-17 KO Myung-Hun
sys_stat: Fix 'implicit declaration of function' warning on OS/2 kLIBC.
diff -r 367366e0baa0 -r 2b0255784307 lib/gettext.h
--- a/lib/gettext.h Sat Jan 19 08:42:53 2019 -0800
+++ b/lib/gettext.h Sun Jan 13 22:05:10 2019 -0800
@@ -184,9 +184,16 @@
#include
-#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
- /* || (__STDC_VERSION__ == 199901L && !defined __HP_cc)
- || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )
+/* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported.
+ This relates to the -Wvla and -Wvla-larger-than warnings, enabled in
+ the default GCC many warnings set. This allows programs to disable use
+ of VLAs, which may be unintended, or may be awkward to support portably,
+ or may have security implications due to non-deterministic stack usage. */
+
+#if (!defined GNULIB_NO_VLA \
+ && (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
+ /* || (__STDC_VERSION__ == 199901L && !defined __HP_cc)
+ || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ ))
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
#else
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0