From d2293e7a807388447b868f4a4333370bd77c8d3e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 15 Oct 2024 16:49:13 +0200 Subject: [PATCH] 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. --- gnulib-local/lib/gettext.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 -- 2.47.2