On 10/4/23 03:07, Florian Weimer wrote:
* Jason Merrill:
@@ -6159,6 +6153,18 @@ errors by @option{-pedantic-errors}. For instance:
-Wwrite-strings @r{(C++11 or later)}
}
+@opindex fpermissive
+@item -fpermissive
+Downgrade some required diagnostics about nonconformant code from
+errors to warnings. Thus, using @option{-fpermissive} allows some
+nonconforming code to compile. Some C++ diagnostics are controlled
+only by this flag, but it also downgrades some diagnostics that have
+their own flag:
+
+@gccoptlist{
+-Wnarrowing @r{(C++)}
+}
+
@opindex Wall
@opindex Wno-all
@item -Wall
Does compiling with -Wno-narrowing also accept the obsolete constructs?
The documentation isn't clear about it. The existing test
gcc/testsuite/g++.dg/cpp0x/initlist55.C suggests it's possible. Maybe
add an explicit example to the documentation?
The documentation for -Wnarrowing already says that -Wno-narrowing
suppresses the diagnostic. It seems clear to me that if there's no
error, the construct is accepted?
What about the impact of -w?
As I said in the patch comment, -w by itself has no effect.
-fpermissive -w silences the diagnostic.
As far as the internal API is concerned, will there be a way to query
whether -Wno-narrowing etc. have been specified?
There's warning_enabled_at, but that doesn't account for the different
rules for permerrors, such as the above -w behavior. We could add a
similar function for permerrors, that could also indicate whether the
diagnostic is a warning or error?
More generally there's OPTION_SET_P.
Jason