From: Bruno Haible Date: Thu, 9 Feb 2023 12:16:31 +0000 (+0100) Subject: Fix error in C++ mode on glibc systems (regression 2022-04-28). X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=45752c1210946f340c6f148c1fb9c7cef350880f;p=gnulib.git Fix error in C++ mode on glibc systems (regression 2022-04-28). * lib/string.in.h (rpl_free): Add exception specification like stdlib.in.h does. * lib/wchar.in.h (rpl_free): Likewise. --- diff --git a/ChangeLog b/ChangeLog index d7a8a329cc..e4c1814a4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-02-09 Bruno Haible + + Fix error in C++ mode on glibc systems (regression 2022-04-28). + * lib/string.in.h (rpl_free): Add exception specification like + stdlib.in.h does. + * lib/wchar.in.h (rpl_free): Likewise. + 2023-02-09 Bruno Haible getcwd: Fix compilation error in C23 mode. diff --git a/lib/string.in.h b/lib/string.in.h index e993b2fb6f..2169af537d 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -125,7 +125,11 @@ # if (@REPLACE_FREE@ && !defined free \ && !(defined __cplusplus && defined GNULIB_NAMESPACE)) /* We can't do '#define free rpl_free' here. */ +# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) +_GL_EXTERN_C void rpl_free (void *) throw (); +# else _GL_EXTERN_C void rpl_free (void *); +# endif # undef _GL_ATTRIBUTE_DEALLOC_FREE # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) # else diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 09c9185f62..c08bca895a 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -188,7 +188,11 @@ typedef int rpl_mbstate_t; # if (@REPLACE_FREE@ && !defined free \ && !(defined __cplusplus && defined GNULIB_NAMESPACE)) /* We can't do '#define free rpl_free' here. */ +# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) +_GL_EXTERN_C void rpl_free (void *) throw (); +# else _GL_EXTERN_C void rpl_free (void *); +# endif # undef _GL_ATTRIBUTE_DEALLOC_FREE # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) # else