From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 26BA8383E826 for ; Wed, 16 Dec 2020 13:27:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 26BA8383E826 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-318-WXwE58WXOtugA5vaWk8XjA-1; Wed, 16 Dec 2020 08:27:50 -0500 X-MC-Unique: WXwE58WXOtugA5vaWk8XjA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E94AE800D62; Wed, 16 Dec 2020 13:27:49 +0000 (UTC) Received: from localhost (unknown [10.33.36.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 862B271D55; Wed, 16 Dec 2020 13:27:49 +0000 (UTC) Date: Wed, 16 Dec 2020 13:27:48 +0000 From: Jonathan Wakely To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org Subject: [PATCH] doc: Document that libstdc++ uses __STRICT_ANSI__ Message-ID: <20201216132748.GA1027090@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="BXVAT5kNtrzKuDFl" Content-Disposition: inline X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2020 13:27:56 -0000 --BXVAT5kNtrzKuDFl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 #undef __STRICT_ANSI__ #include 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. --BXVAT5kNtrzKuDFl Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit c516abe37ef82444e125b32933ea44a00a99d1ec Author: Jonathan Wakely 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 --BXVAT5kNtrzKuDFl--