g++ has predefined _XOPEN_SOURCE=600 since
[fixincludes, v3] Enable full ISO C99 support for C++ on Solaris 10+
http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01308.html
While Solaris 10 introduced XPG6/POSIX.1-2001 support, the default
compilation environment remained XPG3 until Solaris 11.3. However,
libstdc++ uses many XPG6 interfaces, so g++ need to explicitly enable
that.
Only Solaris 11.4 implemented XPG7/POSIX.1-2008 support, at the same
time changing the default to XPG7.
Therefore, g++ can remove the explicit enablement of XPG6, using the
11.4 default just like gcc has done all the time.
__EXTENSIONS__ needs to remain, however: a considerable part of
libstdc++ depends on that.
Bootstrapped on i386-pc-solaris2.11, amd64-pc-solaris2.11,
sparc-sun-solaris2.11, and sparcv9-sun-solaris2.11. There were no
changed to any config.h file.
I'll commit this to trunk in a few days unless Jonathan finds fault with
the change and the Rust patch below has been committed:
The patch caused little problems, fortunately:
libsanitizer: Fix sanitizer_platform_limits_solaris.cpp compilation
https://gcc.gnu.org/pipermail/gcc-patches/2026-May/716950.html
A one-line change already upstream.
rust: Avoid generic PRIVATE etc. identifiers to fix Solaris build
https://gcc.gnu.org/pipermail/gcc-patches/2026-May/716934.html
The use of PRIVATE as an identifier would have caused the same problem
in C code already.
I'll mention this in the GCC 17 changes.html once we get there.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2026-05-15 Rainer Orth <[email protected]>
gcc:
* config/sol2.h (TARGET_OS_CPP_BUILTINS): Don't define
_XOPEN_SOURCE=600 for C++.
# HG changeset patch
# Parent 75276205765a23fd124e541307b179f8fa9a92af
Don't predefine _XOPEN_SOURCE=600 for C++ on Solaris
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -114,7 +114,6 @@ along with GCC; see the file COPYING3.
builtin_define ("__STDC_VERSION__=201112L");\
break; \
} \
- builtin_define ("_XOPEN_SOURCE=600"); \
builtin_define ("_LARGEFILE_SOURCE=1"); \
builtin_define ("_LARGEFILE64_SOURCE=1"); \
builtin_define ("_FILE_OFFSET_BITS=64"); \