]> Savannah Git Hosting - gnulib.git/commitdiff
Fix compilation errors in C++ mode on Solaris 11 OpenIndiana.
authorBruno Haible <bruno@clisp.org>
Tue, 27 Dec 2022 10:21:45 +0000 (11:21 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 1 Jan 2023 09:23:10 +0000 (10:23 +0100)
* 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.

ChangeLog
lib/string.in.h
lib/wchar.in.h
m4/gnulib-common.m4

index c1d8f780d2108ac8e2b070258a6b681d9c60a34e..49744cad871bf6df5c94e5c290b2f3377c5fee07 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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-26  Paul Eggert  <eggert@cs.ucla.edu>
 
        stdbool-c99: fix typo
index e56f6db0c9ca7bcd4deecbd1cbd29f4750d8d6b2..0fe4a5e1f82d4da8c6928961a861bdd78729ed47 100644 (file)
    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
index 3558adfb9d5d34b62475c4e61f7e30eb8b72535b..70b8d7d259a54be1b50d77770ae5b15d1b093b0d 100644 (file)
    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
index 88427fe003d9c25523eb2de6d93f560b84e53aa0..91c2b2e37f564469c8c510262f37851e6e5e91c9 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 69.1
+# gnulib-common.m4 serial 69.2
 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.