PR c/89524 - Ignore -Wno-error=<some-future-warning>

Message ID 20190301041525.2289-1-alexhenrie24@gmail.com
State New
Headers show
Series
  • PR c/89524 - Ignore -Wno-error=<some-future-warning>
Related show

Commit Message

Alex Henrie March 1, 2019, 4:15 a.m.
* opts.c: Ignore -Wno-error=<some-future-warning>.
---
 gcc/opts.c                           | 5 ++++-
 gcc/testsuite/c-c++-common/pr89524.c | 7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/c-c++-common/pr89524.c

-- 
2.21.0

Comments

Joseph Myers March 1, 2019, 10:17 p.m. | #1
On Thu, 28 Feb 2019, Alex Henrie wrote:

> * opts.c: Ignore -Wno-error=<some-future-warning>.


I'd expect this to follow the same logic as how -Wno-<some-future-warning> 
is ignored (see the comment on postpone_unknown_option_warning).  That is, 
the option would still be diagnosed if there is some error message that 
might have been turned into a warning by the -Wno-error= option with a 
newer compiler.

-- 
Joseph S. Myers
joseph@codesourcery.com

Patch

diff --git a/gcc/opts.c b/gcc/opts.c
index 468abb16334..f9a490cc7c2 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -3079,7 +3079,10 @@  enable_warning_as_error (const char *arg, int value, unsigned int lang_mask,
   strcpy (new_option + 1, arg);
   option_index = find_opt (new_option, lang_mask);
   if (option_index == OPT_SPECIAL_unknown)
-    error_at (loc, "-Werror=%s: no option -%s", arg, new_option);
+    {
+      if (value)
+	error_at (loc, "-Werror=%s: no option -%s", arg, new_option);
+    }
   else if (!(cl_options[option_index].flags & CL_WARNING))
     error_at (loc, "-Werror=%s: -%s is not an option that controls warnings",
 	      arg, new_option);
diff --git a/gcc/testsuite/c-c++-common/pr89524.c b/gcc/testsuite/c-c++-common/pr89524.c
new file mode 100644
index 00000000000..71bf745f57d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr89524.c
@@ -0,0 +1,7 @@ 
+/* PR c/89524 */
+/* { dg-options "-Werror -Wno-error=some-future-warning" } */
+
+int main(int argc, char **argv)
+{
+  return 0;
+}