Message ID | 20221004151200.1275636-1-ben.boeckel@kitware.com |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp175624wrs; Tue, 4 Oct 2022 08:14:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5KRYP+Z7xk3+aiku+uItWdZwXRDuYXXz33+VR21Ta/qZuoG6DX52soxkxBRQ4UfFAyxKBK X-Received: by 2002:a17:906:9bd6:b0:78c:a35d:bc59 with SMTP id de22-20020a1709069bd600b0078ca35dbc59mr5855212ejc.137.1664896447470; Tue, 04 Oct 2022 08:14:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664896447; cv=none; d=google.com; s=arc-20160816; b=hzPKswDhOXbxB8pMCHSHVxZNsI8t3ABqisWDtEyY5tkefS3fFR2NqYGMRFr/Uxegzl fHK2BJ7piMUqjcrWlTjOUES6YIV57nyyG1lxfWlvYlve/7gWL/P1TILhe/yW+MOFslxM wkSgd5mitJeqz8XuC/6egf1sx2Eat5LDcI8d9HqdHBT52epXhrQWxwWoL+7rbuz9wG3V HB41Xs1KhlP4uhBfJn9f3JDcf8Lfj0tixU8zx8kT7OoPgR/2PpELiZ+jVInEcY99Vxha RADWGhwIsSdunjZXsti13mlIj8hln8Z8yeGOSHZocrGeuV8vrs26ONSolIANoN+4wIwF 0NyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:feedback-id :dkim-signature:dkim-signature:dmarc-filter:delivered-to; bh=sr+ogrWIq1f4jwooN450XPMmkFvEXcW4rGcpOy++/9c=; b=LxuEsAutyhyDUX1hn0Et2tRWwiUAEug/dEPwk0VdfQ1AbEEaFYm+36nI2JdU/H7uv7 0FJXtJLBm8U/mAx06mQdslo5XT/H1JLk818Kbz2oKgewldu7yvVk48OFh4d+vIJqpbSy Bc+BZRLadHu1qNnFreoHGSl1G6kA01yVR0hka1awbFX0ghNlG3XJMWaoH2D8JtiCXnHt bszV4eJD21jEmpsx0xjPERgogP5t4SlpSmGxeI3Hpl/OvMahRSvXeBC7P2hT+fdblCzw ZeGPgYArq81Pji8gRpq51j3QirEFyzol9IOZZfu3fyl1/IJLsf8fMuqXLYlMSV1WsxwG va4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@benboeckel.net header.s=fm1 header.b=X2X4fwiC; dkim=fail header.i=@messagingengine.com header.s=fm2 header.b=1uf6A8hy; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g22-20020a056402321600b00458c1fb34e6si8499608eda.76.2022.10.04.08.14.07 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 08:14:07 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=fail header.i=@benboeckel.net header.s=fm1 header.b=X2X4fwiC; dkim=fail header.i=@messagingengine.com header.s=fm2 header.b=1uf6A8hy; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9ECAD384F01B for <ouuuleilei@gmail.com>; Tue, 4 Oct 2022 15:12:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by sourceware.org (Postfix) with ESMTPS id 2F109385E02C; Tue, 4 Oct 2022 15:11:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2F109385E02C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=benboeckel.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=benboeckel.net Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 7BFFD5C02BE; Tue, 4 Oct 2022 11:11:11 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 04 Oct 2022 11:11:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benboeckel.net; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm1; t=1664896271; x=1664982671; bh=sr+ogrWIq1 f4jwooN450XPMmkFvEXcW4rGcpOy++/9c=; b=X2X4fwiCQtE83HMDN+kw++M7JW wIAg1H0p2B1z/DX+RqnIDmc0GO+MSfNeaAJniz3NU79d6lWjie1fBLUg7mM/0Fzq DCHKttM4UoY1/vEn+VqB0+gdtvq35yfY79cuVJ9730WgGfPVtkxd7ciIpPABMMfk 7cGgoilAOqIyHg32c9qes2F5r6TQ6iQHM4X2hHZ9hRQbeRXTNKxLmVDDrd7BPV95 SMefNWu6uGX9a4eGkXBD3N8qRQhJWn9RPX2UNOzytnAQJlprwnWuE5URFy/tv6Dt Bft/i8cudfZUwQuO93aABwq7rS/rM8NE5Rl7+aeBTREesbEaZKSazEE1qJeQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1664896271; x=1664982671; bh=sr+ogrWIq1f4jwooN450XPMmkFvEXcW4rGc pOy++/9c=; b=1uf6A8hy1Dq95ieqrSsa+KOnJZXZFJZgpFyNSfbMCkROq3PbqmG zBqQdo2QHM9y+ykOVNSzcSvQE5ktPy9D5AbJOoOO6J6BPRsUyZTWjq32OcOk4DHK uIN/xG1f7Cyna6S8ABzyX/4Zlarkr8Zrpi9UHgSDZ9xn7f4MHpJWjR92Z0WSjsSz HN9Q815e91ZMGvucWiCqLnRKHgBd726TjZSD4dDJaRLfX1spo8L90yufr5DEQ77v /XKAsv6HkiweZRVsSLBGwz3UFvMba+LfK6mplzdd9tE2DV5WXbDLX5xmGUb62v2K oecTdUgmRAO54M90GZRs56IzGaZpLum+9Vg== X-ME-Sender: <xms:D008Y4dz5PckKSi8L-TqyReUxL8dB7Ywbnx336y-frGPFR8GKwcakQ> <xme:D008Y6OWeqY5Gc3eDTQrBJVPkrNTeHHb1E0nsf4p32XdXKAPoHZjNdXAcVr6zoC0l Fo9n5Ou9Mey9cJA1h8> X-ME-Received: <xmr:D008Y5jtLDUveOJkiyNRGbpwN0x-ZlCOiibd1AF2VImlWdLWJ_v-LjFJ-SgTkzUkoHP5h7hL29I5LmIxexl1XfJD-cEovvR5Ovb2> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeiuddgkeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffoggfgsedtkeertd ertddtnecuhfhrohhmpeeuvghnuceuohgvtghkvghluceomhgvsegsvghnsghovggtkhgv lhdrnhgvtheqnecuggftrfgrthhtvghrnhepheevtdfhfeevuefgtefhtddvjeevfeevhe ekfeetvefggeeuueekvdekteegteeknecuffhomhgrihhnpehishhotghpphdrohhrghdp lhhlvhhmrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepmhgvsegsvghnsghovggtkhgvlhdrnhgvth X-ME-Proxy: <xmx:D008Y98lmx5Wp65WvOeLoByUWNZVnVoUdVx2HGBlzsqxDvLP2vRnEg> <xmx:D008Y0s-7fPs7RJ3WaM6aUsurMS4504S4gXLdypFisvEfAxc5Y7FtQ> <xmx:D008Y0GEBfrm5Qhi2PkGQ8uky8s3Pv4PmYShZDW_dyWGbAXp2TXvOA> <xmx:D008Y-Xg1vS1YMQ2tuf3tmEdo7YDcG0ADDfLrgidCQW6wrY_JosAuQ> Feedback-ID: iffc1478b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 4 Oct 2022 11:11:11 -0400 (EDT) From: Ben Boeckel <me@benboeckel.net> To: gcc-patches@gcc.gnu.org Subject: [PATCH RESEND 0/1] RFC: P1689R5 support Date: Tue, 4 Oct 2022 11:11:59 -0400 Message-Id: <20221004151200.1275636-1-ben.boeckel@kitware.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Cc: gcc@gcc.gnu.org, brad.king@kitware.com, fortran@gcc.gnu.org, Ben Boeckel <ben.boeckel@kitware.com>, nathan@acm.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745770457300936580?= X-GMAIL-MSGID: =?utf-8?q?1745770457300936580?= |
Series |
RFC: P1689R5 support
|
|
Message
Ben Boeckel
Oct. 4, 2022, 3:11 p.m. UTC
This patch adds initial support for ISO C++'s [P1689R5][], a format for describing C++ module requirements and provisions based on the source code. This is required because compiling C++ with modules is not embarrassingly parallel and need to be ordered to ensure that `import some_module;` can be satisfied in time by making sure that the TU with `export import some_module;` is compiled first. [P1689R5]: https://isocpp.org/files/papers/P1689R5.html I'd like feedback on the approach taken here with respect to the user-visible flags. I'll also note that header units are not supported at this time because the current `-E` behavior with respect to `import <some_header>;` is to search for an appropriate `.gcm` file which is not something such a "scan" can support. A new mode will likely need to be created (e.g., replacing `-E` with `-fc++-module-scanning` or something) where headers are looked up "normally" and processed only as much as scanning requires. Testing is currently happening in CMake's CI using a prior revision of this patch (the differences are basically the changelog, some style, and `trtbd` instead of `p1689r5` as the format name). For testing within GCC, I'll work on the following: - scanning non-module source - scanning module-importing source (`import X;`) - scanning module-exporting source (`export module X;`) - scanning module implementation unit (`module X;`) - flag combinations? Are there existing tools for handling JSON output for testing purposes? Basically, something that I can add to the test suite that doesn't care about whitespace, but checks the structure (with sensible replacements for absolute paths where relevant)? For the record, Clang has patches with similar flags and behavior by Chuanqi Xu here: https://reviews.llvm.org/D134269 with the same flags (though using my old `trtbd` spelling for the format name). Thanks, --Ben Ben Boeckel (1): p1689r5: initial support gcc/ChangeLog | 9 ++ gcc/c-family/ChangeLog | 6 + gcc/c-family/c-opts.cc | 40 ++++++- gcc/c-family/c.opt | 12 ++ gcc/cp/ChangeLog | 5 + gcc/cp/module.cc | 3 +- gcc/doc/invoke.texi | 15 +++ gcc/fortran/ChangeLog | 5 + gcc/fortran/cpp.cc | 4 +- gcc/genmatch.cc | 2 +- gcc/input.cc | 4 +- libcpp/ChangeLog | 11 ++ libcpp/include/cpplib.h | 12 +- libcpp/include/mkdeps.h | 17 ++- libcpp/init.cc | 14 ++- libcpp/mkdeps.cc | 235 ++++++++++++++++++++++++++++++++++++++-- 16 files changed, 368 insertions(+), 26 deletions(-) base-commit: d812e8cb2a920fd75768e16ca8ded59ad93c172f
Comments
On 10/4/22 11:11, Ben Boeckel wrote: > This patch adds initial support for ISO C++'s [P1689R5][], a format for > describing C++ module requirements and provisions based on the source > code. This is required because compiling C++ with modules is not > embarrassingly parallel and need to be ordered to ensure that `import > some_module;` can be satisfied in time by making sure that the TU with > `export import some_module;` is compiled first. > > [P1689R5]: https://isocpp.org/files/papers/P1689R5.html > > I'd like feedback on the approach taken here with respect to the > user-visible flags. I'll also note that header units are not supported > at this time because the current `-E` behavior with respect to `import > <some_header>;` is to search for an appropriate `.gcm` file which is not > something such a "scan" can support. A new mode will likely need to be > created (e.g., replacing `-E` with `-fc++-module-scanning` or something) > where headers are looked up "normally" and processed only as much as > scanning requires. > > Testing is currently happening in CMake's CI using a prior revision of > this patch (the differences are basically the changelog, some style, and > `trtbd` instead of `p1689r5` as the format name). > > For testing within GCC, I'll work on the following: > > - scanning non-module source > - scanning module-importing source (`import X;`) > - scanning module-exporting source (`export module X;`) > - scanning module implementation unit (`module X;`) > - flag combinations? > > Are there existing tools for handling JSON output for testing purposes? David Malcolm would probably know best about JSON wrangling. > Basically, something that I can add to the test suite that doesn't care > about whitespace, but checks the structure (with sensible replacements > for absolute paths where relevant)? Various tests in g++.dg/debug/dwarf2 handle that sort of thing with regexps. > For the record, Clang has patches with similar flags and behavior by > Chuanqi Xu here: > > https://reviews.llvm.org/D134269 > > with the same flags (though using my old `trtbd` spelling for the > format name). > > Thanks, > > --Ben > > Ben Boeckel (1): > p1689r5: initial support > > gcc/ChangeLog | 9 ++ > gcc/c-family/ChangeLog | 6 + > gcc/c-family/c-opts.cc | 40 ++++++- > gcc/c-family/c.opt | 12 ++ > gcc/cp/ChangeLog | 5 + > gcc/cp/module.cc | 3 +- > gcc/doc/invoke.texi | 15 +++ > gcc/fortran/ChangeLog | 5 + > gcc/fortran/cpp.cc | 4 +- > gcc/genmatch.cc | 2 +- > gcc/input.cc | 4 +- > libcpp/ChangeLog | 11 ++ > libcpp/include/cpplib.h | 12 +- > libcpp/include/mkdeps.h | 17 ++- > libcpp/init.cc | 14 ++- > libcpp/mkdeps.cc | 235 ++++++++++++++++++++++++++++++++++++++-- > 16 files changed, 368 insertions(+), 26 deletions(-) > > > base-commit: d812e8cb2a920fd75768e16ca8ded59ad93c172f
On Mon, 2022-10-10 at 16:21 -0400, Jason Merrill wrote: > On 10/4/22 11:11, Ben Boeckel wrote: > > This patch adds initial support for ISO C++'s [P1689R5][], a format > > for > > describing C++ module requirements and provisions based on the > > source > > code. This is required because compiling C++ with modules is not > > embarrassingly parallel and need to be ordered to ensure that > > `import > > some_module;` can be satisfied in time by making sure that the TU > > with > > `export import some_module;` is compiled first. > > > > [P1689R5]: https://isocpp.org/files/papers/P1689R5.html > > > > I'd like feedback on the approach taken here with respect to the > > user-visible flags. I'll also note that header units are not > > supported > > at this time because the current `-E` behavior with respect to > > `import > > <some_header>;` is to search for an appropriate `.gcm` file which > > is not > > something such a "scan" can support. A new mode will likely need to > > be > > created (e.g., replacing `-E` with `-fc++-module-scanning` or > > something) > > where headers are looked up "normally" and processed only as much > > as > > scanning requires. > > > > Testing is currently happening in CMake's CI using a prior revision > > of > > this patch (the differences are basically the changelog, some > > style, and > > `trtbd` instead of `p1689r5` as the format name). > > > > For testing within GCC, I'll work on the following: > > > > - scanning non-module source > > - scanning module-importing source (`import X;`) > > - scanning module-exporting source (`export module X;`) > > - scanning module implementation unit (`module X;`) > > - flag combinations? > > > > Are there existing tools for handling JSON output for testing > > purposes? > > David Malcolm would probably know best about JSON wrangling. Unfortunately our JSON output doesn't make any guarantees about the ordering of keys within an object, so the precise textual output changes from run to run. I've coped with that in my test cases by limiting myself to simple regexes of fragments of the JSON output. Martin Liska [CCed] went much further in 4e275dccfc2467b3fe39012a3dd2a80bac257dd0 by adding a run-gcov-pytest DejaGnu directive, allowing for test cases for gcov to be written in Python, which can thus test much more interesting assertions about the generated JSON. Dave > > > Basically, something that I can add to the test suite that doesn't > > care > > about whitespace, but checks the structure (with sensible > > replacements > > for absolute paths where relevant)? > > Various tests in g++.dg/debug/dwarf2 handle that sort of thing with > regexps. > > > For the record, Clang has patches with similar flags and behavior > > by > > Chuanqi Xu here: > > > > https://reviews.llvm.org/D134269 > > > > with the same flags (though using my old `trtbd` spelling for the > > format name). > > > > Thanks, > > > > --Ben > > > > Ben Boeckel (1): > > p1689r5: initial support > > > > gcc/ChangeLog | 9 ++ > > gcc/c-family/ChangeLog | 6 + > > gcc/c-family/c-opts.cc | 40 ++++++- > > gcc/c-family/c.opt | 12 ++ > > gcc/cp/ChangeLog | 5 + > > gcc/cp/module.cc | 3 +- > > gcc/doc/invoke.texi | 15 +++ > > gcc/fortran/ChangeLog | 5 + > > gcc/fortran/cpp.cc | 4 +- > > gcc/genmatch.cc | 2 +- > > gcc/input.cc | 4 +- > > libcpp/ChangeLog | 11 ++ > > libcpp/include/cpplib.h | 12 +- > > libcpp/include/mkdeps.h | 17 ++- > > libcpp/init.cc | 14 ++- > > libcpp/mkdeps.cc | 235 > > ++++++++++++++++++++++++++++++++++++++-- > > 16 files changed, 368 insertions(+), 26 deletions(-) > > > > > > base-commit: d812e8cb2a920fd75768e16ca8ded59ad93c172f >
On Thu, Oct 13, 2022 at 13:08:46 -0400, David Malcolm wrote: > On Mon, 2022-10-10 at 16:21 -0400, Jason Merrill wrote: > > David Malcolm would probably know best about JSON wrangling. > > Unfortunately our JSON output doesn't make any guarantees about the > ordering of keys within an object, so the precise textual output > changes from run to run. I've coped with that in my test cases by > limiting myself to simple regexes of fragments of the JSON output. > > Martin Liska [CCed] went much further in > 4e275dccfc2467b3fe39012a3dd2a80bac257dd0 by adding a run-gcov-pytest > DejaGnu directive, allowing for test cases for gcov to be written in > Python, which can thus test much more interesting assertions about the > generated JSON. Ok, if Python is acceptable, I'll use its stdlib to do "fancy" things. Part of this is because I want to assert that unnecessary fields don't exist and that sounds…unlikely to be possible in any maintainable way (assuming it is possible) with regexen. `jq` could help immensely, but that is probably a bridge too far :) . Thanks, --Ben
On 10/18/22 14:22, Ben Boeckel wrote: > On Thu, Oct 13, 2022 at 13:08:46 -0400, David Malcolm wrote: >> On Mon, 2022-10-10 at 16:21 -0400, Jason Merrill wrote: >>> David Malcolm would probably know best about JSON wrangling. >> >> Unfortunately our JSON output doesn't make any guarantees about the >> ordering of keys within an object, so the precise textual output >> changes from run to run. I've coped with that in my test cases by >> limiting myself to simple regexes of fragments of the JSON output. >> >> Martin Liska [CCed] went much further in >> 4e275dccfc2467b3fe39012a3dd2a80bac257dd0 by adding a run-gcov-pytest >> DejaGnu directive, allowing for test cases for gcov to be written in >> Python, which can thus test much more interesting assertions about the >> generated JSON. > > Ok, if Python is acceptable, I'll use its stdlib to do "fancy" things. > Part of this is because I want to assert that unnecessary fields don't > exist and that sounds…unlikely to be possible in any maintainable way > (assuming it is possible) with regexen. `jq` could help immensely, but > that is probably a bridge too far :) . Yes, please use Python if you have a more complicated output verification. Examples I introduced: ./gcc/testsuite/g++.dg/gcov/test-pr98273.py ./gcc/testsuite/g++.dg/gcov/test-gcov-17.py Martin > > Thanks, > > --Ben