From patchwork Fri Sep 27 05:57:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathaniel Shead X-Patchwork-Id: 1990098 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=YkbgHV4N; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XFKW425Fxz1xt9 for ; Fri, 27 Sep 2024 15:57:34 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CC0B23858D39 for ; Fri, 27 Sep 2024 05:57:32 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id A61F33858D28 for ; Fri, 27 Sep 2024 05:57:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A61F33858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A61F33858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727416636; cv=none; b=DDWL6Br54s1RtULT1/QJxCN4KpMjhpV+FggxaZv0rUc/0LtKHmx4CqHezzGP6cwy91O5YnRZXH1NVJ9bkF/M0ro6NHWbrCJRYWR8fxb1K5m/IFPWAEr0CmCjCi9Cee0AAuk3wtHLolRhryI3738R46xQulEuPXQIL3GhZFWebzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727416636; c=relaxed/simple; bh=W/8z1EeZqf2cAwNWTb6l9Skm//NCUOwMq/M/6BKZU5Y=; h=DKIM-Signature:Message-ID:Date:From:To:Subject:MIME-Version; b=dhuu7wN/oRzzWK/llfqIx9HcummQkTNd49ZrfYHrsm+GlfizYLtToVmY+3x0Ea6EVRDjadmmXYvE+zFNwTACQXqA4SFd+hcvoFx4HmVfB/xcyjIGqLJOIjrvGrawUbn4K4l92NM2W0CqCGLz7ttwd/MU0Vkcg2sWWBDMRET+Qbg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-20b05ba4192so1657445ad.1 for ; Thu, 26 Sep 2024 22:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727416633; x=1728021433; darn=gcc.gnu.org; h=content-disposition:mime-version:subject:cc:to:from:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=nCCHOyao5xxu/sbZRJdcN1vG+9DjBSfdSVH0QhtRvcI=; b=YkbgHV4N3N1+f9xZREUVupm+2muTIqriKt6FbyfF/8LMYN2vXwJbGMVAkxTFWfcchV G2WBDtVwMJVD4KHDXdm9o2rwsZ5ofoISM80L6jL6fxh5/HekFyf0bB+zQwo4suJMt28N oRhsvPrG59pyc78o9QE4heuVh+im0k3IxvpQztMomIz3V9ebAi64BkqBZ6AbX0uvXZEW Rzp3LBvJv8CF5bfsvzg2k5sLIF3riNSW72qeUOU/BNT777elNoZ5YQTHARAWwy0tKxz+ u3+x6hjz97LSG7gn3ddIa1b7cze2WGkwK5NNCkb6CAEmPZS2YCXjXqlEP7hWsv2YCsPW 6uzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727416633; x=1728021433; h=content-disposition:mime-version:subject:cc:to:from:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nCCHOyao5xxu/sbZRJdcN1vG+9DjBSfdSVH0QhtRvcI=; b=tPEe8VghMyrj0CsNvTuOT82Bnq/oKk/o1pmtQnls4KSzPH+FMWOH6op+C4sG7LgNod rgBuQIkSOQJxTqixjhI0VIY7M2aXZ/lPf5bOrPIY8PuMmn2yHvgU44uPYYyS7hyWMNGs +L9r5n2/LaUc3HRQBYTa/AGExp8PLQM7lDfjxtgl9NDntRF3b8nJysO8tTkQreIww+iA kVcApQ3Pcd5mrIsqmFSy6CtQzHOdRrSpODPGM2Dwca9+dSTineBiryX9ETfDQ8nEAv0g 2baOXKsSZl4Q04H16vPFCOOisQCPMsZDRnlQqfjuWna/xYzNu87GEzo29mFTiF1o6v1S aWlg== X-Gm-Message-State: AOJu0Yx7eXiPqhVIMOjwYru98PdMvopXiXxB65YAYG0gBUGI4WmFlB8s sAh+9//5Dz3yf30QJm8mrNBhZX1NTWuDP2Jghcqh4DGByuIWCaPrH91+jw== X-Google-Smtp-Source: AGHT+IHus24zAl36ZQCg81obH3izJQs5b9MuPrNoWjR2VArt6QLN7VKifzPN9CA0CXAlbw4db9OQdA== X-Received: by 2002:aa7:8881:0:b0:70a:efec:6b88 with SMTP id d2e1a72fcca58-71b2605647amr1461571b3a.3.1727416633565; Thu, 26 Sep 2024 22:57:13 -0700 (PDT) Received: from Thaum. ([163.47.68.2]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b265246aasm848064b3a.143.2024.09.26.22.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2024 22:57:13 -0700 (PDT) Message-ID: <66f64939.050a0220.261230.4b66@mx.google.com> X-Google-Original-Message-ID: Date: Fri, 27 Sep 2024 15:57:08 +1000 From: Nathaniel Shead To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Nathan Sidwell Subject: [PATCH v2 0/6] c++/modules: Implement P1815 "Translation-unit-local entities" MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org This patch series implements most of the changes made by P1815. It also cleans up a few bugs found along the way that impacted tests I wrote. The whole patch series was bootstrapped on x86_64-pc-linux-gnu and aarch64-unknown-linux-gnu with no regressions. Changes since v1: - Merged in already approved patches - Use decl_maybe_constant_var_p intead of TREE_CONSTANT - Treat weakrefs as not TU-local - Check TU-local entities imported from header units - Don't treat class-scope statics always as definitions - Add testcase for standard-library exposures Nathaniel Shead (6): c++/modules: Detect exposures of TU-local entities c++/modules: Implement ignored TU-local exposures c++/modules: Support anonymous namespaces in header units c++/modules: Check linkage for exported declarations c++/modules: Validate external linkage definitions in header units [PR116401] c++/modules: Add testcase for standard-library exposures [PR115126] gcc/c-family/c.opt | 4 + gcc/cp/cp-objcp-common.cc | 1 + gcc/cp/cp-tree.def | 6 + gcc/cp/cp-tree.h | 29 +- gcc/cp/decl.cc | 1 + gcc/cp/decl2.cc | 1 + gcc/cp/module.cc | 749 +++++++++++++++--- gcc/cp/name-lookup.cc | 23 +- gcc/cp/name-lookup.h | 2 +- gcc/cp/parser.cc | 25 +- gcc/cp/parser.h | 3 + gcc/cp/pt.cc | 100 ++- gcc/doc/invoke.texi | 19 +- gcc/testsuite/g++.dg/modules/block-decl-2.C | 2 +- gcc/testsuite/g++.dg/modules/export-3.C | 2 +- gcc/testsuite/g++.dg/modules/export-6.C | 35 + gcc/testsuite/g++.dg/modules/hdr-2.H | 172 ++++ gcc/testsuite/g++.dg/modules/internal-1.C | 15 +- gcc/testsuite/g++.dg/modules/internal-3.C | 18 + gcc/testsuite/g++.dg/modules/internal-4_a.H | 4 + gcc/testsuite/g++.dg/modules/internal-4_b.C | 124 +++ gcc/testsuite/g++.dg/modules/internal-5_a.C | 104 +++ gcc/testsuite/g++.dg/modules/internal-5_b.C | 29 + gcc/testsuite/g++.dg/modules/internal-6.C | 24 + gcc/testsuite/g++.dg/modules/internal-7_a.C | 75 ++ gcc/testsuite/g++.dg/modules/internal-7_b.C | 21 + gcc/testsuite/g++.dg/modules/internal-8_a.H | 28 + gcc/testsuite/g++.dg/modules/internal-8_b.C | 29 + gcc/testsuite/g++.dg/modules/linkage-2.C | 5 +- gcc/testsuite/g++.dg/modules/macro-4_c.H | 2 +- gcc/testsuite/g++.dg/modules/pr106761.h | 2 +- gcc/testsuite/g++.dg/modules/pr98843_b.H | 2 +- gcc/testsuite/g++.dg/modules/pr99468.H | 2 +- gcc/testsuite/g++.dg/modules/pragma-1_a.H | 2 +- gcc/testsuite/g++.dg/modules/tpl-ary-1.h | 2 +- .../g++.dg/modules/xtreme-header-8.C | 8 + libcc1/libcp1plugin.cc | 2 +- 37 files changed, 1528 insertions(+), 144 deletions(-) create mode 100644 gcc/testsuite/g++.dg/modules/export-6.C create mode 100644 gcc/testsuite/g++.dg/modules/hdr-2.H create mode 100644 gcc/testsuite/g++.dg/modules/internal-3.C create mode 100644 gcc/testsuite/g++.dg/modules/internal-4_a.H create mode 100644 gcc/testsuite/g++.dg/modules/internal-4_b.C create mode 100644 gcc/testsuite/g++.dg/modules/internal-5_a.C create mode 100644 gcc/testsuite/g++.dg/modules/internal-5_b.C create mode 100644 gcc/testsuite/g++.dg/modules/internal-6.C create mode 100644 gcc/testsuite/g++.dg/modules/internal-7_a.C create mode 100644 gcc/testsuite/g++.dg/modules/internal-7_b.C create mode 100644 gcc/testsuite/g++.dg/modules/internal-8_a.H create mode 100644 gcc/testsuite/g++.dg/modules/internal-8_b.C create mode 100644 gcc/testsuite/g++.dg/modules/xtreme-header-8.C