From fff5ed4b555cacf88939cca920c5e70dbb38f896 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 16 Feb 2010 18:29:31 +0000 Subject: [PATCH] when a diagnostic is an extension and has no other -W flag, indicate that it was enabled with -pedantic so people know why they're getting them: $ printf "int x;" | clang -xc - -pedantic :1:7: warning: no newline at end of file [-pedantic] int x; ^ llvm-svn: 96365 --- clang/lib/Frontend/TextDiagnosticPrinter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clang/lib/Frontend/TextDiagnosticPrinter.cpp b/clang/lib/Frontend/TextDiagnosticPrinter.cpp index 9ec5ffe1c353..3c64332512dc 100644 --- a/clang/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/TextDiagnosticPrinter.cpp @@ -786,12 +786,15 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, llvm::SmallString<100> OutStr; Info.FormatDiagnostic(OutStr); - if (DiagOpts->ShowOptionNames) + if (DiagOpts->ShowOptionNames) { if (const char *Opt = Diagnostic::getWarningOptionForDiag(Info.getID())) { OutStr += " [-W"; OutStr += Opt; OutStr += ']'; + } else if (Diagnostic::isBuiltinExtensionDiag(Info.getID())) { + OutStr += " [-pedantic]"; } + } if (DiagOpts->ShowColors) { // Print warnings, errors and fatal errors in bold, no color