From 08edf85f747b9ac1850f9688c8a1bc7c2bf6b4e5 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Mon, 4 Mar 2024 21:32:44 -0500 Subject: c++/modules: relax diagnostic about GMF contents Issuing a hard error when the GMF doesn't consist only of preprocessing directives happens to be inconvenient for automated testcase reduction via cvise. This patch relaxes this diagnostic into a pedwarn that can be disabled with -Wno-global-module. gcc/c-family/ChangeLog: * c.opt (Wglobal-module): New warning. gcc/cp/ChangeLog: * parser.cc (cp_parser_translation_unit): Relax GMF contents error into a pedwarn. gcc/ChangeLog: * doc/invoke.texi (-Wno-global-module): Document. gcc/testsuite/ChangeLog: * g++.dg/modules/friend-6_a.C: Pass -Wno-global-module instead of -Wno-pedantic. Remove now unnecessary preprocessing directives from GMF. Reviewed-by: Jason Merrill --- gcc/doc/invoke.texi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gcc/doc/invoke.texi') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index bdf05be..2390d47 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -256,7 +256,7 @@ in the following sections. -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion -Weffc++ -Wno-elaborated-enum-base --Wno-exceptions -Wextra-semi -Wno-inaccessible-base +-Wno-exceptions -Wextra-semi -Wno-global-module -Wno-inaccessible-base -Wno-inherited-variadic-ctor -Wno-init-list-lifetime -Winvalid-constexpr -Winvalid-imported-macros -Wno-invalid-offsetof -Wno-literal-suffix @@ -4774,6 +4774,12 @@ undefined behavior at runtime. This warning is enabled by default. @item -Wextra-semi @r{(C++, Objective-C++ only)} Warn about redundant semicolons after in-class function definitions. +@opindex Wno-global-module +@opindex Wglobal-module +@item -Wno-global-module @r{(C++ and Objective-C++ only)} +Disable the diagnostic for when the global module fragment of a module +unit does not consist only of preprocessor directives. + @opindex Winaccessible-base @opindex Wno-inaccessible-base @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)} -- cgit v1.1