From: Collin Funk Date: Sat, 12 Apr 2025 20:24:31 +0000 (-0700) Subject: stdlib: Avoid syntax errors in libstdc++ header files on AIX. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=79fa09434c01cae7ee72bc1534257296818e0143;p=gnulib.git stdlib: Avoid syntax errors in libstdc++ header files on AIX. * lib/stdlib.in.h: Include before strtol, strtoll, strtoul, or strtoull gets defined as a macro. --- diff --git a/ChangeLog b/ChangeLog index 0733b2b95a..33cae49b8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2025-04-12 Collin Funk + stdlib: Avoid syntax errors in libstdc++ header files on AIX. + * lib/stdlib.in.h: Include before strtol, strtoll, strtoul, or + strtoull gets defined as a macro. + aligned-malloc tests: Avoid redefining macros on AIX. * tests/test-aligned-malloc.c (ALIGNMENT): Undefine any definition from system headers. diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 2077a63fc6..dbe8ebc850 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -120,14 +120,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__ && !defined __clang__ && defined __sun +#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 || defined _AIX) /* 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). */ + get defined as macros. But do so only on Solaris 11 and AIX (where it is + needed), not on mingw (where it would cause other compilation errors). */ # include #endif