aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/c.opt4
-rw-r--r--gcc/cp/parser.cc6
-rw-r--r--gcc/doc/invoke.texi8
-rw-r--r--gcc/testsuite/g++.dg/modules/friend-6_a.C4
4 files changed, 15 insertions, 7 deletions
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index b7a4a1a..56cccf2 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -802,6 +802,10 @@ Wframe-address
C ObjC C++ ObjC++ Var(warn_frame_address) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn when __builtin_frame_address or __builtin_return_address is used unsafely.
+Wglobal-module
+C++ ObjC++ Var(warn_global_module) Warning Init(1)
+Warn about the global module fragment not containing only preprocessing directives.
+
Wif-not-aligned
C ObjC C++ ObjC++ Var(warn_if_not_aligned) Init(1) Warning
Warn when the field in a struct is not aligned.
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index a310b9e..e32acfc 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_Wglobal_module,
+ "global module fragment contents must be"
+ " from preprocessor inclusion");
}
}
}
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)}
diff --git a/gcc/testsuite/g++.dg/modules/friend-6_a.C b/gcc/testsuite/g++.dg/modules/friend-6_a.C
index 7493e8f..13f7710 100644
--- a/gcc/testsuite/g++.dg/modules/friend-6_a.C
+++ b/gcc/testsuite/g++.dg/modules/friend-6_a.C
@@ -1,11 +1,9 @@
-// { dg-additional-options "-fmodules-ts -Wno-pedantic" }
+// { dg-additional-options "-fmodules-ts -Wno-global-module" }
// { 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;