aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/Warnings.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-23 18:53:37 +0000
committerChris Lattner <sabre@nondot.org>2009-12-23 18:53:37 +0000
commita3b089e062133bdc0e5c39ea03f8b78230953f6c (patch)
tree3939ca02a49a1bdb75cd381b3163bc98a484034f /lib/Frontend/Warnings.cpp
parent29f89f6be93b2f5c7a2b43877cf2555d03aa92a6 (diff)
switch -Werror/-Wfatal-errors error conditions to use diagnostics instead
of printf, patch by Christian Adaker! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92019 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/Warnings.cpp')
-rw-r--r--lib/Frontend/Warnings.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/Frontend/Warnings.cpp b/lib/Frontend/Warnings.cpp
index 4d12bcf7e0..4bf507d48d 100644
--- a/lib/Frontend/Warnings.cpp
+++ b/lib/Frontend/Warnings.cpp
@@ -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 @@ bool clang::ProcessWarningOptions(Diagnostic &Diags,
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 @@ bool clang::ProcessWarningOptions(Diagnostic &Diags,
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;