]> Savannah Git Hosting - gnulib.git/commitdiff
mbsstr, etc.: Fix compilation in C++ mode on AIX with xlc.
authorBruno Haible <bruno@clisp.org>
Mon, 10 Feb 2025 10:46:01 +0000 (11:46 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 10 Feb 2025 10:46:01 +0000 (11:46 +0100)
* lib/string.in.h (mbsstr, mbspcasecmp, mbscasestr): Wrap template
declarations and definitions in 'extern "C++" { ... }'.

ChangeLog
lib/string.in.h

index 0b209d20c74a4d45d0ed10228a4a94a6914eeebc..eacb2bca04190f1c53442cd78eacb78e50ee347a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-02-10  Bruno Haible  <bruno@clisp.org>
+
+       mbsstr, etc.: Fix compilation in C++ mode on AIX with xlc.
+       * lib/string.in.h (mbsstr, mbspcasecmp, mbscasestr): Wrap template
+       declarations and definitions in 'extern "C++" { ... }'.
+
 2025-02-10  Bruno Haible  <bruno@clisp.org>
 
        mbsstr, unistr, unigbrk: Fix compilation with "gcc-4.8.5 -std=gnu11".
index 0b7f8cebc6feb0649a7f58a5c4c7879206cb6122..ac6b459de9f4db835ebcfda201fa5be5b745346e 100644 (file)
@@ -1182,6 +1182,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 */
 template <typename T>
   T * mbsstr_template (T* haystack, const char *needle);
 template <>
@@ -1190,6 +1191,7 @@ template <>
 template <>
   inline const char * mbsstr_template (const char *haystack, const char *needle)
   { return mbsstr (haystack, needle); }
+}
 #   define mbsstr mbsstr_template
 #  else
 #   if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
@@ -1247,6 +1249,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 */
 template <typename T>
   T * mbspcasecmp_template (T* string, const char *prefix);
 template <>
@@ -1255,6 +1258,7 @@ template <>
 template <>
   inline const char * mbspcasecmp_template (const char *string, const char *prefix)
   { return mbspcasecmp (string, prefix); }
+}
 #   define mbspcasecmp mbspcasecmp_template
 #  else
 #   if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
@@ -1282,6 +1286,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 */
 template <typename T>
   T * mbscasestr_template (T* haystack, const char *needle);
 template <>
@@ -1290,6 +1295,7 @@ template <>
 template <>
   inline const char * mbscasestr_template (const char *haystack, const char *needle)
   { return mbscasestr (haystack, needle); }
+}
 #   define mbscasestr mbscasestr_template
 #  else
 #   if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \