[cfe-commits] [PATCH] Emit error for unknown warning options

Eli Friedman eli.friedman at gmail.com
Tue May 10 21:29:07 PDT 2011


See PR9701.  Essentially, the issue is that if we don't emit an error
for unknown warning options, there isn't any supported way for
configure scripts to check whether clang supports a given warning
option, which leads to a bunch of useless warnings about unknown
warning options.  Given that gcc emits an error for unknown warning
options,  and we've at least stubbed out all the common warning
options, I think changing the default behavior like this makes sense.

-Eli
-------------- next part --------------
Index: test/Driver/cc-log-diagnostics.c
===================================================================
--- test/Driver/cc-log-diagnostics.c	(revision 131176)
+++ test/Driver/cc-log-diagnostics.c	(working copy)
@@ -1,7 +1,7 @@
 // RUN: rm -f %t.log
 // RUN: env RC_DEBUG_OPTIONS=1 \
 // RUN:     CC_LOG_DIAGNOSTICS=1 CC_LOG_DIAGNOSTICS_FILE=%t.log \
-// RUN: %clang -Wfoobar -no-canonical-prefixes -ccc-host-triple x86_64-apple-darwin10 -fsyntax-only %s
+// RUN: %clang -Wno-error=unknown-warning-option -Wfoobar -no-canonical-prefixes -ccc-host-triple x86_64-apple-darwin10 -fsyntax-only %s
 // RUN: FileCheck %s < %t.log
 
 int f0() {}
Index: include/clang/Basic/DiagnosticFrontendKinds.td
===================================================================
--- include/clang/Basic/DiagnosticFrontendKinds.td	(revision 131176)
+++ include/clang/Basic/DiagnosticFrontendKinds.td	(working copy)
@@ -280,10 +280,10 @@
     "'%0' does not appear to be a precompiled header file">, DefaultFatal;
 def warn_unknown_warning_option : Warning<
     "unknown warning option '%0'">,
-    InGroup<DiagGroup<"unknown-warning-option"> >;
+    InGroup<DiagGroup<"unknown-warning-option"> >, DefaultError;
 def warn_unknown_warning_specifier : Warning<
     "unknown %0 warning specifier: '%1'">,
-    InGroup<DiagGroup<"unknown-warning-option"> >;
+    InGroup<DiagGroup<"unknown-warning-option"> >, DefaultError;
 
 def warn_unkwown_analyzer_checker : Warning<
     "no analyzer checkers are associated with '%0'">;


More information about the cfe-commits mailing list