Message ID | 20221027231645.67623-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:6687:0:0:0:0:0 with SMTP id l7csp506067wru; Thu, 27 Oct 2022 16:18:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GHKgB+hJ9covP92VvRM2grpumCOPfA0X3Ni+SNjalZq056gwfS6x99od5x7CTBQQiWATT X-Received: by 2002:a50:d5d5:0:b0:461:a30b:67a2 with SMTP id g21-20020a50d5d5000000b00461a30b67a2mr25084818edj.104.1666912710377; Thu, 27 Oct 2022 16:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666912710; cv=none; d=google.com; s=arc-20160816; b=P3a+NnPhJ97061B4F5u1+tD9uQkJ4ELbKsMp77YzK1LnCQVR/u1WJY8qdFYQBLCnun ZclXXrFAkSRT4yRUXc8fv91poUUrV1G15jqqgUdkfFM7aP7X7+5NTdu6vbg5KliLnE00 SUcBq/oXJewRqmBVodDj4CT4VGfXGH04jS92CS5dLo18GYGlURNYtbi+eEQRGqR/plfj lBZElVWiuPxIZDZHM5YIxwqrSiJwnTo8Rz1LAvK4JqnWYMuYZLYWebUCld4rETK6uDA6 1vu1JbXo1DuXV5oSfb2DP59cnTeLEqeqU5K4XhBOVGA0q6tHGOUJ3cczOd5I5/Qm+3DD 2Mrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=aLwN/MGu1sxTHiQ9v5ej39r7qfrlweypgpXXgRNGw/E=; b=NDCwd+Pbx39QbaNub0nERQgEYYnTVS3+iFdRNzy6cBN0bYUIBNekAABabRW50IXMqX M/qLHi7extEcok4Um2r8non9Iud0kGcbJkfvLwAnsel/At4wEWQG4kqzh4xOXQhBGcfN H0Z4nFicldh16qpGin16kKqInQptgfSWgC0lyb7U1OzJbBG8YLLp1JfWbylVibqOJEb2 rAGeQvN4OQAv4IFfoZCfFo+PFeAQ3FAcik6AUatQumqVwbNcFj/iW4G3LtRVMZHObDQq EUMcbPzR4rgCfl3WMkoCgIBZ1tAwewzeduWGV474QyF6fXDIZeyzQhmvVTW/TXxE/ZwP ismQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=DolQIBA+; 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 hs13-20020a1709073e8d00b00779e6c93108si1370323ejc.598.2022.10.27.16.18.30 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 16:18:30 -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=pass header.i=@gcc.gnu.org header.s=default header.b=DolQIBA+; 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 E0856385D0D7 for <ouuuleilei@gmail.com>; Thu, 27 Oct 2022 23:17:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E0856385D0D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666912672; bh=aLwN/MGu1sxTHiQ9v5ej39r7qfrlweypgpXXgRNGw/E=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=DolQIBA+AlCTGHMOisicws00BCFXS8Zu8IYqovP6tye4NPHQpcao3PFZLy6MDiDe3 nYbjdNe48Kfrt810PN3+Wt+eTJAyT6XwE+w64lghdMQRt/hF5pSrsTbyLylP000YZ9 8FjsfrJeSHUZ3VVfvvtX4tW4iC6F7A3YS8G22688= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by sourceware.org (Postfix) with ESMTPS id 7A1F93857408 for <gcc-patches@gcc.gnu.org>; Thu, 27 Oct 2022 23:17:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7A1F93857408 Received: by mail-qk1-x733.google.com with SMTP id d13so2383032qko.5 for <gcc-patches@gcc.gnu.org>; Thu, 27 Oct 2022 16:17:03 -0700 (PDT) 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=aLwN/MGu1sxTHiQ9v5ej39r7qfrlweypgpXXgRNGw/E=; b=ItpqYIF0NMaFQBaXakdi5S21dgZA3cN8eJUEPKlUMveaaNP8FYNzoTh9ARK6Okuf1l tsfpqpEatNzxGDm0Txm39twSe8Doco1K3i8ou/7mKX2SanXlm9EMRHomvXZIluzGV4/Q upN6Q0Ki2OmY8JKUap3EA/kbwdA8djyqLJ/9Cj3cqXD9/EaIirbhIiWeiJD2cUHMRUls mG1JUUd9rabu/AZhbNFf+AeTOLUbOFsXsqkIvrwFgU4nkSbjSBckSu4uvCiSCVAKilMK gn9hzDcnvTLq/gvOUwpQh4tcJCqBvknbfxw3i3xIblzWSxQ4f9Dr+YhYUNhqS6kSKV5U uKRQ== X-Gm-Message-State: ACrzQf2QyoJbvZOAiESWmNQ+Irw5cvNT2ytWcYnFJYUwZz0kLQNKS8xh z1o8in2tqILrqe4FIk9uxr9NzjUWwsUq7w== X-Received: by 2002:a37:ab0c:0:b0:6ec:e84f:7487 with SMTP id u12-20020a37ab0c000000b006ece84f7487mr37105353qke.522.1666912622775; Thu, 27 Oct 2022 16:17:02 -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 h129-20020a37b787000000b006e702033b15sm1817245qkf.66.2022.10.27.16.17.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 16:17:02 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH v2 0/1] RFC: P1689R5 support Date: Thu, 27 Oct 2022 19:16:41 -0400 Message-Id: <20221027231645.67623-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=-2.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> Cc: gcc@gcc.gnu.org, brad.king@kitware.com, fortran@gcc.gnu.org, anlauf@gmx.de, 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?1747884662397868437?= X-GMAIL-MSGID: =?utf-8?q?1747884662397868437?= |
Series | RFC: P1689R5 support | |
Message
Ben Boeckel
Oct. 27, 2022, 11:16 p.m. UTC
Hi, 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. For the record, Clang has patches with similar flags and behavior by Chuanqi Xu here: https://reviews.llvm.org/D134269 with the same flags. Thanks, --Ben --- 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 (3): libcpp: reject codepoints above 0x10FFFF libcpp: add a function to determine UTF-8 validity of a C string p1689r5: initial support gcc/ChangeLog | 5 + 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/testsuite/ChangeLog | 7 + 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 | 11 + 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/ChangeLog | 23 ++ libcpp/charset.cc | 22 +- libcpp/include/cpplib.h | 12 +- libcpp/include/mkdeps.h | 17 +- libcpp/init.cc | 13 +- libcpp/internal.h | 2 + libcpp/mkdeps.cc | 149 +++++++++++- 43 files changed, 823 insertions(+), 21 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: f95d3d5de72a1c43e8d529bad3ef59afc3214705