From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id CF4B2385840B for ; Tue, 5 Oct 2021 17:23:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CF4B2385840B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: fnMoU9BPPPZMh1ctqoJvMAe1+ukb+PfIFHbHoOpAJbPUuhsTOhnmfnrPuPa3v9EIqvGeobL37P sx9CE/NPzqVWo550VJSfc5BnHCMe3fTxDUDanJoVoxnz4bA28T74Ys6QfQlRGF9ZwYfA6ldsL5 /JzHexXRGtE18QdDvvd699FOkvZpEpn8pZIoaOhS3QWuc2oIlnWmMiSu0Ik0y8ZZLt/e0Gk5dp n5dylYJc9rIUE2vHpUXoaNo0y1PYbBDLItYOSxVQpP3ODuqcvxvyppEU9nU6nfepLxVZ2OQa6i 6umBxIBuSPKtrsQDa6ArwxVv X-IronPort-AV: E=Sophos;i="5.85,349,1624348800"; d="scan'208";a="69251427" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 05 Oct 2021 09:23:32 -0800 IronPort-SDR: u8phTQVu5f2EpBv5FSyjIw2BliB0KAlLC2jJHhr/iZ+ymsFXHrsMcMnsUiLYI0eJcSZYvWTAtN rwoi1o/XZqbgC/VLk6gcggw7UE8kq8nCq1I8S9QNOOzlASIU6ANfUx/rHfaftOWh7Kiek3m7BR eksICtdrdTD45eaR85p1LAcZefGyzgUL9/SYKVc+QbSO7jVFK1JYJBJW9SGg8fnLpA0OOkiZ6f m8Os5xuM1M/EsQcdEpNsG/nVZIgf8t/L5G+SwxWKuiuv5Ph5jlZnLyO9CiL2cELhbfMZ5S7HEI oWY= Date: Tue, 5 Oct 2021 17:23:26 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Jakub Jelinek CC: Jason Merrill , Marek Polacek , Subject: Re: [PATCH] c++: Implement C++23 P2334R1 - #elifdef/#elifndef In-Reply-To: <20211005083512.GT304296@tucnak> Message-ID: References: <20211005083512.GT304296@tucnak> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3117.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2021 17:23:35 -0000 On Tue, 5 Oct 2021, Jakub Jelinek via Gcc-patches wrote: > One is in the patch below, ignores that sentence and only implements it > for -std=c++23/-std=gnu++23 like it is only implemented for -std=c23. > Another option would be to implement it also in the older GNU modes but > not in the C/CXX modes (but it would be strange if we did that just for > C++ and not for C). > Yet another option is to enable it unconditionally. > And yet another option would be to enable it unconditionally but emit > a warning (or pedwarn) when it is seen. > Note, when it is enabled for the older language modes, as Joseph wrote > in the c11-elifdef-1.c testcase, it can result e.g. in rejecting previously > valid code: It would probably be reasonable to enable it in older GNU modes for C as well as C++ if desired (and, in that case, emit a pedwarn-if-pedantic when it's acted on) - cases where it affects compatibility should be rare. Enabling with a pedwarn in strict modes is problematic because it changes semantics of valid code where it was inside #if 0, however. It doesn't make sense at all to me to think of a new feature like this (one with no prior art in C mentioned in the WG14 proposal) as a defect fix. Any normal directive - i.e. one that has no effect on the preprocessor #if structure and so is ignored inside #if 0 for all language versions - can more reasonably be enabled for all language versions with a pedwarn when used for old versions. (In particular, that will be appropriate for #warning, where the "don't pedwarn in C2X modes" part needs implementing after N2686 was accepted at the August / September WG14 meeting - I don't know if C++ is doing anything with #warning.) -- Joseph S. Myers joseph@codesourcery.com