r212805 - GCC compatibility: Create a Group to ignore unsupported optimization.

Alp Toker alp at nuanti.com
Sat Jul 12 00:40:41 PDT 2014


On 11/07/2014 14:43, Sylvestre Ledru wrote:
>   
> +def warn_ignored_gcc_optimization : Warning<"ignoring unsupported optimization flag '%0'">,
> +  InGroup<UnusedCommandLineArgument>;
>   def warn_O4_is_O3 : Warning<"-O4 is equivalent to -O3">, InGroup<Deprecated>;
>   def warn_drv_optimization_value : Warning<"optimization level '%0' is unsupported; using '%1%2' instead">,
>     InGroup<InvalidCommandLineArgument>;

Hi Sylvestre,

Logically InvalidCommandLineArgument looks like it'd be slightly more 
suitable than UnusedCommandLineArgument as the group here.

Moving it there will let people turn on 
-Werror=invalid-command-line-argument to get basically the stricter 
behaviour we previously had, or disable with 
-Wno-invalid-command-line-argument if they don't mind silencing 
optimization warnings but still want to keep legitimate unused argument 
warnings. And it aligns well with the existing warn_drv_optimization_value.

Patch attached, does this look OK to you?

Alp.


-- 
http://www.nuanti.com
the browser experts

-------------- next part --------------
diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td
index e67c352..e7d2449 100644
--- a/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/include/clang/Basic/DiagnosticDriverKinds.td
@@ -120,7 +120,7 @@ def err_drv_optimization_remark_pattern : Error<
   "%0 in '%1'">;
 
 def warn_ignored_gcc_optimization : Warning<"ignoring unsupported optimization flag '%0'">,
-  InGroup<UnusedCommandLineArgument>;
+  InGroup<InvalidCommandLineArgument>;
 def warn_O4_is_O3 : Warning<"-O4 is equivalent to -O3">, InGroup<Deprecated>;
 def warn_drv_optimization_value : Warning<"optimization level '%0' is unsupported; using '%1%2' instead">,
   InGroup<InvalidCommandLineArgument>;
diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c
index f31e9e2..598e76b 100644
--- a/test/Driver/clang_f_opts.c
+++ b/test/Driver/clang_f_opts.c
@@ -176,9 +176,9 @@
 // CHECK-WARNING2: ignoring unsupported optimization flag '-finline-limit'
 
 // Test that we mute the warning on these
-// RUN: %clang -### -finline-limit=1000 -Wno-unused-command-line-argument               \
+// RUN: %clang -### -finline-limit=1000 -Wno-invalid-command-line-argument              \
 // RUN:     %s 2>&1 | FileCheck --check-prefix=CHECK-NO-WARNING1 %s
-// RUN: %clang -### -finline-limit -Wno-unused-command-line-argument                    \
+// RUN: %clang -### -finline-limit -Wno-invalid-command-line-argument                   \
 // RUN:     %s 2>&1 | FileCheck --check-prefix=CHECK-NO-WARNING2 %s
 // CHECK-NO-WARNING1-NOT: ignoring unsupported optimization flag '-finline-limit=1000'
 // CHECK-NO-WARNING2-NOT: ignoring unsupported optimization flag '-finline-limit'


More information about the cfe-commits mailing list