From e5ba746bbe60e1f9d6ba89acaf2cbd9ec0a76f06 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/malloc.in.h (rpl_free): Add exception specification like stdlib.in.h does. * lib/string.in.h (rpl_free): Likewise. * lib/wchar.in.h (rpl_free): Likewise. --- ChangeLog | 8 ++++++++ lib/malloc.in.h | 4 ++++ lib/string.in.h | 4 ++++ lib/wchar.in.h | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index f9b21e5c42..2bbb71a3ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-02-09 Bruno Haible + + Fix error in C++ mode on glibc systems (regression 2022-04-28). + * lib/malloc.in.h (rpl_free): Add exception specification like + stdlib.in.h does. + * lib/string.in.h (rpl_free): Likewise. + * lib/wchar.in.h (rpl_free): Likewise. + 2023-02-09 Bruno Haible getcwd: Fix compilation error in C23 mode. diff --git a/lib/malloc.in.h b/lib/malloc.in.h index 4921f6e994..2fcbe23535 100644 --- a/lib/malloc.in.h +++ b/lib/malloc.in.h @@ -65,7 +65,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/string.in.h b/lib/string.in.h index aa08821392..b6bf432e1f 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -126,7 +126,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 bbca92797d..2beddd780f 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