Exclude Apple platforms from _XOPEN_SOURCE definition#343
Merged
mkruskal-google merged 9 commits intoJun 29, 2026
Merged
Conversation
_XOPEN_SOURCE 500 was added in google#266 to fix a QNX-specific compile error. On Apple platforms, defining it lowers __DARWIN_C_LEVEL, hiding C11 additions like quick_exit/at_quick_exit. GCC 15's libstdc++ <cstdlib> unconditionally re-exports these symbols, which fails to compile when they're hidden by this macro. Add __APPLE__ to the existing exclusion list alongside FreeBSD and OpenBSD, consistent with how those platforms are already handled. See abseil/abseil-cpp#2095
… with Bazel BUILD file
This reverts commit 3ae438d.
This reverts commit 433ab0e.
mkruskal-google
approved these changes
Jun 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This addresses the macOS+GCC15 build failure discussed in
abseil/abseil-cpp#2095, per @mkruskal-google's suggestion there.
Background
#265 added
_XOPEN_SOURCE 500to fix a QNX-specific compile error,excluding FreeBSD and OpenBSD. This wasn't tested against Apple
platforms at the time.
Problem
On Apple platforms, defining
_XOPEN_SOURCElowers__DARWIN_C_LEVEL,hiding C11 additions like
quick_exit/at_quick_exit. GCC 15'slibstdc++
<cstdlib>unconditionally re-exports these symbols, whichfails to compile when they're hidden:
error: 'quick_exit' has not been declared in '::'Fix
Add
__APPLE__to the existing exclusion list alongside FreeBSD andOpenBSD, consistent with how those platforms are already handled.
Testing
Verified with a CI workflow on a macos-latest runner + Homebrew GCC 15: