diff options
author | Alexandre Oliva <oliva@adacore.com> | 2024-06-05 22:43:54 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2024-06-05 22:43:54 -0300 |
commit | 67be156f952241ad99af1eedc4da91bc2e201cd3 (patch) | |
tree | 8b67b7b6020d2fa723b5164506ab4111ff446221 /libstdc++-v3/include/std/complex | |
parent | 961dd0d635217c703a38c48903981e0d60962546 (diff) | |
download | gcc-67be156f952241ad99af1eedc4da91bc2e201cd3.zip gcc-67be156f952241ad99af1eedc4da91bc2e201cd3.tar.gz gcc-67be156f952241ad99af1eedc4da91bc2e201cd3.tar.bz2 |
[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.
Diffstat (limited to 'libstdc++-v3/include/std/complex')
-rw-r--r-- | libstdc++-v3/include/std/complex | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 415c735..be810b6 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -47,7 +47,7 @@ // Get rid of a macro possibly defined in <complex.h> #undef complex -#ifdef __clang__ +#ifdef _GLIBCXX_CLANG #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc99-extensions" #endif @@ -2646,7 +2646,7 @@ _GLIBCXX_END_NAMESPACE_VERSION #endif // C++11 -#ifdef __clang__ +#ifdef _GLIBCXX_CLANG #pragma clang diagnostic pop #endif |