In addition to accepting argument values in excess of INT_MAX in
options like -Walloca-larger-than=byte-size, GCC 9 has changed
the behavior of such options with byte-size of zero. While in prior
versions zero disables the warning for any size, in GCC 9 it enables
it for all non-zero sizes. Since all these byte-size options are
enabled by default for sizes in excess of PTRDIFF_MAX, users who
want to disable them need to use the newly added -Wno-xxx options
(such as -Wno-alloca-larger-than).
However, although I documented all of the new options, I only
remembered to add the negative options for the C/C++ family and
forgot about all the common ones, including -Wframe-larger-than=,
-Wlarger-than=, and -Wstack-usage=. As a result, users who want
to disable the default, say -Wstack-usage, cannot use
the -Wno-stack-usage as the manual leads them to do but have to
use the less than intuitive workaround of specifying a very large
argument to the positive option, e.g., something like
-Wstack-usage=999EiB (denoting 999 etabytes).
To avoid this hassle the attached patch provides the three missing
negative options.
Tested on x86_64-linux.
Martin
PR driver/90983 - manual documents `-Wno-stack-usage` flag but it is unrecognized
gcc/ChangeLog:
PR driver/90983
* common.opt (-Wno-frame-larger-than): New option.
(-Wno-larger-than, -Wno-stack-usage): Same.
gcc/testsuite/ChangeLog:
PR driver/90983
* gcc.dg/Wframe-larger-than-3.c: New test.
* gcc.dg/Wlarger-than4.c: New test.
* gcc.dg/Wstack-usage.c: New test.
diff --git a/gcc/common.opt b/gcc/common.opt
index 1e604ba9bb6..d33383b523c 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -601,6 +601,10 @@ Wframe-larger-than=
Common RejectNegative Joined Host_Wide_Int ByteSize Warning Var(warn_frame_larger_than_size) Init(HOST_WIDE_INT_MAX)
-Wframe-larger-than= Warn if a function's stack frame requires in excess of .
+Wno-frame-larger-than
+Common Alias(Wframe-larger-than=,18446744073709551615EiB,none) Warning
+Disable -Wframe-larger-than= warning. Equivalent to -Wframe-larger-than= or larger.
+
Wfree-nonheap-object
Common Var(warn_free_nonheap_object) Init(1) Warning
Warn when attempting to free a non-heap object.
@@ -631,6 +635,10 @@ Wlarger-than=
Common RejectNegative Joined Host_Wide_Int ByteSize Warning Var(warn_larger_than_size) Init(HOST_WIDE_INT_MAX)
-Wlarger-than= Warn if an object's size exceeds .
+Wno-larger-than
+Common Alias(Wlarger-than=,18446744073709551615EiB,none) Warning
+Disable -Wlarger-than= warning. Equivalent to -Wlarger-than= or larger.
+
Wnonnull-compare
Var(warn_nonnull_compare) Warning
Warn if comparing pointer parameter with nonnull attribute with NULL.
@@ -704,6 +712,10 @@ Wstack-usage=
Common Joined RejectNegative Host_Wide_Int ByteSize Var(warn_stack_usage) Warning Init(HOST_WIDE_INT_MAX)
-Wstack-usage= Warn if stack usage might exceed .
+Wno-stack-usage
+Common Alias(Wstack-usage=,18446744073709551615EiB,none) Warning
+Disable Wstack-usage= warning. Equivalent to Wstack-usage= or larger.
+
Wstrict-aliasing
Common Warning
Warn about code which might break strict aliasing rules.
diff --git a/gcc/testsuite/gcc.dg/Wframe-larger-than-3.c b/gcc/testsuite/gcc.dg/Wframe-larger-than-3.c
new file mode 100644
index 000..ae5b2f497c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wframe-larger-than-3.c
@@ -0,0 +1,11 @@
+/* PR 90983/manual documents `-Wno-stack-usage` flag, but it is unrecognized
+ { dg-do compile }
+ { dg-options "-Wall -Wframe-larger-than=123 -Wno-frame-larger-than" } */
+
+void f (void*);
+
+void g (void)
+{
+ char a [1234];
+ f (a);
+}
diff --git a/gcc/testsuite/gcc.dg/Wlarger-than4.c b/gcc/testsuite/gcc.dg/Wlarger-than4.c
new file mode 100644
index 000..dd936c671cd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wlarger-than4.c
@@ -0,0 +1,5 @@
+/* PR 90983/manual documents `-Wno-stack-usage` flag, but it is unrecognized
+ { dg-do compile }
+ { dg-options "-Wall -Wlarger-than=123 -Wno-larger-than" } */
+
+char a [1234];
diff --git a/gcc/testsuite/gcc.dg/Wstack-usage.c b/gcc/testsuite/gcc.dg/Wstack-usage.c
new file mode 100644
index 000..4738b69478b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstack-usage.c
@@ -0,0 +1,14 @@
+/* PR 90983/manual documents `-Wno-stack-usage` flag, but it is unrecognized
+ { dg-do compile }
+ { dg-options "-Wall -Wstack-usage=123 -Wno-stack-usage" } */
+
+void f (void*);
+
+void g (int n)
+{
+ if (n < 1234)
+n = 1234;
+
+ char a [n];
+ f (a);
+}