[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
string, wchar: Fix error in C++ mode on glibc systems with clang
From: |
Bruno Haible |
Subject: |
string, wchar: Fix error in C++ mode on glibc systems with clang |
Date: |
Thu, 14 Apr 2022 00:53:20 +0200 |
Building a complete gnulib testdir on a glibc system with clang 13, I see
this error (from test-wchar-c++3.cc):
/usr/include/stdlib.h:565:13: error: exception specification in declaration
does not match previous declaration
This patch fixes it.
2022-04-13 Bruno Haible <bruno@clisp.org>
string, wchar: Fix error in C++ mode on glibc systems with clang.
* lib/string.in.h (free): Add exception specification like glibc does.
* lib/wchar.in.h (free): Likewise.
diff --git a/lib/string.in.h b/lib/string.in.h
index b818ae9cdf..b6840fa912 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -125,14 +125,22 @@ _GL_EXTERN_C void rpl_free (void *);
# if defined _MSC_VER
_GL_EXTERN_C void __cdecl free (void *);
# else
+# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
+_GL_EXTERN_C void free (void *) throw ();
+# else
_GL_EXTERN_C void free (void *);
+# endif
# endif
# endif
#else
# if defined _MSC_VER
_GL_EXTERN_C void __cdecl free (void *);
# else
+# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
+_GL_EXTERN_C void free (void *) throw ();
+# else
_GL_EXTERN_C void free (void *);
+# endif
# endif
#endif
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index d7792e5fb7..0d5c0b7abe 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -188,14 +188,22 @@ _GL_EXTERN_C void rpl_free (void *);
# if defined _MSC_VER
_GL_EXTERN_C void __cdecl free (void *);
# else
+# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
+_GL_EXTERN_C void free (void *) throw ();
+# else
_GL_EXTERN_C void free (void *);
+# endif
# endif
# endif
#else
# if defined _MSC_VER
_GL_EXTERN_C void __cdecl free (void *);
# else
+# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
+_GL_EXTERN_C void free (void *) throw ();
+# else
_GL_EXTERN_C void free (void *);
+# endif
# endif
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- string, wchar: Fix error in C++ mode on glibc systems with clang,
Bruno Haible <=