r212670 - Prevent link warnings due to -Wframe-larger-than=

Alp Toker alp at nuanti.com
Wed Jul 9 19:13:29 PDT 2014

Author: alp
Date: Wed Jul  9 21:13:29 2014
New Revision: 212670

URL: http://llvm.org/viewvc/llvm-project?rev=212670&view=rev
Prevent link warnings due to -Wframe-larger-than=

Although this is nominally a -W option, we actually handle it in the driver
exactly as an f-group flag that's translated directly to -mllvm.

That means f_Group (and unintuitively, not W_Group) has the semantics we want
to make it behave like a standard warning flag: no automatic forwarding, no
warning for link invocations and compile-only.

Silences diagnostics like:

  [691/1545] Linking CXX executable bin/llvm-diff
  clang-3.5: warning: argument unused during compilation: '-Wframe-larger-than=2048'

(Hopefully we can move towards handling these in the frontend but that'll
require some infrastructure work.)


Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=212670&r1=212669&r2=212670&view=diff
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Jul  9 21:13:29 2014
@@ -862,10 +862,11 @@ def Wlarge_by_value_copy_def : Flag<["-"
            "in bytes than a given value">, Flags<[HelpHidden]>;
 def Wlarge_by_value_copy_EQ : Joined<["-"], "Wlarge-by-value-copy=">, Flags<[CC1Option]>;
+// These "special" warning flags are effectively processed as f_Group flags by the driver:
 // Just silence warnings about -Wlarger-than for now.
 def Wlarger_than_EQ : Joined<["-"], "Wlarger-than=">, Group<clang_ignored_f_Group>;
 def Wlarger_than_ : Joined<["-"], "Wlarger-than-">, Alias<Wlarger_than_EQ>;
-def Wframe_larger_than_EQ : Joined<["-"], "Wframe-larger-than=">, Flags<[DriverOption]>;
+def Wframe_larger_than_EQ : Joined<["-"], "Wframe-larger-than=">, Group<f_Group>, Flags<[DriverOption]>;
 def : Flag<["-"], "fterminated-vtables">, Alias<fapple_kext>;
 def fthreadsafe_statics : Flag<["-"], "fthreadsafe-statics">, Group<f_Group>;

Modified: cfe/trunk/test/Misc/backend-stack-frame-diagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/backend-stack-frame-diagnostics.cpp?rev=212670&r1=212669&r2=212670&view=diff
--- cfe/trunk/test/Misc/backend-stack-frame-diagnostics.cpp (original)
+++ cfe/trunk/test/Misc/backend-stack-frame-diagnostics.cpp Wed Jul  9 21:13:29 2014
@@ -6,6 +6,10 @@
 //  * The driver passes the option through to the backend.
 //  * The frontend diagnostic handler 'demangles' and resolves the correct function definition.
+// Test that link invocations don't emit an "argument unused during compilation" diagnostic.
+// RUN: touch %t.o
+// RUN: %clang -Werror -Wframe-larger-than=0 %t.o -###  2>&1 | not grep ' error: '
 // TODO: Support rich backend diagnostics for Objective-C methods.
 // Backend diagnostics aren't suppressed in system headers because such results

More information about the cfe-commits mailing list