diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-03-07 12:09:25 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-03-07 12:09:25 +0000 |
commit | c5613db921c87067660b262af379b38a2791e412 (patch) | |
tree | 48519b95a049dd7fe43985c36ef2117628644e47 /Driver | |
parent | 25a30d0c3337a4f7bd1fb585e2becc6736e806fa (diff) | |
download | clang-c5613db921c87067660b262af379b38a2791e412.tar.gz |
Improve error messages on bad warning options.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66334 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver')
-rw-r--r-- | Driver/Warnings.cpp | 12 | ||||
-rw-r--r-- | Driver/clang.cpp | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/Driver/Warnings.cpp b/Driver/Warnings.cpp index eda398be24..8ef1ff57db 100644 --- a/Driver/Warnings.cpp +++ b/Driver/Warnings.cpp @@ -22,8 +22,7 @@ // warn: Emit a message, but don't fail the compilation // error: Emit a message and fail the compilation // -// Clang is parsed warning options. Each warning option controls any number of -// actual warnings. +// Each warning option controls any number of actual warnings. // Given a warning option 'foo', the following are valid: // -Wfoo=ignore -> Ignore the controlled warnings. // -Wfoo=warn -> Warn about the controlled warnings. @@ -87,8 +86,11 @@ namespace { } else { Val.Name = ArgValue.substr(0, Eq); Val.Mapping = StrToMapping(ArgValue.substr(Eq+1)); - if (Val.Mapping == diag::MAP_DEFAULT) + if (Val.Mapping == diag::MAP_DEFAULT) { + fprintf(stderr, "Illegal warning option value: %s\n", + ArgValue.substr(Eq+1).c_str()); return true; + } } return false; } @@ -203,8 +205,10 @@ bool ProcessWarningOptions(Diagnostic &Diags) { OptionTable + OptionTableSize, Key); if (Found == OptionTable + OptionTableSize || - strcmp(Found->Name, Key.Name) != 0) + strcmp(Found->Name, Key.Name) != 0) { + fprintf(stderr, "Unknown warning option: -W%s\n", Key.Name); return true; + } // Option exists. for (size_t i = 0; i < Found->NumMembers; ++i) { diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 53ba7f8f09..adfc8602fd 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -1504,11 +1504,8 @@ int main(int argc, char **argv) { // Configure our handling of diagnostics. llvm::OwningPtr<DiagnosticClient> DiagClient(TextDiagClient); Diagnostic Diags(DiagClient.get()); - if (ProcessWarningOptions(Diags)) { - fprintf(stderr, "Error in warning options.\n"); + if (ProcessWarningOptions(Diags)) return 1; - } - //InitializeDiagnostics(Diags); // -I- is a deprecated GCC feature, scan for it and reject it. for (unsigned i = 0, e = I_dirs.size(); i != e; ++i) { @@ -1527,7 +1524,7 @@ int main(int argc, char **argv) { fprintf(stderr, "Sorry, I don't know what target this is: %s\n", Triple.c_str()); fprintf(stderr, "Please use -triple or -arch.\n"); - exit(1); + return 1; } if (!InheritanceViewCls.empty()) // C++ visualization? |