public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] c++/modules: relax diagnostic about GMF contents
@ 2024-02-15 21:10 Patrick Palka
  2024-02-15 21:21 ` Jason Merrill
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick Palka @ 2024-02-15 21:10 UTC (permalink / raw)
  To: gcc-patches; +Cc: jason, nathan, Patrick Palka

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");
 		}
 	    }
 	}
diff --git a/gcc/testsuite/g++.dg/modules/friend-6_a.C b/gcc/testsuite/g++.dg/modules/friend-6_a.C
index 7493e8f262f..c7868556a3e 100644
--- a/gcc/testsuite/g++.dg/modules/friend-6_a.C
+++ b/gcc/testsuite/g++.dg/modules/friend-6_a.C
@@ -2,10 +2,8 @@
 // { dg-module-cmi friend_6 }
 
 module;
-# 1 "" 1
 template <typename> struct Trans_NS___cxx11_basic_string {
   template <typename> friend class basic_stringbuf;
 };
 template struct Trans_NS___cxx11_basic_string<char>;
-# 6 "" 2
 export module friend_6;
-- 
2.44.0.rc1.15.g4fc51f00ef


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-01 19:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-15 21:10 [PATCH] c++/modules: relax diagnostic about GMF contents Patrick Palka
2024-02-15 21:21 ` Jason Merrill
2024-02-15 21:51   ` Patrick Palka
2024-02-27 17:56     ` Patrick Palka
2024-03-01 19:11     ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).