summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-12-27 11:21:45 +0100
committerBruno Haible <bruno@clisp.org>2022-12-27 11:21:45 +0100
commitfde75446490e18d2539817ca418ab8adf73b02d3 (patch)
treea267b4b66c8d084b8258255bd18d4cc5120163fe
parent0455e4cfe51150108c2239380a0f81ba321b4e7c (diff)
downloadgnulib-fde75446490e18d2539817ca418ab8adf73b02d3.tar.gz
Fix compilation errors in C++ mode on Solaris 11 OpenIndiana.
* m4/gnulib-common.m4 (gl_COMMON_BODY): In _GL_ATTRIBUTE_DEALLOC_FREE, with GNU C++, cast the 'free' function. * lib/string.in.h (_GL_ATTRIBUTE_DEALLOC_FREE): With GNU C++, cast the 'free' function. * lib/wchar.in.h (_GL_ATTRIBUTE_DEALLOC_FREE): Likewise.
-rw-r--r--ChangeLog9
-rw-r--r--lib/string.in.h9
-rw-r--r--lib/wchar.in.h9
-rw-r--r--m4/gnulib-common.m411
4 files changed, 34 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index aeacc1dae6..c5de4b0809 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2022-12-27 Bruno Haible <bruno@clisp.org>
+ Fix compilation errors in C++ mode on Solaris 11 OpenIndiana.
+ * m4/gnulib-common.m4 (gl_COMMON_BODY): In _GL_ATTRIBUTE_DEALLOC_FREE,
+ with GNU C++, cast the 'free' function.
+ * lib/string.in.h (_GL_ATTRIBUTE_DEALLOC_FREE): With GNU C++, cast the
+ 'free' function.
+ * lib/wchar.in.h (_GL_ATTRIBUTE_DEALLOC_FREE): Likewise.
+
+2022-12-27 Bruno Haible <bruno@clisp.org>
+
stdnoreturn: Mark as deprecated, not obsolete. (Regression 2022-12-24.)
* modules/stdnoreturn (Status): Remove.
(Notice): Say that it is deprecated, not obsolete.
diff --git a/lib/string.in.h b/lib/string.in.h
index 21356914e2..64a0ab19f7 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -82,7 +82,14 @@
can be freed via 'free'; it can be used only after declaring 'free'. */
/* Applies to: functions. Cannot be used on inline functions. */
#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
-# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
+# if defined __cplusplus && defined __GNUC__ && !defined __clang__
+/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */
+# define _GL_ATTRIBUTE_DEALLOC_FREE \
+ _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
+# else
+# define _GL_ATTRIBUTE_DEALLOC_FREE \
+ _GL_ATTRIBUTE_DEALLOC (free, 1)
+# endif
#endif
/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 3558adfb9d..70b8d7d259 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -99,7 +99,14 @@
can be freed via 'free'; it can be used only after declaring 'free'. */
/* Applies to: functions. Cannot be used on inline functions. */
#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
-# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
+# if defined __cplusplus && defined __GNUC__ && !defined __clang__
+/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */
+# define _GL_ATTRIBUTE_DEALLOC_FREE \
+ _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
+# else
+# define _GL_ATTRIBUTE_DEALLOC_FREE \
+ _GL_ATTRIBUTE_DEALLOC (free, 1)
+# endif
#endif
/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 728a006ce8..40c19cab69 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 74
+# gnulib-common.m4 serial 75
dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -187,7 +187,14 @@ AC_DEFUN([gl_COMMON_BODY], [
to use this earlier definition, since <stdlib.h> may not have been included
yet. */
#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
-# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
+# if defined __cplusplus && defined __GNUC__ && !defined __clang__
+/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */
+# define _GL_ATTRIBUTE_DEALLOC_FREE \
+ _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
+# else
+# define _GL_ATTRIBUTE_DEALLOC_FREE \
+ _GL_ATTRIBUTE_DEALLOC (free, 1)
+# endif
#endif
/* _GL_ATTRIBUTE_DEPRECATED: Declares that an entity is deprecated.