Message ID | 20230125210636.2960049-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:adf:eb09:0:0:0:0:0 with SMTP id s9csp486586wrn; Wed, 25 Jan 2023 13:09:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXuyG1P8UWY3GrSKH3Br2i+ro4PZ+wxomXtQFd1y2JTFQwBhAT6mImE9rXcVChTmkbPr6LSJ X-Received: by 2002:a05:6402:1f05:b0:49e:16fc:b525 with SMTP id b5-20020a0564021f0500b0049e16fcb525mr35932768edb.41.1674680977004; Wed, 25 Jan 2023 13:09:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674680976; cv=none; d=google.com; s=arc-20160816; b=ltvKcUYX6iMDnl6DqQ+Yq4fNdT0nPMBXmzcZ8TPnlDrAZCqQBoq/uaQYxbl4vGXDXi 8hUhz1+JQeIPdDFgpE1LpKVjxGwiu21M1SNGWTQg7gnqQaJQQw0w2GC7iJZmggW47qGC jCMFY0aewyGeqAOBrvaFJSPu24ZtbDfmjWCjnhp8nOHseak3SoZnFIPUDsknRxAgXzcI UMATpOm8trVRx0vIh2uavZ0GY+SuptpGtO/L5sLVnAjBtRNVqm3/mVHAoGhrio/Yotef cA8xGDx73UB6RQHwV+LbYemywA5drSZLVF4B7j10bRPE4/M+pBHH8nTzHpxXXzqRgA6C TSbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=whKQAP51RAQ5Emt4eQkbBbKxfaefs9wMtccP9HZHUo0=; b=TvyMjyow4+ckXwAuKt3s9Wv2SrENdNXwhr9n5o70eSLAy+aFtKnFdpbEdCymNXI6V4 /nKrBT/Sv82yfEcPzUMu4TqDBGET4wU/I+KfOyluI2WZvITW2ixn5S3DjZxWJ5hG32gx P1moIjhrLaniM2jMfIH3tuvTSEh8iveMwwHbnokbdDfpv4J7VUjeC6Y0JL7by84QXF6I PY+O0G9Xl1Uoat1+aoI4vxnKtvlqKHN1efK0lEI/Bpgo6k+yznZSE3/zlB9QV+0oR9hG ZoF1H+bzdb9rAOiK3OC1JA/VdevAaJmoVeMULtDy47cnnWBp/Tw5wVVVT+Bw2gjhRup4 N3+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=OeuQ12jG; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g14-20020a056402428e00b004a08d34f51dsi6015891edc.263.2023.01.25.13.09.36 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 13:09:36 -0800 (PST) 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=pass header.i=@gcc.gnu.org header.s=default header.b=OeuQ12jG; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 991543888C4A for <ouuuleilei@gmail.com>; Wed, 25 Jan 2023 21:07:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 991543888C4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674680865; bh=whKQAP51RAQ5Emt4eQkbBbKxfaefs9wMtccP9HZHUo0=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=OeuQ12jGl2zEBu3p+fLDwUXYhrP+cO8d03D5UxBxUyipnh/BwDOMdZSP8c98Kyhcu 02ZUFjOMeObjzaQo9ZeAl4u072S9WLyvdO5B+JZG2oE16219JPLx5pc+5un9EKrdIN MZt3DO5Gk0+YXYHL9u18gDhr8OA51FcXocQkBFZs= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by sourceware.org (Postfix) with ESMTPS id CDE2F3858D28 for <gcc-patches@gcc.gnu.org>; Wed, 25 Jan 2023 21:06:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CDE2F3858D28 Received: by mail-qv1-xf2f.google.com with SMTP id s4so2776320qvo.3 for <gcc-patches@gcc.gnu.org>; Wed, 25 Jan 2023 13:06:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=whKQAP51RAQ5Emt4eQkbBbKxfaefs9wMtccP9HZHUo0=; b=16xW7QGobcx6KrJvB3+xX2cUeN1P9sV7lduXmrHFM7OixGbs/8cc4q2wm7M3zojKxC Pno/DavAdNwYBV62aNxm8OAWy5is8kiW0BPtiMtFvGjWGSgVxyQpM3+OvocVcRp3y1hc Yq+ijdLQnnfrkYsd1Bxx/c3OPdEWJ/EsaSZDYVcbnrCRPmeW1Hk8xagdxF5yQDmA1vJB vwZ3zwC5o/ItA3qxjBFI2YQAFNB8xeFBXyYwHB/KAdw38v1wlwVd3belhK50COcgA5pC vZvjP1nis6seGhOaJa+n/dVpfQHZ9TWVMrP8prNdDdzKsBujtXruTuHFXI60dHsVMcun ++BA== X-Gm-Message-State: AFqh2kr5R1Kf+M6EBSSCahhiSXqnwdgszkrVlIEFd3Z3f9ZhQnpmzdn+ A7LqaXKNc54zQAzyLSmYjplWSaoiwFpXaeOKm6k= X-Received: by 2002:a05:6214:57d1:b0:532:1f17:2ce7 with SMTP id lw17-20020a05621457d100b005321f172ce7mr52108170qvb.16.1674680812229; Wed, 25 Jan 2023 13:06:52 -0800 (PST) Received: from localhost (cpe-142-105-146-128.nycap.res.rr.com. [142.105.146.128]) by smtp.gmail.com with ESMTPSA id g22-20020a37e216000000b006fa8299b4d5sm4153273qki.100.2023.01.25.13.06.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 13:06:51 -0800 (PST) To: gcc-patches@gcc.gnu.org Cc: Ben Boeckel <ben.boeckel@kitware.com>, jason@redhat.com, nathan@acm.org, fortran@gcc.gnu.org, gcc@gcc.gnu.org, brad.king@kitware.com Subject: [PATCH v5 0/5] P1689R5 support Date: Wed, 25 Jan 2023 16:06:31 -0500 Message-Id: <20230125210636.2960049-1-ben.boeckel@kitware.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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> From: Ben Boeckel via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Ben Boeckel <ben.boeckel@kitware.com> 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?1756030280167561097?= X-GMAIL-MSGID: =?utf-8?q?1756030280167561097?= |
Series | P1689R5 support | |
Message
Ben Boeckel
Jan. 25, 2023, 9:06 p.m. UTC
Hi, This patch series 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 any TU with `export import some_module;` is compiled first. [P1689R5]: https://isocpp.org/files/papers/P1689R5.html I've also added patches to include imported module CMI files and the module mapper file as dependencies of the compilation. I briefly looked into adding dependencies on response files as well, but that appeared to need some code contortions to have a `class mkdeps` available before parsing the command line or to keep the information around until one was made. 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. FWIW, Clang as taken an alternate approach with its `clang-scan-deps` tool rather than using the compiler directly. Thanks, --Ben --- v4 -> v5: - add dependency tracking for imported modules to `-MF` - add dependency tracking for static module mapper files given to `-fmodule-mapper=` v3 -> v4: - add missing spaces between function names and arguments v2 -> v3: - changelog entries moved to commit messages - documentation updated/added in the UTF-8 routine editing v1 -> v2: - removal of the `deps_write(extra)` parameter to option-checking where ndeeded - default parameter of `cpp_finish(fdeps_stream = NULL)` - unification of libcpp UTF-8 validity functions from v1 - test cases for flag parsing states (depflags-*) and p1689 output (p1689-*) Ben Boeckel (5): libcpp: reject codepoints above 0x10FFFF libcpp: add a function to determine UTF-8 validity of a C string p1689r5: initial support c++modules: report imported CMI files as dependencies c++modules: report module mapper files as a dependency gcc/c-family/c-opts.cc | 40 +++- gcc/c-family/c.opt | 12 + gcc/cp/mapper-client.cc | 4 + gcc/cp/mapper-client.h | 1 + gcc/cp/module.cc | 23 +- gcc/doc/invoke.texi | 15 ++ gcc/testsuite/g++.dg/modules/depflags-f-MD.C | 2 + gcc/testsuite/g++.dg/modules/depflags-f.C | 1 + gcc/testsuite/g++.dg/modules/depflags-fi.C | 3 + gcc/testsuite/g++.dg/modules/depflags-fj-MD.C | 3 + gcc/testsuite/g++.dg/modules/depflags-fj.C | 4 + .../g++.dg/modules/depflags-fjo-MD.C | 4 + gcc/testsuite/g++.dg/modules/depflags-fjo.C | 5 + gcc/testsuite/g++.dg/modules/depflags-fo-MD.C | 3 + gcc/testsuite/g++.dg/modules/depflags-fo.C | 4 + gcc/testsuite/g++.dg/modules/depflags-j-MD.C | 2 + gcc/testsuite/g++.dg/modules/depflags-j.C | 3 + gcc/testsuite/g++.dg/modules/depflags-jo-MD.C | 3 + gcc/testsuite/g++.dg/modules/depflags-jo.C | 4 + gcc/testsuite/g++.dg/modules/depflags-o-MD.C | 2 + gcc/testsuite/g++.dg/modules/depflags-o.C | 3 + gcc/testsuite/g++.dg/modules/modules.exp | 1 + gcc/testsuite/g++.dg/modules/p1689-1.C | 18 ++ gcc/testsuite/g++.dg/modules/p1689-1.exp.json | 27 +++ gcc/testsuite/g++.dg/modules/p1689-2.C | 16 ++ gcc/testsuite/g++.dg/modules/p1689-2.exp.json | 16 ++ gcc/testsuite/g++.dg/modules/p1689-3.C | 14 ++ gcc/testsuite/g++.dg/modules/p1689-3.exp.json | 16 ++ gcc/testsuite/g++.dg/modules/p1689-4.C | 14 ++ gcc/testsuite/g++.dg/modules/p1689-4.exp.json | 14 ++ gcc/testsuite/g++.dg/modules/p1689-5.C | 14 ++ gcc/testsuite/g++.dg/modules/p1689-5.exp.json | 14 ++ gcc/testsuite/g++.dg/modules/test-p1689.py | 222 ++++++++++++++++++ gcc/testsuite/lib/modules.exp | 71 ++++++ libcpp/charset.cc | 28 ++- libcpp/include/cpplib.h | 12 +- libcpp/include/mkdeps.h | 17 +- libcpp/init.cc | 13 +- libcpp/internal.h | 2 + libcpp/mkdeps.cc | 149 +++++++++++- 40 files changed, 789 insertions(+), 30 deletions(-) create mode 100644 gcc/testsuite/g++.dg/modules/depflags-f-MD.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-f.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fi.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fj-MD.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fj.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fjo-MD.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fjo.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fo-MD.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fo.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-j-MD.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-j.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-jo-MD.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-jo.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-o-MD.C create mode 100644 gcc/testsuite/g++.dg/modules/depflags-o.C create mode 100644 gcc/testsuite/g++.dg/modules/p1689-1.C create mode 100644 gcc/testsuite/g++.dg/modules/p1689-1.exp.json create mode 100644 gcc/testsuite/g++.dg/modules/p1689-2.C create mode 100644 gcc/testsuite/g++.dg/modules/p1689-2.exp.json create mode 100644 gcc/testsuite/g++.dg/modules/p1689-3.C create mode 100644 gcc/testsuite/g++.dg/modules/p1689-3.exp.json create mode 100644 gcc/testsuite/g++.dg/modules/p1689-4.C create mode 100644 gcc/testsuite/g++.dg/modules/p1689-4.exp.json create mode 100644 gcc/testsuite/g++.dg/modules/p1689-5.C create mode 100644 gcc/testsuite/g++.dg/modules/p1689-5.exp.json create mode 100644 gcc/testsuite/g++.dg/modules/test-p1689.py create mode 100644 gcc/testsuite/lib/modules.exp base-commit: 9d4c00cdaccc3decd07740e817387ce844ef3ac9
Comments
On Wed, Jan 25, 2023 at 16:06:31 -0500, Ben Boeckel wrote: > This patch series 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 any > TU with `export import some_module;` is compiled first. > > [P1689R5]: https://isocpp.org/files/papers/P1689R5.html > > I've also added patches to include imported module CMI files and the > module mapper file as dependencies of the compilation. I briefly looked > into adding dependencies on response files as well, but that appeared to > need some code contortions to have a `class mkdeps` available before > parsing the command line or to keep the information around until one was > made. > > 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. > > FWIW, Clang as taken an alternate approach with its `clang-scan-deps` > tool rather than using the compiler directly. Ping? It'd be nice to have this supported in at least GCC 14 (since it missed 13). Thanks, --Ben
Hi Ben, Am 25.01.23 um 22:06 schrieb Ben Boeckel via Gcc-patches: > Hi, > > This patch series 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 any > TU with `export import some_module;` is compiled first. > > [P1689R5]: https://isocpp.org/files/papers/P1689R5.html while that paper mentions Fortran, the patch in its present version does not seem to implement anything related to Fortran and does not touch the gfortran frontend. Or am I missing anything? Otherwise, could you give an example how it would be used with Fortran? Thus I'd say that it is OK from the gfortran side. Thanks, Harald > I've also added patches to include imported module CMI files and the > module mapper file as dependencies of the compilation. I briefly looked > into adding dependencies on response files as well, but that appeared to > need some code contortions to have a `class mkdeps` available before > parsing the command line or to keep the information around until one was > made. > > 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. > > FWIW, Clang as taken an alternate approach with its `clang-scan-deps` > tool rather than using the compiler directly. > > Thanks, > > --Ben > > --- > v4 -> v5: > > - add dependency tracking for imported modules to `-MF` > - add dependency tracking for static module mapper files given to > `-fmodule-mapper=` > > v3 -> v4: > > - add missing spaces between function names and arguments > > v2 -> v3: > > - changelog entries moved to commit messages > - documentation updated/added in the UTF-8 routine editing > > v1 -> v2: > > - removal of the `deps_write(extra)` parameter to option-checking where > ndeeded > - default parameter of `cpp_finish(fdeps_stream = NULL)` > - unification of libcpp UTF-8 validity functions from v1 > - test cases for flag parsing states (depflags-*) and p1689 output > (p1689-*) > > Ben Boeckel (5): > libcpp: reject codepoints above 0x10FFFF > libcpp: add a function to determine UTF-8 validity of a C string > p1689r5: initial support > c++modules: report imported CMI files as dependencies > c++modules: report module mapper files as a dependency > > gcc/c-family/c-opts.cc | 40 +++- > gcc/c-family/c.opt | 12 + > gcc/cp/mapper-client.cc | 4 + > gcc/cp/mapper-client.h | 1 + > gcc/cp/module.cc | 23 +- > gcc/doc/invoke.texi | 15 ++ > gcc/testsuite/g++.dg/modules/depflags-f-MD.C | 2 + > gcc/testsuite/g++.dg/modules/depflags-f.C | 1 + > gcc/testsuite/g++.dg/modules/depflags-fi.C | 3 + > gcc/testsuite/g++.dg/modules/depflags-fj-MD.C | 3 + > gcc/testsuite/g++.dg/modules/depflags-fj.C | 4 + > .../g++.dg/modules/depflags-fjo-MD.C | 4 + > gcc/testsuite/g++.dg/modules/depflags-fjo.C | 5 + > gcc/testsuite/g++.dg/modules/depflags-fo-MD.C | 3 + > gcc/testsuite/g++.dg/modules/depflags-fo.C | 4 + > gcc/testsuite/g++.dg/modules/depflags-j-MD.C | 2 + > gcc/testsuite/g++.dg/modules/depflags-j.C | 3 + > gcc/testsuite/g++.dg/modules/depflags-jo-MD.C | 3 + > gcc/testsuite/g++.dg/modules/depflags-jo.C | 4 + > gcc/testsuite/g++.dg/modules/depflags-o-MD.C | 2 + > gcc/testsuite/g++.dg/modules/depflags-o.C | 3 + > gcc/testsuite/g++.dg/modules/modules.exp | 1 + > gcc/testsuite/g++.dg/modules/p1689-1.C | 18 ++ > gcc/testsuite/g++.dg/modules/p1689-1.exp.json | 27 +++ > gcc/testsuite/g++.dg/modules/p1689-2.C | 16 ++ > gcc/testsuite/g++.dg/modules/p1689-2.exp.json | 16 ++ > gcc/testsuite/g++.dg/modules/p1689-3.C | 14 ++ > gcc/testsuite/g++.dg/modules/p1689-3.exp.json | 16 ++ > gcc/testsuite/g++.dg/modules/p1689-4.C | 14 ++ > gcc/testsuite/g++.dg/modules/p1689-4.exp.json | 14 ++ > gcc/testsuite/g++.dg/modules/p1689-5.C | 14 ++ > gcc/testsuite/g++.dg/modules/p1689-5.exp.json | 14 ++ > gcc/testsuite/g++.dg/modules/test-p1689.py | 222 ++++++++++++++++++ > gcc/testsuite/lib/modules.exp | 71 ++++++ > libcpp/charset.cc | 28 ++- > libcpp/include/cpplib.h | 12 +- > libcpp/include/mkdeps.h | 17 +- > libcpp/init.cc | 13 +- > libcpp/internal.h | 2 + > libcpp/mkdeps.cc | 149 +++++++++++- > 40 files changed, 789 insertions(+), 30 deletions(-) > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-f-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-f.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fi.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fj-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fj.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fjo-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fjo.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fo-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fo.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-j-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-j.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-jo-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-jo.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-o-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-o.C > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-1.C > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-1.exp.json > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-2.C > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-2.exp.json > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-3.C > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-3.exp.json > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-4.C > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-4.exp.json > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-5.C > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-5.exp.json > create mode 100644 gcc/testsuite/g++.dg/modules/test-p1689.py > create mode 100644 gcc/testsuite/lib/modules.exp > > > base-commit: 9d4c00cdaccc3decd07740e817387ce844ef3ac9
On Thu, Feb 02, 2023 at 21:24:12 +0100, Harald Anlauf wrote: > Am 25.01.23 um 22:06 schrieb Ben Boeckel via Gcc-patches: > > Hi, > > > > This patch series 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 any > > TU with `export import some_module;` is compiled first. > > > > [P1689R5]: https://isocpp.org/files/papers/P1689R5.html > > while that paper mentions Fortran, the patch in its present version > does not seem to implement anything related to Fortran and does not > touch the gfortran frontend. Or am I missing anything? Otherwise, > could you give an example how it would be used with Fortran? Correct. Still trying to put the walls back together after modules KoolAid Man'd their way into the build graph structure :) . Being able to drop our Fortran parser (well, we'd have to drop support for Fortran compilers that exist today…so maybe in 2075 or something) and rely on compilers to tell us the information would be amazing though :) . FWIW, the initial revision of the patchset did touch the gfortran frontend, but the new parameter is now defaulted and therefore the callsite doesn't need an update anymore. I still thought it worthwhile to keep the Fortran side aware of what is going on in the space. The link to Fortran comes up because the build graph problem is isomorphic (Fortran supports exporting multiple modules from a single TU, but it's not relevant at the graph level; it's the zero -> any case that is hard), CMake "solved" it already, and C++ is going to have a *lot* more "I want to consume $other_project's modules using my favorite compiler/flags" than seems to happen in Fortran. If you're interested, this is the paper showing how we do it: https://mathstuf.fedorapeople.org/fortran-modules/fortran-modules.html > Thus I'd say that it is OK from the gfortran side. Eventually we'll like to get gfortran supporting this type of scanning, but…as above. Thanks, --Ben
On Wed, Jan 25, 2023 at 1:07 PM Ben Boeckel via Fortran <fortran@gcc.gnu.org> wrote: > > Hi, > > This patch series 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 any > TU with `export import some_module;` is compiled first. I like how folks are complaining that GCC outputs POSIX makefile syntax from GCC's dependency files which are supposed to be in POSIX Makefile syntax. It seems like rather the build tools are people like to use are not understanding POSIX makefile syntax any more rather. Also I am not a fan of json, it is too verbose for no use. Maybe it is time to go back to standardizing a new POSIX makefile syntax rather than changing C++ here. Thanks, Andrew Pinski > > [P1689R5]: https://isocpp.org/files/papers/P1689R5.html > > I've also added patches to include imported module CMI files and the > module mapper file as dependencies of the compilation. I briefly looked > into adding dependencies on response files as well, but that appeared to > need some code contortions to have a `class mkdeps` available before > parsing the command line or to keep the information around until one was > made. > > 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. > > FWIW, Clang as taken an alternate approach with its `clang-scan-deps` > tool rather than using the compiler directly. > > Thanks, > > --Ben > > --- > v4 -> v5: > > - add dependency tracking for imported modules to `-MF` > - add dependency tracking for static module mapper files given to > `-fmodule-mapper=` > > v3 -> v4: > > - add missing spaces between function names and arguments > > v2 -> v3: > > - changelog entries moved to commit messages > - documentation updated/added in the UTF-8 routine editing > > v1 -> v2: > > - removal of the `deps_write(extra)` parameter to option-checking where > ndeeded > - default parameter of `cpp_finish(fdeps_stream = NULL)` > - unification of libcpp UTF-8 validity functions from v1 > - test cases for flag parsing states (depflags-*) and p1689 output > (p1689-*) > > Ben Boeckel (5): > libcpp: reject codepoints above 0x10FFFF > libcpp: add a function to determine UTF-8 validity of a C string > p1689r5: initial support > c++modules: report imported CMI files as dependencies > c++modules: report module mapper files as a dependency > > gcc/c-family/c-opts.cc | 40 +++- > gcc/c-family/c.opt | 12 + > gcc/cp/mapper-client.cc | 4 + > gcc/cp/mapper-client.h | 1 + > gcc/cp/module.cc | 23 +- > gcc/doc/invoke.texi | 15 ++ > gcc/testsuite/g++.dg/modules/depflags-f-MD.C | 2 + > gcc/testsuite/g++.dg/modules/depflags-f.C | 1 + > gcc/testsuite/g++.dg/modules/depflags-fi.C | 3 + > gcc/testsuite/g++.dg/modules/depflags-fj-MD.C | 3 + > gcc/testsuite/g++.dg/modules/depflags-fj.C | 4 + > .../g++.dg/modules/depflags-fjo-MD.C | 4 + > gcc/testsuite/g++.dg/modules/depflags-fjo.C | 5 + > gcc/testsuite/g++.dg/modules/depflags-fo-MD.C | 3 + > gcc/testsuite/g++.dg/modules/depflags-fo.C | 4 + > gcc/testsuite/g++.dg/modules/depflags-j-MD.C | 2 + > gcc/testsuite/g++.dg/modules/depflags-j.C | 3 + > gcc/testsuite/g++.dg/modules/depflags-jo-MD.C | 3 + > gcc/testsuite/g++.dg/modules/depflags-jo.C | 4 + > gcc/testsuite/g++.dg/modules/depflags-o-MD.C | 2 + > gcc/testsuite/g++.dg/modules/depflags-o.C | 3 + > gcc/testsuite/g++.dg/modules/modules.exp | 1 + > gcc/testsuite/g++.dg/modules/p1689-1.C | 18 ++ > gcc/testsuite/g++.dg/modules/p1689-1.exp.json | 27 +++ > gcc/testsuite/g++.dg/modules/p1689-2.C | 16 ++ > gcc/testsuite/g++.dg/modules/p1689-2.exp.json | 16 ++ > gcc/testsuite/g++.dg/modules/p1689-3.C | 14 ++ > gcc/testsuite/g++.dg/modules/p1689-3.exp.json | 16 ++ > gcc/testsuite/g++.dg/modules/p1689-4.C | 14 ++ > gcc/testsuite/g++.dg/modules/p1689-4.exp.json | 14 ++ > gcc/testsuite/g++.dg/modules/p1689-5.C | 14 ++ > gcc/testsuite/g++.dg/modules/p1689-5.exp.json | 14 ++ > gcc/testsuite/g++.dg/modules/test-p1689.py | 222 ++++++++++++++++++ > gcc/testsuite/lib/modules.exp | 71 ++++++ > libcpp/charset.cc | 28 ++- > libcpp/include/cpplib.h | 12 +- > libcpp/include/mkdeps.h | 17 +- > libcpp/init.cc | 13 +- > libcpp/internal.h | 2 + > libcpp/mkdeps.cc | 149 +++++++++++- > 40 files changed, 789 insertions(+), 30 deletions(-) > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-f-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-f.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fi.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fj-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fj.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fjo-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fjo.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fo-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-fo.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-j-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-j.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-jo-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-jo.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-o-MD.C > create mode 100644 gcc/testsuite/g++.dg/modules/depflags-o.C > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-1.C > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-1.exp.json > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-2.C > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-2.exp.json > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-3.C > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-3.exp.json > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-4.C > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-4.exp.json > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-5.C > create mode 100644 gcc/testsuite/g++.dg/modules/p1689-5.exp.json > create mode 100644 gcc/testsuite/g++.dg/modules/test-p1689.py > create mode 100644 gcc/testsuite/lib/modules.exp > > > base-commit: 9d4c00cdaccc3decd07740e817387ce844ef3ac9 > -- > 2.39.0 >
On Fri, 3 Feb 2023, 04:09 Andrew Pinski via Gcc, <gcc@gcc.gnu.org> wrote: > On Wed, Jan 25, 2023 at 1:07 PM Ben Boeckel via Fortran > <fortran@gcc.gnu.org> wrote: > > > > Hi, > > > > This patch series 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 any > > TU with `export import some_module;` is compiled first. > > > I like how folks are complaining that GCC outputs POSIX makefile > syntax from GCC's dependency files which are supposed to be in POSIX > Makefile syntax. > It seems like rather the build tools are people like to use are not > understanding POSIX makefile syntax any more rather. > Also I am not a fan of json, it is too verbose for no use. Maybe it is > time to go back to standardizing a new POSIX makefile syntax rather > than changing C++ here. > That would take a decade or more. It's too late for POSIX 202x and the pace that POSIX agrees on makefile features is incredibly slow.
On Fri, 3 Feb 2023 at 08:58, Jonathan Wakely wrote: > > > > On Fri, 3 Feb 2023, 04:09 Andrew Pinski via Gcc, <gcc@gcc.gnu.org> wrote: >> >> On Wed, Jan 25, 2023 at 1:07 PM Ben Boeckel via Fortran >> <fortran@gcc.gnu.org> wrote: >> > >> > Hi, >> > >> > This patch series 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 any >> > TU with `export import some_module;` is compiled first. >> >> >> I like how folks are complaining that GCC outputs POSIX makefile >> syntax from GCC's dependency files which are supposed to be in POSIX >> Makefile syntax. >> It seems like rather the build tools are people like to use are not >> understanding POSIX makefile syntax any more rather. >> Also I am not a fan of json, it is too verbose for no use. Maybe it is >> time to go back to standardizing a new POSIX makefile syntax rather >> than changing C++ here. > > > > That would take a decade or more. It's too late for POSIX 202x and the pace that POSIX agrees on makefile features is incredibly slow. Also, name+=value is *not* POSIX make syntax today, that's an extension. That's why the tools don't always support it. So I don't think it's true that GCC's dependency files are in POSIX syntax. POSIX 202x does add support for it, but it will take some time for it to be supported everywhere.
On Fri, Feb 03, 2023 at 09:10:21 +0000, Jonathan Wakely wrote: > On Fri, 3 Feb 2023 at 08:58, Jonathan Wakely wrote: > > On Fri, 3 Feb 2023, 04:09 Andrew Pinski via Gcc, <gcc@gcc.gnu.org> wrote: > >> On Wed, Jan 25, 2023 at 1:07 PM Ben Boeckel via Fortran > >> <fortran@gcc.gnu.org> wrote: > >> > This patch series 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 any > >> > TU with `export import some_module;` is compiled first. > >> > >> I like how folks are complaining that GCC outputs POSIX makefile > >> syntax from GCC's dependency files which are supposed to be in POSIX > >> Makefile syntax. > >> It seems like rather the build tools are people like to use are not > >> understanding POSIX makefile syntax any more rather. > >> Also I am not a fan of json, it is too verbose for no use. Maybe it is > >> time to go back to standardizing a new POSIX makefile syntax rather > >> than changing C++ here. I'm not complaining that dependency files are in POSIX (or even POSIX-to-be) syntax. The information requires a bit more structure than some variable assignments and I don't expect anything trying to read them to start trying to understand `VAR_$(DEREF)=` and the behaviors of `:=` versus `=` assignment to get this reliably. > > That would take a decade or more. It's too late for POSIX 202x and > > the pace that POSIX agrees on makefile features is incredibly slow. > > Also, name+=value is *not* POSIX make syntax today, that's an > extension. That's why the tools don't always support it. > So I don't think it's true that GCC's dependency files are in POSIX syntax. > > POSIX 202x does add support for it, but it will take some time for it > to be supported everywhere. Additionally, while the *syntax* might be supported, encoding all of P1689 in it would require additional work (e.g., key/value variable assignments or something). Batch scanning would also be…interesting. Also note that the imported modules' location cannot be known before scanning in general, so all you get are "logical names" that you need a collator to link up with other scan results anyways. Tools such as `make` and `ninja` cannot know, in general, how to do this linking between arbitrary targets (e.g., there may be a debug and release build of the same module in the graph and knowing which to use requires higher-level info about the entire build graph; modules may also be considered "private" and not accessible everywhere and therefore should also not be hooked up across different target boundaries). While the `CXX_MODULES +=` approach can work for simple cases (a pseudo-implicit build), it is quite insufficient for the general case. --Ben