From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B47533858CD1; Wed, 22 May 2024 20:27:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B47533858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716409657; bh=YmuLk1hIoaMrkmMAIXBPuuV6MK5+mpzf2Di7G3x86Yk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cHeYtuaHjHazgE+xQsMWZAFu2vR0AdML4TULKJ8GlCuz8WDTZzm2j6k6m5eg+rLzS wlil0d+SsX23Ne9FtIRDeWCAecbZ/wBVEnbdHg4NJEA0PVzdmUodk1PiehSSLOUuGH NlrDuuCqekGBoMkBQxw7eKJEEEEoCNwuF7YuvoXU= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/57025] Solaris g++ defines __STDC_VERSION__=199901L Date: Wed, 22 May 2024 20:27:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.7.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D57025 --- Comment #13 from Jonathan Wakely --- (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**. Th= ere 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 works in C++ anyway: https://wg21.link/P0943R6=