On 2/15/24 16:10, Patrick Palka wrote:
Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look
OK for trunk?
-- >8 --
Issuing a hard error when the GMF doesn't contain preprocessing
directives is inconvenient for automated testcase reduction via cvise.
This patch relaxes this diagnostic into a pedwarn.
gcc/cp/ChangeLog:
* parser.cc (cp_parser_translation_unit): Relax GMF contents
error into a pedwarn.
gcc/testsuite/ChangeLog:
* g++.dg/modules/friend-6_a.C: Remove now unnecessary
preprocessing directives from GMF.
---
gcc/cp/parser.cc | 6 +++---
gcc/testsuite/g++.dg/modules/friend-6_a.C | 2 --
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 9d0914435fb..e60f0425035 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -5253,9 +5253,9 @@ cp_parser_translation_unit (cp_parser* parser)
if (!warned)
{
warned = true;
- error_at (token->location,
- "global module fragment contents must be"
- " from preprocessor inclusion");
+ pedwarn (token->location, OPT_Wpedantic,
+ "global module fragment contents must be"
+ " from preprocessor inclusion");
Relaxing to pedwarn is fine, but I think it should be on by default, not
just with -pedantic. So it should get a new option.
Jason