diff options
author | Alp Toker <alp@nuanti.com> | 2013-11-15 20:40:58 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2013-11-15 20:40:58 +0000 |
commit | 7874bdc6c1429b11cbb6d7e38e884f25264260fb (patch) | |
tree | 4e5c0bebd77e3af1bdc6106695e2aa6e11380551 /clang | |
parent | 15ba1e20db232854a65f6b385a0368151596051f (diff) | |
download | bcm5719-llvm-7874bdc6c1429b11cbb6d7e38e884f25264260fb.tar.gz bcm5719-llvm-7874bdc6c1429b11cbb6d7e38e884f25264260fb.zip |
Revert "Using an invalid -O falls back on -O3 instead of an error"
Trying to fix test failures since earlier today.
One of the tests added in this commit is outputting test/Driver/clang_f_opts.s
which the builders that build in-tree (eg. clang-native-arm-cortex-a9) are
trying to run as a test case, causing failures.
clang_f_opts.c:
If -### doesn't emit the warning then this test probably shouldn't be in
here in the first place. Frontend maybe?
invalid-o-level.c:
Running %clang_cc1 in the Driver tests doesn't make sense because -cc1
bypasses the driver. (I'm not reverting the commit that introduced this but
please fix instead of keeping it this way.)
Reverting to fix the build failures and also so that the tests can be thought
out more thoroughly.
This reverts commit r194817.
llvm-svn: 194845
Diffstat (limited to 'clang')
-rw-r--r-- | clang/docs/ReleaseNotes.rst | 3 | ||||
-rw-r--r-- | clang/include/clang/Basic/DiagnosticDriverKinds.td | 2 | ||||
-rw-r--r-- | clang/include/clang/Basic/DiagnosticGroups.td | 1 | ||||
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 14 | ||||
-rw-r--r-- | clang/test/Driver/clang_f_opts.c | 3 | ||||
-rw-r--r-- | clang/test/Driver/invalid-o-level.c | 6 |
7 files changed, 11 insertions, 20 deletions
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 597d48142f0..7d63744bdf9 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -77,8 +77,7 @@ New Compiler Flags - Clang no longer special cases -O4 to enable lto. Explicitly pass -flto to enable it. -- Clang no longer fails on >= -O5. Uses -O3 instead. -- Command line "clang -O3 -flto a.c -c" and "clang -emit-llvm a.c -c" +- Command line "clang -O3 -flto a.c -c" and "clang -emit-llvm a.c -c" are no longer equivalent. - Clang now errors on unknown -m flags (``-munknown-to-clang``), unknown -f flags (``-funknown-to-clang``) and unknown diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index ee87353bdaa..ed49006b215 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -113,8 +113,6 @@ def err_drv_unknown_toolchain : Error< "cannot recognize the type of the toolchain">; 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>; def warn_c_kext : Warning< "ignoring -fapple-kext which is valid for C++ and Objective-C++ only">; def warn_drv_input_file_unused : Warning< diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index b02bf92e76c..bf527ce5034 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -344,7 +344,6 @@ def UnusedArgument : DiagGroup<"unused-argument">; def UnusedSanitizeArgument : DiagGroup<"unused-sanitize-argument">; def UnusedCommandLineArgument : DiagGroup<"unused-command-line-argument", [UnusedSanitizeArgument]>; -def InvalidCommandLineArgument : DiagGroup<"invalid-command-line-argument">; def UnusedComparison : DiagGroup<"unused-comparison">; def UnusedExceptionParameter : DiagGroup<"unused-exception-parameter">; def UnneededInternalDecl : DiagGroup<"unneeded-internal-declaration">; diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index f43694de1cb..ceef90f171c 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -2760,7 +2760,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // preprocessed inputs and configure concludes that -fPIC is not supported. Args.ClaimAllArgs(options::OPT_D); - // Manually translate -O4 to -O3; let clang fall back on -O3 for others + // Manually translate -O4 to -O3; let clang reject others. if (Arg *A = Args.getLastArg(options::OPT_O_Group)) { if (A->getOption().matches(options::OPT_O4)) { CmdArgs.push_back("-O3"); diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index f5079dd2a46..581d56d4621 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -299,14 +299,14 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, using namespace options; bool Success = true; - Opts.OptimizationLevel = getOptimizationLevel(Args, IK, Diags); - unsigned MaxOptLevel = 3; - if (Opts.OptimizationLevel > MaxOptLevel) { - // If the optimization level is not supported, fall back on the default optimization - Diags.Report(diag::warn_drv_optimization_value) - << Args.getLastArg(OPT_O)->getAsString(Args) << "-O" << MaxOptLevel; - Opts.OptimizationLevel = MaxOptLevel; + unsigned OptLevel = getOptimizationLevel(Args, IK, Diags); + if (OptLevel > 3) { + Diags.Report(diag::err_drv_invalid_value) + << Args.getLastArg(OPT_O)->getAsString(Args) << OptLevel; + OptLevel = 3; + Success = false; } + Opts.OptimizationLevel = OptLevel; // We must always run at least the always inlining pass. Opts.setInlining( diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c index a1c1b50d30e..a443bba5472 100644 --- a/clang/test/Driver/clang_f_opts.c +++ b/clang/test/Driver/clang_f_opts.c @@ -103,9 +103,6 @@ // CHECK-MAX-O: warning: -O4 is equivalent to -O3 // CHECK-MAX-O: -O3 -// RUN: %clang -S -O20 %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-O %s -// CHECK-INVALID-O: warning: optimization level '-O20' is unsupported; using '-O3' instead. - // Test that we don't error on these. // RUN: %clang -### -S -Werror \ // RUN: -falign-functions -falign-functions=2 -fno-align-functions \ diff --git a/clang/test/Driver/invalid-o-level.c b/clang/test/Driver/invalid-o-level.c index 7d877418e24..d5242c7ac06 100644 --- a/clang/test/Driver/invalid-o-level.c +++ b/clang/test/Driver/invalid-o-level.c @@ -1,6 +1,4 @@ -// RUN: %clang_cc1 %s -O900 2> %t.log +// RUN: not %clang_cc1 %s -O900 2> %t.log // RUN: FileCheck %s -input-file=%t.log -// CHECK: warning: optimization level '-O900' is unsupported; using '-O3' instead. - - +// CHECK: invalid value '900' in '-O900' |