<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Nov 11, 2013, at 11:44 AM, Rafael Espíndola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">This broke Driver/clang_f_opts.c on darwin at least.<br></blockquote><div><br></div><pre style="font-family: 'Courier New', courier, monotype, monospace; font-size: medium;"><span class="stdout">Failing Tests (3):
      Clang :: Driver/clang_f_opts.c
      Clang :: Driver/invalid-o-level.c
      Clang :: Misc/warning-flags.c</span></pre><div><br></div><div><br></div><div>On windows above 3 tests fail.</div><div><br></div><div>- Fariborz</div><div><br></div><blockquote type="cite"><br><br><br>On 11 November 2013 14:01, Sylvestre Ledru <<a href="mailto:sylvestre@debian.org">sylvestre@debian.org</a>> wrote:<br><blockquote type="cite">Author: sylvestre<br>Date: Mon Nov 11 13:01:05 2013<br>New Revision: 194403<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=194403&view=rev">http://llvm.org/viewvc/llvm-project?rev=194403&view=rev</a><br>Log:<br>Using an invalid -O falls back on -O3 instead of an error<br><br>Summary:<br>Currently with clang:<br>$ clang -O20 foo.c<br>error: invalid value '20' in '-O20'<br><br>With the patch:<br>$ clang -O20 foo.c<br>warning: invalid value '20' in '-O20'. Fall back on value '3'<br><br>Reviewers: rengolin, hfinkel<br><br>Reviewed By: rengolin<br><br>CC: cfe-commits, hfinkel, rengolin<br><br>Differential Revision: <a href="http://llvm-reviews.chandlerc.com/D2125">http://llvm-reviews.chandlerc.com/D2125</a><br><br>Modified:<br>    cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td<br>    cfe/trunk/lib/Driver/Tools.cpp<br>    cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>    cfe/trunk/test/Driver/clang_f_opts.c<br><br>Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=194403&r1=194402&r2=194403&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=194403&r1=194402&r2=194403&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)<br>+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Mon Nov 11 13:01:05 2013<br>@@ -113,6 +113,7 @@ def err_drv_unknown_toolchain : Error<<br>   "cannot recognize the type of the toolchain">;<br><br> def warn_O4_is_O3 : Warning<"-O4 is equivalent to -O3">, InGroup<Deprecated>;<br>+def warn_drv_invalid_value : Warning<"optimization level '%0' is unsupported; using '%1%2' instead.">;<br> def warn_c_kext : Warning<<br>   "ignoring -fapple-kext which is valid for C++ and Objective-C++ only">;<br> def warn_drv_input_file_unused : Warning<<br><br>Modified: cfe/trunk/lib/Driver/Tools.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=194403&r1=194402&r2=194403&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=194403&r1=194402&r2=194403&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Driver/Tools.cpp (original)<br>+++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 11 13:01:05 2013<br>@@ -2727,7 +2727,7 @@ void Clang::ConstructJob(Compilation &C,<br>   // preprocessed inputs and configure concludes that -fPIC is not supported.<br>   Args.ClaimAllArgs(options::OPT_D);<br><br>-  // Manually translate -O4 to -O3; let clang reject others.<br>+  // Manually translate -O4 to -O3; let clang fall back on -O3 for others<br>   if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {<br>     if (A->getOption().matches(options::OPT_O4)) {<br>       CmdArgs.push_back("-O3");<br><br>Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=194403&r1=194402&r2=194403&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=194403&r1=194402&r2=194403&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)<br>+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Nov 11 13:01:05 2013<br>@@ -299,14 +299,14 @@ static bool ParseCodeGenArgs(CodeGenOpti<br>   using namespace options;<br>   bool Success = true;<br><br>-  unsigned OptLevel = getOptimizationLevel(Args, IK, Diags);<br>-  if (OptLevel > 3) {<br>-    Diags.Report(diag::err_drv_invalid_value)<br>-      << Args.getLastArg(OPT_O)->getAsString(Args) << OptLevel;<br>-    OptLevel = 3;<br>-    Success = false;<br>+  Opts.OptimizationLevel = getOptimizationLevel(Args, IK, Diags);<br>+  unsigned MaxOptLevel = 3;<br>+  if (Opts.OptimizationLevel > MaxOptLevel) {<br>+    // If the optimization level is not supported, fall back on the default optimization<br>+    Diags.Report(diag::warn_drv_invalid_value)<br>+        << Args.getLastArg(OPT_O)->getAsString(Args) << "-O" << MaxOptLevel;<br>+    Opts.OptimizationLevel = MaxOptLevel;<br>   }<br>-  Opts.OptimizationLevel = OptLevel;<br><br>   // We must always run at least the always inlining pass.<br>   Opts.setInlining(<br><br>Modified: cfe/trunk/test/Driver/clang_f_opts.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=194403&r1=194402&r2=194403&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=194403&r1=194402&r2=194403&view=diff</a><br>==============================================================================<br>--- cfe/trunk/test/Driver/clang_f_opts.c (original)<br>+++ cfe/trunk/test/Driver/clang_f_opts.c Mon Nov 11 13:01:05 2013<br>@@ -100,6 +100,9 @@<br> // CHECK-MAX-O: warning: -O4 is equivalent to -O3<br> // CHECK-MAX-O: -O3<br><br>+// RUN: %clang -### -S -O20 %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-O %s<br>+// CHECK-INVALID-O: warning: optimization level '-O20' is unsupported; using '-O3' instead.<br>+<br> // Test that we don't error on these.<br> // RUN: %clang -### -S -Werror                                                \<br> // RUN:     -falign-functions -falign-functions=2 -fno-align-functions        \<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits<br></blockquote>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits<br></blockquote></div><br></body></html>