From patchwork Tue Oct 4 15:11:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Boeckel X-Patchwork-Id: 42 Return-Path: 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 (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 ; 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: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeiuddgkeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffoggfgsedtkeertd ertddtnecuhfhrohhmpeeuvghnuceuohgvtghkvghluceomhgvsegsvghnsghovggtkhgv lhdrnhgvtheqnecuggftrfgrthhtvghrnhepheevtdfhfeevuefgtefhtddvjeevfeevhe ekfeetvefggeeuueekvdekteegteeknecuffhomhgrihhnpehishhotghpphdrohhrghdp lhhlvhhmrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepmhgvsegsvghnsghovggtkhgvlhdrnhgvth X-ME-Proxy: Feedback-ID: iffc1478b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 4 Oct 2022 11:11:11 -0400 (EDT) From: Ben Boeckel 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gcc@gcc.gnu.org, brad.king@kitware.com, fortran@gcc.gnu.org, Ben Boeckel , nathan@acm.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745770457300936580?= X-GMAIL-MSGID: =?utf-8?q?1745770457300936580?= 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 ;` 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