From dd6445b62f4042b5ee44bfc960a14e3888742f85 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 14 Jul 2024 20:45:46 +0200 Subject: [PATCH] stdlib: Avoid syntax errors in libstdc++ header files. * lib/stdlib.in.h: Include before strtol, strtoll, strtoul, or strtoull gets defined as a macro. --- ChangeLog | 6 ++++++ lib/stdlib.in.h | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6bca856db2..0e09503f44 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 47a8856dc7..ac328eb5e7 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -117,6 +117,16 @@ 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__ +/* 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. */ +# 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. */ -- 2.39.5