https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57025

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Alan Coopersmith from comment #11)
> While Solaris 11.3 support has been dropped from gcc now, Jonathan Perkins
> from pkgsrc found that just removing the definition of __STDC_VERSION__
> didn't work with some of the illumos headers:
> https://github.com/jperkin/notes/blob/main/gcc-cpp-stdc/README.md

So the illumos sys/feature_tests.h is using __STD_VERSION__ to mean "the
version of the C library to expose for the current language mode", whether that
language mode is a C language mode or a C++ one. And that's an entirely
reasonable use of it IMHO, and conforms to the C++ standard.

I stick by what I said in comment 4: code which assumes that __STDC_VERSION__
being defined implies a C compiler is being used is **broken C++ code**. There
is no compliance requirement why GCC should stop defining __STDC_VERSION__, and
there's a good reason to keep defining it if defining it is needed (or just
helpful) for a target's libc headers.

The Cython code quoted in the illumos notes should be fixed to check the
__cplusplus condition first, then if __cplusplus is not defined check
__STDC_VERSION__. It's just bad code.

N.B. since C++23 #include <stdatomic.h> works in C++ anyway:
https://wg21.link/P0943R6

Reply via email to