From 4d69ca3a46d93849cd2ea5762413bb0c8c149382 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 15 Jul 2024 04:32:04 +0200 Subject: [PATCH] stdlib: Fix last commit on macOS, OpenBSD, mingw. * lib/stdlib.in.h: Don't include with clang, and don't include it on platforms other than Solaris. --- ChangeLog | 4 ++++ lib/stdlib.in.h | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e09503f44..368a289c41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2024-07-14 Bruno Haible + stdlib: Fix last commit on macOS, OpenBSD, mingw. + * lib/stdlib.in.h: Don't include 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 before strtol, strtoll, strtoul, or strtoull gets defined as a macro. diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index ac328eb5e7..e42368eef2 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -117,13 +117,14 @@ struct random_data # include #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 #endif -- 2.39.5