Skip to content
Snippets Groups Projects
Commit 67be156f authored by Alexandre Oliva's avatar Alexandre Oliva Committed by Alexandre Oliva
Browse files

[libstdc++] add _GLIBCXX_CLANG to workaround predefined __clang__

A proprietary embedded operating system that uses clang as its primary
compiler ships headers that require __clang__ to be defined.  Defining
that macro causes libstdc++ to adopt workarounds that work for clang
but that break for GCC.

So, introduce a _GLIBCXX_CLANG macro, and a convention to test for it
rather than for __clang__, so that a GCC variant that adds -D__clang__
to satisfy system headers can also -D_GLIBCXX_CLANG=0 to avoid
workarounds that are not meant for GCC.

I've left fast_float and ryu files alone, their tests for __clang__
don't seem to be harmful for GCC, they don't include bits/c++config,
and patching such third-party files would just make trouble for
updating them without visible benefit.  pstl_config.h, though also
imported, required adjustment.


for  libstdc++-v3/ChangeLog

	* include/bits/c++config (_GLIBCXX_CLANG): Define or undefine.
	* include/bits/locale_facets_nonio.tcc: Test for it.
	* include/bits/stl_bvector.h: Likewise.
	* include/c_compatibility/stdatomic.h: Likewise.
	* include/experimental/bits/simd.h: Likewise.
	* include/experimental/bits/simd_builtin.h: Likewise.
	* include/experimental/bits/simd_detail.h: Likewise.
	* include/experimental/bits/simd_x86.h: Likewise.
	* include/experimental/simd: Likewise.
	* include/std/complex: Likewise.
	* include/std/ranges: Likewise.
	* include/std/variant: Likewise.
	* include/pstl/pstl_config.h: Likewise.
parent 961dd0d6
Loading
Showing
with 42 additions and 31 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment