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 CA3E83890841; Thu, 15 Dec 2022 15:03:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CA3E83890841 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.96,247,1665475200"; d="scan'208";a="93051833" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 15 Dec 2022 07:01:41 -0800 IronPort-SDR: Wg6WvOxWNj/FHSxnUzSyT2B1fV8EyIu3qd2XoaOXqDHnczqmSnFB+m2tWFOewtZ44GP8V0cFBM erDqY2hsx6od4Qe9UzBmBKjhgmq8Gx+RzEirjY0TpsZTi4wLhp37Sq2444O+dSq/nlf45nsB2Z G0BgOk/FPsPIPDHiua2gARWSBnyRKvIEsncd0mh0utt/nHL3jQnHTRucsve9j4p2L9aweuqJdH nERzUah4MOj37ZlLRWqfzNVnv+bcCMQo2/IjPPq2+RNz4pV/VBIadABdle+Qod7Mn28WYfTyHf OUc= From: Thomas Schwinge To: Jakub Jelinek , Iain Buclaw CC: Arthur Cohen , , , , Richard Biener Subject: Re: Make '-frust-incomplete-and-experimental-compiler-do-not-use' a 'Common' option (was: Rust front-end patches v4) In-Reply-To: References: <20221206101417.778807-1-arthur.cohen@embecosm.com> <9d59ae0f-048f-dc32-6309-c8134467bbb7@embecosm.com> <87pmcla8yz.fsf@euler.schwinge.homeip.net> <87len97z4d.fsf@dem-tschwing-1.ger.mentorg.com> <1671103907.a1qdw95wgj.astroid@pulse.none> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Thu, 15 Dec 2022 16:01:33 +0100 Message-ID: <87mt7o90du.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-09.mgc.mentorg.com (139.181.222.9) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-5.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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! On 2022-12-15T12:50:44+0100, Jakub Jelinek via Gcc-patches wrote: > On Thu, Dec 15, 2022 at 12:39:38PM +0100, Iain Buclaw wrote: >> For the gdc testsuite, those warnings arise because both language files >> are compiled in the same invocation (dg-additional-sources "cpp11.cpp"), >> so it ends up looking something like: >> >> gdc -fextern-std=3Dc++11 testcpp11.d cpp11.cpp -o testcpp11.exe ..., and this is a compilation mode that GCC generally intends to support, right? For example, also in use with Fortran, to bring in C code. >From that it follows that it's either the duty of all drivers ('gcc', 'g++', 'gdc', 'gfortran', 'grust', etc.) to appropriately handle such options (like, "Make '-frust-incomplete-and-experimental-compiler-do-not-use' a 'Common' o= ption" that I proposed), or indeed: > Maybe it would be nice to be able to pass options only to a certain > gcc backend binary and not to others, similarly to how > -Wa,option passes options to assembler, -Wp,option to preprocessor and > -Wl,option to linker. > -Wc,language,option ? > Then one could > gdc -Wc,d,-fextern-std=3Dc++11 testcpp11.d cpp11.cpp -o testcpp11.exe > or > gccrs -Wc,rust,-frust-incomplete-and-experimental-compiler-do-not-use w= hatever.rs something.c -o whatever > etc. > If we do, one would need to use it with care, because then e.g. for > gcc -Wc,c,-fsanitize=3Daddress > the driver wouldn't know it should link in -lasan etc. Hmm. :-) On the one hand, I like it (or some similar syntax), on the other hand, isn't this a bit over-engineered? (..., and then also "under-engineered": which front end(s) does "-Wp,option to preprocessor", then apply to, for example; all of them, and we ought to add a mechanism to have separate such options for different front ends...) One step back: Typically, per my understanding, GCC options are intended to convey similar semantics, when they apply to more than one front end. For example, '-Wunused' means similar things in C, C++, Fortran, Rust compilation. Or, options are applicable to just one front end, and can just be a no-op for others, for shared-language compilation. For example, '-nostdinc++', or '-frust-incomplete-and-experimental-compiler-do-not-use' need not necessarily emit a diagnostic, but can just just be ignored by 'cc1', 'f951', 'lto1'. For others, a diagnostic may be considered appropriate. For example, as we already have: cc1: warning: command-line option '-std=3Dc++11' is valid for C++/ObjC+= + but not for C But, you could also argue that the 'c++' in '-std=3Dc++11' imples that it's targeted at the 'b.cc' C++ compilation part of 'g++ -std=3Dc++11 a.c b.cc', and 'a.c' is compiled with default C '-std=3D[...]'; and you might in fact have: 'g++ -std=3Dc89 -std=3Dc++11 a.c b.cc', huh... If we go for extending the syntax, should we do something similar to '-foffload-options', where might have syntax similar to: -ffront-end-options=3D-ffoo\ -fbar -ffront-end-options=3Dc,c++=3D-fsign= ed-char\ -fshort-enums -ffront-end-options=3Dd,rust=3D[...] That is, in contrast to your proposed '-Wc,[...]', this allows for specifying the same options for multiple front ends in one go. Is that useful? Anyway: how to get us un-stuck here -- maybe pragmatically? :-) Gr=C3=BC=C3=9Fe Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955