From: Bruno Haible Date: Sun, 14 Jul 2024 18:45:46 +0000 (+0200) Subject: stdlib: Avoid syntax errors in libstdc++ header files. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=a2e5d6e75baea61e1843ae66770d12cb16d5c248;p=gnulib.git 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/ChangeLog b/ChangeLog index 59ef69c6d1..838ff1e683 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-07-14 Bruno Haible + + stdlib: Avoid syntax errors in libstdc++ header files. + * lib/stdlib.in.h: Include before strtol, strtoll, strtoul, or + strtoull gets defined as a macro. + 2024-07-14 Bruno Haible Activate strtold workarounds. diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 92df9bd266..d068d0cb58 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -117,6 +117,17 @@ 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__ && !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. But do so only on Solaris 11 (where it is needed), + not on mingw (where it would cause other compilation errors). */ +# include +#endif + /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers that can be freed by passing them as the Ith argument to the function F. */