From: Bruno Haible Date: Tue, 15 Oct 2024 14:49:13 +0000 (+0200) Subject: gettext.h: Avoid "warning: ISO C++ forbids variable length array" with -pedantic. X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=d2293e7a807388447b868f4a4333370bd77c8d3e;p=thirdparty%2Fgettext.git gettext.h: Avoid "warning: ISO C++ forbids variable length array" with -pedantic. Both "g++ -pedantic" and "clang++ -pedantic" warn about use of VLAs. Since we cannot distinguish "g++" from "g++ -pedantic" through a preprocessor macro, it's best to not use a VLA in C++. Reported by Jens Seidel via at . * gnulib-local/lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS): Define to 0 in C++ mode. --- diff --git a/gnulib-local/lib/gettext.h b/gnulib-local/lib/gettext.h index 3d3840f9f..e385a30e4 100644 --- a/gnulib-local/lib/gettext.h +++ b/gnulib-local/lib/gettext.h @@ -1,6 +1,5 @@ /* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2020 Free Software - Foundation, Inc. + Copyright (C) 1995-2024 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -191,7 +190,8 @@ npgettext_aux (const char *domain, or may have security implications due to non-deterministic stack usage. */ #if (!defined GNULIB_NO_VLA \ - && (((__GNUC__ >= 3 || defined __clang__) && !defined __STRICT_ANSI__) \ + && (((__GNUC__ >= 3 || defined __clang__) \ + && !defined __STRICT_ANSI__ && !defined __cplusplus) \ /* || (__STDC_VERSION__ == 199901L && !defined __HP_cc) || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )) # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1