[cfe-commits] r66334 - in /cfe/trunk/Driver: Warnings.cpp clang.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Sat Mar 7 04:09:32 PST 2009


Author: cornedbee
Date: Sat Mar  7 06:09:25 2009
New Revision: 66334

URL: http://llvm.org/viewvc/llvm-project?rev=66334&view=rev
Log:
Improve error messages on bad warning options.

Modified:
    cfe/trunk/Driver/Warnings.cpp
    cfe/trunk/Driver/clang.cpp

Modified: cfe/trunk/Driver/Warnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/Warnings.cpp?rev=66334&r1=66333&r2=66334&view=diff

==============================================================================
--- cfe/trunk/Driver/Warnings.cpp (original)
+++ cfe/trunk/Driver/Warnings.cpp Sat Mar  7 06:09:25 2009
@@ -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 @@
       } 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 @@
                                                   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) {

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=66334&r1=66333&r2=66334&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Sat Mar  7 06:09:25 2009
@@ -1504,11 +1504,8 @@
   // 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 @@
     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?





More information about the cfe-commits mailing list