From ca62a1a27c32d54b8d1d23452334c938293bcaf4 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 9 Feb 2023 13:16:31 +0100 Subject: [PATCH] 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. --- ChangeLog | 7 +++++++ lib/string.in.h | 4 ++++ lib/wchar.in.h | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 051c230b02..66b0c6f7aa 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 0fe4a5e1f8..cac982ee25 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 70b8d7d259..6b4981a49a 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 -- 2.39.5