[cfe-commits] r92019 - in /cfe/trunk: TODO.txt include/clang/Basic/DiagnosticFrontendKinds.td lib/Frontend/Warnings.cpp

Chris Lattner sabre at nondot.org
Wed Dec 23 10:53:37 PST 2009


Author: lattner
Date: Wed Dec 23 12:53:37 2009
New Revision: 92019

URL: http://llvm.org/viewvc/llvm-project?rev=92019&view=rev
Log:
switch -Werror/-Wfatal-errors error conditions to use diagnostics instead
of printf, patch by Christian Adaker!

Modified:
    cfe/trunk/TODO.txt
    cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
    cfe/trunk/lib/Frontend/Warnings.cpp

Modified: cfe/trunk/TODO.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/TODO.txt?rev=92019&r1=92018&r2=92019&view=diff

==============================================================================
--- cfe/trunk/TODO.txt (original)
+++ cfe/trunk/TODO.txt Wed Dec 23 12:53:37 2009
@@ -69,7 +69,6 @@
 //===---------------------------------------------------------------------===//
 
 Options to support:
-   -Wfatal-errors
    -ftabstop=width
    -fpreprocessed mode.
    -nostdinc++

Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=92019&r1=92018&r2=92019&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Wed Dec 23 12:53:37 2009
@@ -219,4 +219,7 @@
 def warn_unknown_warning_option : Warning<
     "unknown warning option '%0'">,
     InGroup<DiagGroup<"unknown-warning-option"> >;
+def warn_unknown_warning_specifier : Warning<
+    "unknown %0 warning specifier: '%1'">,
+    InGroup<DiagGroup<"unknown-warning-option"> >;
 }

Modified: cfe/trunk/lib/Frontend/Warnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Warnings.cpp?rev=92019&r1=92018&r2=92019&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/Warnings.cpp (original)
+++ cfe/trunk/lib/Frontend/Warnings.cpp Wed Dec 23 12:53:37 2009
@@ -13,12 +13,12 @@
 //
 // This file is responsible for handling all warning options. This includes
 // a number of -Wfoo options and their variants, which are driven by TableGen-
-// generated data, and the special cases -pedantic, -pedantic-errors, -w and
-// -Werror.
+// generated data, and the special cases -pedantic, -pedantic-errors, -w,
+// -Werror and -Wfatal-errors.
 //
 // Each warning option controls any number of actual warnings.
 // Given a warning option 'foo', the following are valid:
-//    -Wfoo, -Wno-foo, -Werror=foo
+//    -Wfoo, -Wno-foo, -Werror=foo, -Wfatal-errors=foo
 //
 #include "clang/Frontend/Utils.h"
 #include "clang/Basic/Diagnostic.h"
@@ -26,7 +26,6 @@
 #include "clang/Lex/LexDiagnostic.h"
 #include "clang/Frontend/DiagnosticOptions.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
-#include <cstdio>
 #include <cstring>
 #include <utility>
 #include <algorithm>
@@ -79,8 +78,8 @@
       if (OptEnd-OptStart != 5) {  // Specifier must be present.
         if ((OptStart[5] != '=' && OptStart[5] != '-') ||
             OptEnd-OptStart == 6) {
-          fprintf(stderr, "warning: unknown -Werror warning specifier: -W%s\n",
-                  Opt.c_str());
+          Diags.Report(diag::warn_unknown_warning_specifier)
+            << "-Werror" << ("-W" + Opt);
           continue;
         }
         Specifier = OptStart+6;
@@ -102,9 +101,8 @@
       if (OptEnd-OptStart != 12) {
         if ((OptStart[12] != '=' && OptStart[12] != '-') ||
             OptEnd-OptStart == 13) {
-          fprintf(stderr,
-                  "warning: unknown -Wfatal-errors warning specifier: -W%s\n",
-                  Opt.c_str());
+          Diags.Report(diag::warn_unknown_warning_specifier)
+            << "-Wfatal-errors" << ("-W" + Opt);
           continue;
         }
         Specifier = OptStart + 13;





More information about the cfe-commits mailing list