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 -- 2.46.0