I wrote:
> The common convention is that all .h files must be included *outside*
> of extern "C" blocks.
> 
> Therefore, this is the correct fix:
> 
> 
> 2026-05-09  Bruno Haible  <[email protected]>
> 
>       strings-h: Fix compilation error on AIX in C++ mode.
>       * lib/strings.in.h: On AIX in C++ mode, before including the system's
>       <strings.h> file, include <string.h>.

But now that, for the sake of Solaris 10, string.in.h contains a fourth
extern "C++" { ... } block, this change has become unnecessary.


2026-05-10  Bruno Haible  <[email protected]>

        strings-h: Revert last change, now unnecessary.
        * lib/strings.in.h: Revert last change.
        * lib/string.in.h: Update comments.

diff --git a/lib/string.in.h b/lib/string.in.h
index 8e4fd8f81e..1c46c65f60 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -1272,7 +1272,7 @@ _GL_STRNUL_INLINE const char *_gl_strnul (const char 
*string)
 }
 #  endif
 #  ifdef __cplusplus
-extern "C++" { /* needed for Solaris 10 */
+extern "C++" { /* needed for AIX and Solaris 10 */
 _GL_BEGIN_NAMESPACE
 template <typename T> T strnul (T);
 template <> inline const char *strnul<const char *> (const char *s)
@@ -1411,7 +1411,7 @@ _GL_EXTERN_C char * mbsstr (const char *haystack, const 
char *needle)
 /* Don't silently convert a 'const char *' to a 'char *'.  Programmers want
    compiler warnings for 'const' related mistakes.  */
 #  ifdef __cplusplus
-extern "C++" { /* needed for AIX */
+extern "C++" { /* needed for AIX and Solaris 10 */
 template <typename T>
   T * mbsstr_template (T* haystack, const char *needle);
 template <>
@@ -1479,7 +1479,7 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, 
const char *prefix)
 /* Don't silently convert a 'const char *' to a 'char *'.  Programmers want
    compiler warnings for 'const' related mistakes.  */
 #  ifdef __cplusplus
-extern "C++" { /* needed for AIX */
+extern "C++" { /* needed for AIX and Solaris 10 */
 template <typename T>
   T * mbspcasecmp_template (T* string, const char *prefix);
 template <>
@@ -1517,7 +1517,7 @@ _GL_EXTERN_C char * mbscasestr (const char *haystack, 
const char *needle)
 /* Don't silently convert a 'const char *' to a 'char *'.  Programmers want
    compiler warnings for 'const' related mistakes.  */
 #  ifdef __cplusplus
-extern "C++" { /* needed for AIX */
+extern "C++" { /* needed for AIX and Solaris 10 */
 template <typename T>
   T * mbscasestr_template (T* haystack, const char *needle);
 template <>
diff --git a/lib/strings.in.h b/lib/strings.in.h
index 68152e83bd..fd7cd2df67 100644
--- a/lib/strings.in.h
+++ b/lib/strings.in.h
@@ -30,11 +30,6 @@
 
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_STRINGS_H@
-/* AIX 7.3 has a bug: In C++ mode, <string.h> must be included before
-   <strings.h>.  */
-# if defined __cplusplus && defined _AIX
-#  include <string.h>
-# endif
 # @INCLUDE_NEXT@ @NEXT_STRINGS_H@
 #endif
 




  • strnul and AIX C++ Bruno Haible via Gnulib discussion list
    • Re: strnul and AIX C++ Bruno Haible via Gnulib discussion list

Reply via email to