+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".
/* 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 <>
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) \
/* 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 <>
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) \
/* 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 <>
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) \