]> Savannah Git Hosting - gnulib.git/commitdiff
stdlib: Fix last commit on macOS, OpenBSD, mingw.
authorBruno Haible <bruno@clisp.org>
Mon, 15 Jul 2024 02:32:04 +0000 (04:32 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 15 Jul 2024 02:32:04 +0000 (04:32 +0200)
* lib/stdlib.in.h: Don't include <string> with clang, and don't include
it on platforms other than Solaris.

ChangeLog
lib/stdlib.in.h

index 0e09503f447f934bca586722d49a45c00bea2dac..368a289c418627217fffd8180c71ab42c224415e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2024-07-14  Bruno Haible  <bruno@clisp.org>
 
+       stdlib: Fix last commit on macOS, OpenBSD, mingw.
+       * lib/stdlib.in.h: Don't include <string> with clang, and don't include
+       it on platforms other than Solaris.
+
        stdlib: Avoid syntax errors in libstdc++ header files.
        * lib/stdlib.in.h: Include <string> before strtol, strtoll, strtoul, or
        strtoull gets defined as a macro.
index ac328eb5e74fa645422fe22e9af44a2f5d34afa7..e42368eef270a1948173954ada321d26ccad9ce7 100644 (file)
@@ -117,13 +117,14 @@ struct random_data
 # include <unistd.h>
 #endif
 
-#if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ && @REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) || (@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined GNULIB_NAMESPACE && defined __GNUG__
+#if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ && @REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) || (@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined GNULIB_NAMESPACE && defined __GNUG__ && !defined __clang__ && defined __sun
 /* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro
    below, this may cause compilation errors later in the libstdc++ header files
    (that are part of GCC), such as:
      error: 'rpl_strtol' is not a member of 'std'
    To avoid this, include the relevant header files here, before these symbols
-   get defined as macros.  */
+   get defined as macros.  But do so only on Solaris 11 (where it is needed),
+   not on mingw (where it would cause other compilation errors).  */
 # include <string>
 #endif