* [PATCH] doc: Document that libstdc++ uses __STRICT_ANSI__
@ 2020-12-16 13:27 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2020-12-16 13:27 UTC (permalink / raw)
To: gcc-patches; +Cc: libstdc++
[-- Attachment #1: Type: text/plain, Size: 913 bytes --]
Libstdc++ has been using __STRICT_ANSI__ for years, e.g. to decide
whether or not std::is_integral<__int128> should be true.
gcc/ChangeLog:
* doc/cpp.texi (Common Predefined Macros): Mention that
__STRICT_ANSI__ is used by libstdc++ too.
OK for trunk?
I'd also like to tell users they're not allowed to undefine the
macro, would that be acceptable, or is that supposed to work?
I don't see how it's possible to make it work with libstdc++ if users
do stupid things like:
#include <type_traits>
#undef __STRICT_ANSI__
#include <iterator>
This causes the library to be in an inconsistent (broken) state,
because some templates are defined according to strict ISO C++ rules
and then other templates are not, but assume the earlier definitions
are consistent.
We frequently see users doing -std=c++11 -U__STRICT_ANSI__ which makes
me smash my head on the table. Just use -std=gnu++11 and stop being
dumb.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1228 bytes --]
commit c516abe37ef82444e125b32933ea44a00a99d1ec
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Dec 16 13:21:24 2020
doc: Document that libstdc++ uses __STRICT_ANSI__
Libstdc++ has been using __STRICT_ANSI__ for years, e.g. to decide
whether or not std::is_integral<__int128> should be true.
gcc/ChangeLog:
* doc/cpp.texi (Common Predefined Macros): Mention that
__STRICT_ANSI__ is used by libstdc++ too.
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index 5dcd67259e3..c5cdd5cb069 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -1996,8 +1996,8 @@ testing @code{@w{(__GNUC__ && __cplusplus)}}.
GCC defines this macro if and only if the @option{-ansi} switch, or a
@option{-std} switch specifying strict conformance to some version of ISO C
or ISO C++, was specified when GCC was invoked. It is defined to @samp{1}.
-This macro exists primarily to direct GNU libc's header files to use only
-definitions found in standard C.
+This macro exists primarily to direct libstdc++ and GNU libc's header files
+to use only definitions found in standard C and C++.
@item __BASE_FILE__
This macro expands to the name of the main input file, in the form
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-16 13:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16 13:27 [PATCH] doc: Document that libstdc++ uses __STRICT_ANSI__ Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).