Mercurial > gnulib
changeset 40108:2b0255784307
gettext: support disabling use of VLAs
* lib/gettext.h: Disable use of VLAs if GNULIB_NO_VLA is defined
author | Pádraig Brady <P@draigBrady.com> |
---|---|
date | Sun, 13 Jan 2019 22:05:10 -0800 |
parents | 367366e0baa0 |
children | e2e6dc79463b |
files | ChangeLog lib/gettext.h |
diffstat | 2 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 <P@draigBrady.com> + + 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 <komh78@gmail.com> sys_stat: Fix 'implicit declaration of function' warning on OS/2 kLIBC.
--- 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 <string.h> -#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