Message ID | 20230606205025.3164738-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:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3662809vqr; Tue, 6 Jun 2023 13:52:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5hKf9q9Bj0CfqytEpxVA/QZkk2OKXWYlNOFEI7Qy5botWUzw7/EDp7FNHBnaXYlStWiiIQ X-Received: by 2002:a17:907:94d4:b0:971:2eaf:556 with SMTP id dn20-20020a17090794d400b009712eaf0556mr4040163ejc.18.1686084773522; Tue, 06 Jun 2023 13:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686084773; cv=none; d=google.com; s=arc-20160816; b=SjCWyMjqcJNSOw30V4nkpmbfpD95ruhRkPJsN6oc6+75VHiqm3o9LlfwwVce4WIdiV IXt0FkVqwCp2aG4pRN/r0FWF8aaeAgjOpQhZTdLZ38aSFRzv1XQaA2zCp/YbnKz7vAkP pH+wLjTjlgTszUQz4wgv9PUppe6l0eRi4WOyDjZ8ORKFkClECNZJFnbjK9MRV4S5iAw3 ffapUolOUCZOsFQEBiRb913KKf0F+WuYC6/J22cgRpekdEZ5rtqDdVJZMtB8dk4obOL5 hR3rgPgsDW3L1UpGp8f6JcsMph6O1noC3H++91yCnn+JW/WRF2mBAY+XywWo42BZnbY4 8LNg== 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=MMkHi/8gpnTXiRhm66+XkhUZ/2cQNBd/J0hGcOMB3Nc=; b=wpEyAPellvl4JqPAhdFv2tRgzpx8ToTqVRJB4ooX4Fh/pZ5wUE7A9Mev2rVLqOKtZQ GdzrhSri/IMCQqXORs5gi3mhacf8ItOQqHb8GHcPJOzbrFai5iajx4jdSwIoaQGOmOSO PoxPqgLXHZm2FQWQRQPfmU1OJyukmkrMaddCNLTJGEiMrWdppEUmdvCtPMk4RWAKjp9R H7jx43L8uoxMGMk6L/kILs7t4n7Vkur5q+zCxAOldbjiWK0bSKDQUGIAP5dZbEPyS8Ln FqwyVFMSraMu51Mo2qEBEzdfL8yV+PcO0anClS7avDLH4alnHeykE6TYSDCf57WkDPcE gMpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="l4wf/DaO"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id sh33-20020a1709076ea100b00974e764c89bsi8972138ejc.57.2023.06.06.13.52.53 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 13:52:53 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="l4wf/DaO"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 17413384D193 for <ouuuleilei@gmail.com>; Tue, 6 Jun 2023 20:51:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17413384D193 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686084684; bh=MMkHi/8gpnTXiRhm66+XkhUZ/2cQNBd/J0hGcOMB3Nc=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=l4wf/DaOrSFst/ueOAxJgPFjkN8e9FvtMmCozeqRnIQXVW8FFxuS79HC66u+0v5qW c1u24uB1ly+mCJbX5Y+te88uQJpTn0eRAVfbzKMMX3Zxgn1ti1DJqVVpKbvq74JIcS 94glDzrqIiEl97G2yL1XWn3n3kaS07yjHfwhnTM0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by sourceware.org (Postfix) with ESMTPS id 79AF03858D38 for <gcc-patches@gcc.gnu.org>; Tue, 6 Jun 2023 20:50:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 79AF03858D38 Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-62b671e0a0dso6029526d6.1 for <gcc-patches@gcc.gnu.org>; Tue, 06 Jun 2023 13:50:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686084634; x=1688676634; 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=MMkHi/8gpnTXiRhm66+XkhUZ/2cQNBd/J0hGcOMB3Nc=; b=fBxijxpwjrQXr3MO+DyPLq+OJ8J5naQ6s23SKu/9fQ0U4y4NRzCGsBPKIq4FYFPWin ui6Hpa0DmYqTizbCGazIBs4snoMJPiDORfPQfEWIl6JcXJPyaUOyQUKM6l6nYxTVlJlR PPd/INsXB64OI1g7fc+4+k7ECfr8eyn9bt1cxvkNrb7kkDyjGibyPgwtAe7DB7y3qbtb DPiVUujG1J/Bc8WnDh+7j6vSLLb4xyV4O35hdlbMLAKjIvBMrD0wSbOdEvqk0NSoUMwl 8N0X5ZlnLLclQtAaOLFKnNRygHCgp5VxfClDLNduI/O3lAOz59JvjfeXimbw9Pp45wT0 W4hg== X-Gm-Message-State: AC+VfDxBkN4uoigTyBdQdQoZCk0sCy0OCoTjouD1nbcrHqLg+0F+tz+K cKcZP/RiYWkh8yq+7XvPKw/0GFPiQWoacFCu31NOrA== X-Received: by 2002:a05:6214:4105:b0:628:6641:50d2 with SMTP id kc5-20020a056214410500b00628664150d2mr629266qvb.52.1686084633746; Tue, 06 Jun 2023 13:50:33 -0700 (PDT) Received: from localhost (cpe-142-105-146-128.nycap.res.rr.com. [142.105.146.128]) by smtp.gmail.com with ESMTPSA id ay38-20020a05622a22a600b003e4ee0f5234sm563773qtb.87.2023.06.06.13.50.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 13:50:33 -0700 (PDT) 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 v6 0/4] P1689R5 support Date: Tue, 6 Jun 2023 16:50:21 -0400 Message-Id: <20230606205025.3164738-1-ben.boeckel@kitware.com> X-Mailer: git-send-email 2.40.1 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, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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?1767988027657339552?= X-GMAIL-MSGID: =?utf-8?q?1767988027657339552?= |
Series | P1689R5 support | |
Message
Ben Boeckel
June 6, 2023, 8:50 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 --- v5 -> v6: - rebase onto `master` (585c660f041 (reload1: Change return type of predicate function from int to bool, 2023-06-06)) - fix crash related to reporting imported CMI files as dependencies - rework utf-8 validity to patch the new `cpp_valid_utf8_p` function instead of the core utf-8 decoding routine to reject invalid codepoints (preserves higher-level error detection of invalid utf-8) - harmonize of `fdeps` spelling in flags, variables, comments, etc. - rename `-fdeps-output=` to `-fdeps-target=` 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 (4): libcpp: reject codepoints above 0x10FFFF 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 | 24 +- 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 | 7 + libcpp/include/cpplib.h | 12 +- libcpp/include/mkdeps.h | 17 +- libcpp/init.cc | 13 +- libcpp/mkdeps.cc | 149 +++++++++++- 39 files changed, 769 insertions(+), 28 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: 585c660f041c57694a61b3e65085af5a54431be4
Comments
> On Jun 7, 2023, at 00:50, Ben Boeckel via Gcc-patches <gcc-patches@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. Hi Ben, This patch series causes ICEs on arm-linux-gnueabihf. Would you please investigate? Please let me know if you need any in reproducing these. === g++ tests === Running g++:g++.dg/modules/modules.exp ... FAIL: g++.dg/modules/ben-1_a.C -std=c++17 (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/ben-1_a.C -std=c++17 (test for excess errors) FAIL: g++.dg/modules/ben-1_a.C -std=c++2a (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/ben-1_a.C -std=c++2a (test for excess errors) FAIL: g++.dg/modules/ben-1_a.C -std=c++2b (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/ben-1_a.C -std=c++2b (test for excess errors) FAIL: g++.dg/modules/ben-1_a.C module-cmi =partitions/module-import.mod (partitions/module-import.mod) FAIL: g++.dg/modules/ben-1_b.C -std=c++17 (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/ben-1_b.C -std=c++17 (test for excess errors) FAIL: g++.dg/modules/ben-1_b.C -std=c++2a (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/ben-1_b.C -std=c++2a (test for excess errors) FAIL: g++.dg/modules/ben-1_b.C -std=c++2b (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/ben-1_b.C -std=c++2b (test for excess errors) FAIL: g++.dg/modules/ben-1_b.C module-cmi =module.mod (module.mod) FAIL: g++.dg/modules/gc-2_a.C -std=c++17 (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/gc-2_a.C -std=c++17 (test for excess errors) FAIL: g++.dg/modules/gc-2_a.C -std=c++2a (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/gc-2_a.C -std=c++2a (test for excess errors) FAIL: g++.dg/modules/gc-2_a.C -std=c++2b (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/gc-2_a.C -std=c++2b (test for excess errors) FAIL: g++.dg/modules/gc-2_a.C module-cmi =map-1_a.nms (map-1_a.nms) UNRESOLVED: g++.dg/modules/map-1 -std=c++17 execute UNRESOLVED: g++.dg/modules/map-1 -std=c++17 link UNRESOLVED: g++.dg/modules/map-1 -std=c++2a execute UNRESOLVED: g++.dg/modules/map-1 -std=c++2a link UNRESOLVED: g++.dg/modules/map-1 -std=c++2b execute UNRESOLVED: g++.dg/modules/map-1 -std=c++2b link FAIL: g++.dg/modules/map-1_a.C -std=c++17 (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/map-1_a.C -std=c++17 (test for excess errors) FAIL: g++.dg/modules/map-1_a.C -std=c++2a (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/map-1_a.C -std=c++2a (test for excess errors) FAIL: g++.dg/modules/map-1_a.C -std=c++2b (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/map-1_a.C -std=c++2b (test for excess errors) FAIL: g++.dg/modules/map-1_a.C module-cmi =map-1_a.nms (map-1_a.nms) FAIL: g++.dg/modules/map-1_b.C -std=c++17 (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/map-1_b.C -std=c++17 (test for excess errors) FAIL: g++.dg/modules/map-1_b.C -std=c++2a (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/map-1_b.C -std=c++2a (test for excess errors) FAIL: g++.dg/modules/map-1_b.C -std=c++2b (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/map-1_b.C -std=c++2b (test for excess errors) FAIL: g++.dg/modules/map-2.C -std=c++17 at line 8 (test for errors, line 7) FAIL: g++.dg/modules/map-2.C -std=c++17 at line 9 (test for errors, line ) FAIL: g++.dg/modules/map-2.C -std=c++17 (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/map-2.C -std=c++17 (test for excess errors) FAIL: g++.dg/modules/map-2.C -std=c++2a at line 8 (test for errors, line 7) FAIL: g++.dg/modules/map-2.C -std=c++2a at line 9 (test for errors, line ) FAIL: g++.dg/modules/map-2.C -std=c++2a (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/map-2.C -std=c++2a (test for excess errors) FAIL: g++.dg/modules/map-2.C -std=c++2b at line 8 (test for errors, line 7) FAIL: g++.dg/modules/map-2.C -std=c++2b at line 9 (test for errors, line ) FAIL: g++.dg/modules/map-2.C -std=c++2b (internal compiler error: Segmentation fault) FAIL: g++.dg/modules/map-2.C -std=c++2b (test for excess errors) === Thanks, -- Maxim Kuvyrkov https://www.linaro.org > > [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 > > --- > v5 -> v6: > > - rebase onto `master` (585c660f041 (reload1: Change return type of > predicate function from int to bool, 2023-06-06)) > - fix crash related to reporting imported CMI files as dependencies > - rework utf-8 validity to patch the new `cpp_valid_utf8_p` function > instead of the core utf-8 decoding routine to reject invalid > codepoints (preserves higher-level error detection of invalid utf-8) > - harmonize of `fdeps` spelling in flags, variables, comments, etc. > - rename `-fdeps-output=` to `-fdeps-target=` > > 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 (4): > libcpp: reject codepoints above 0x10FFFF > 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 | 24 +- > 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 | 7 + > libcpp/include/cpplib.h | 12 +- > libcpp/include/mkdeps.h | 17 +- > libcpp/init.cc | 13 +- > libcpp/mkdeps.cc | 149 +++++++++++- > 39 files changed, 769 insertions(+), 28 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: 585c660f041c57694a61b3e65085af5a54431be4 > -- > 2.40.1 >
On Fri, Jun 16, 2023 at 15:48:59 -0400, Ben Boeckel wrote: > On Thu, Jun 08, 2023 at 21:59:13 +0400, Maxim Kuvyrkov wrote: > > This patch series causes ICEs on arm-linux-gnueabihf. Would you > > please investigate? Please let me know if you need any in reproducing > > these. > > Finally back at it. I tried on aarch64, but wasn't able to reproduce the > errors (alas, it is probably a 32bit thing…let me try with `-m32`). Is > there hardware I can access to try this out on the same target triple? Trying inside of an i386 container also came up with nothing…I'll try qemu. --Ben
On Fri, Jun 16, 2023 at 3:49 PM Ben Boeckel <ben.boeckel@kitware.com> wrote: > > On Thu, Jun 08, 2023 at 21:59:13 +0400, Maxim Kuvyrkov wrote: > > This patch series causes ICEs on arm-linux-gnueabihf. Would you > > please investigate? Please let me know if you need any in reproducing > > these. > > Finally back at it. I tried on aarch64, but wasn't able to reproduce the > errors (alas, it is probably a 32bit thing…let me try with `-m32`). Is > there hardware I can access to try this out on the same target triple? > > Alternatively, a backtrace may be able to help pinpoint it enough if you > have the cycles. I see the same thing with patch 4 on x86_64-pc-linux-gnu, e.g. FAIL: g++.dg/modules/ben-1_a.C -std=c++17 (test for excess errors) Excess errors: /home/jason/gt/gcc/testsuite/g++.dg/modules/ben-1_a.C:9:1: internal compiler error: Segmentation fault 0x19e2f3c crash_signal /home/jason/gt/gcc/toplev.cc:314 0x340f3f8 mkdeps::vec<mkdeps::velt>::size() const /home/jason/gt/libcpp/mkdeps.cc:57 0x340dc1f apply_vpath /home/jason/gt/libcpp/mkdeps.cc:194 0x340e08e deps_add_dep(mkdeps*, char const*) /home/jason/gt/libcpp/mkdeps.cc:318 0xea7b51 module_client::open_module_client(unsigned int, char const*, mkdeps*, void (*)(char const*), char const*) /home/jason/gt/gcc/cp/mapper-client.cc:291 0xef2ba8 make_mapper /home/jason/gt/gcc/cp/module.cc:14042 0xf0896c get_mapper(unsigned int, mkdeps*) /home/jason/gt/gcc/cp/module.cc:3977 0xf032ac name_pending_imports /home/jason/gt/gcc/cp/module.cc:19623 0xf03a7d preprocessed_module(cpp_reader*) /home/jason/gt/gcc/cp/module.cc:19817 0xe85104 module_token_cdtor(cpp_reader*, unsigned long) /home/jason/gt/gcc/cp/lex.cc:548 0xf467b2 cp_lexer_new_main /home/jason/gt/gcc/cp/parser.cc:756 0xfc1e3a c_parse_file() /home/jason/gt/gcc/cp/parser.cc:49725 0x11c5bf5 c_common_parse_file() /home/jason/gt/gcc/c-family/c-opts.cc:1268
On Fri, Jun 16, 2023 at 23:55:53 -0400, Jason Merrill wrote: > I see the same thing with patch 4 on x86_64-pc-linux-gnu, e.g. > > FAIL: g++.dg/modules/ben-1_a.C -std=c++17 (test for excess errors) > Excess errors: > /home/jason/gt/gcc/testsuite/g++.dg/modules/ben-1_a.C:9:1: internal > compiler error: Segmentation fault > 0x19e2f3c crash_signal > /home/jason/gt/gcc/toplev.cc:314 > 0x340f3f8 mkdeps::vec<mkdeps::velt>::size() const > /home/jason/gt/libcpp/mkdeps.cc:57 > 0x340dc1f apply_vpath > /home/jason/gt/libcpp/mkdeps.cc:194 > 0x340e08e deps_add_dep(mkdeps*, char const*) > /home/jason/gt/libcpp/mkdeps.cc:318 > 0xea7b51 module_client::open_module_client(unsigned int, char const*, > mkdeps*, void (*)(char const*), char const*) > /home/jason/gt/gcc/cp/mapper-client.cc:291 > 0xef2ba8 make_mapper > /home/jason/gt/gcc/cp/module.cc:14042 > 0xf0896c get_mapper(unsigned int, mkdeps*) > /home/jason/gt/gcc/cp/module.cc:3977 > 0xf032ac name_pending_imports > /home/jason/gt/gcc/cp/module.cc:19623 > 0xf03a7d preprocessed_module(cpp_reader*) > /home/jason/gt/gcc/cp/module.cc:19817 > 0xe85104 module_token_cdtor(cpp_reader*, unsigned long) > /home/jason/gt/gcc/cp/lex.cc:548 > 0xf467b2 cp_lexer_new_main > /home/jason/gt/gcc/cp/parser.cc:756 > 0xfc1e3a c_parse_file() > /home/jason/gt/gcc/cp/parser.cc:49725 > 0x11c5bf5 c_common_parse_file() > /home/jason/gt/gcc/c-family/c-opts.cc:1268 Thanks. I missed a `nullptr` check before calling `deps_add_dep`. I think I got misled by `make check` returning a zero exit code even if there are failures. Thanks, --Ben
On 6/17/23 10:43, Ben Boeckel wrote: > On Fri, Jun 16, 2023 at 23:55:53 -0400, Jason Merrill wrote: >> I see the same thing with patch 4 on x86_64-pc-linux-gnu, e.g. >> >> FAIL: g++.dg/modules/ben-1_a.C -std=c++17 (test for excess errors) >> Excess errors: >> /home/jason/gt/gcc/testsuite/g++.dg/modules/ben-1_a.C:9:1: internal >> compiler error: Segmentation fault >> 0x19e2f3c crash_signal >> /home/jason/gt/gcc/toplev.cc:314 >> 0x340f3f8 mkdeps::vec<mkdeps::velt>::size() const >> /home/jason/gt/libcpp/mkdeps.cc:57 >> 0x340dc1f apply_vpath >> /home/jason/gt/libcpp/mkdeps.cc:194 >> 0x340e08e deps_add_dep(mkdeps*, char const*) >> /home/jason/gt/libcpp/mkdeps.cc:318 >> 0xea7b51 module_client::open_module_client(unsigned int, char const*, >> mkdeps*, void (*)(char const*), char const*) >> /home/jason/gt/gcc/cp/mapper-client.cc:291 >> 0xef2ba8 make_mapper >> /home/jason/gt/gcc/cp/module.cc:14042 >> 0xf0896c get_mapper(unsigned int, mkdeps*) >> /home/jason/gt/gcc/cp/module.cc:3977 >> 0xf032ac name_pending_imports >> /home/jason/gt/gcc/cp/module.cc:19623 >> 0xf03a7d preprocessed_module(cpp_reader*) >> /home/jason/gt/gcc/cp/module.cc:19817 >> 0xe85104 module_token_cdtor(cpp_reader*, unsigned long) >> /home/jason/gt/gcc/cp/lex.cc:548 >> 0xf467b2 cp_lexer_new_main >> /home/jason/gt/gcc/cp/parser.cc:756 >> 0xfc1e3a c_parse_file() >> /home/jason/gt/gcc/cp/parser.cc:49725 >> 0x11c5bf5 c_common_parse_file() >> /home/jason/gt/gcc/c-family/c-opts.cc:1268 > > Thanks. I missed a `nullptr` check before calling `deps_add_dep`. I > think I got misled by `make check` returning a zero exit code even if > there are failures. Aha! Patches 3 and 4 could also use testcases. Jason