r231242 - Move one more diagnostic into the new -Wformat-pedantic group.
Daniel Jasper
djasper at google.com
Wed Mar 4 06:18:21 PST 2015
Author: djasper
Date: Wed Mar 4 08:18:20 2015
New Revision: 231242
URL: http://llvm.org/viewvc/llvm-project?rev=231242&view=rev
Log:
Move one more diagnostic into the new -Wformat-pedantic group.
This was apparently overlooked in r231211.
Added:
cfe/trunk/test/SemaCXX/format-strings-0x-nopedantic.cpp
Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=231242&r1=231241&r2=231242&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Mar 4 08:18:20 2015
@@ -3768,16 +3768,18 @@ CheckPrintfHandler::checkFormatExpr(cons
CharSourceRange SpecRange = getSpecifierRange(StartSpecifier, SpecifierLen);
if (IntendedTy == ExprTy && !ShouldNotPrintDirectly) {
+ unsigned diag = diag::warn_format_conversion_argument_type_mismatch;
+ if (match == analyze_format_string::ArgType::NoMatchPedantic) {
+ diag = diag::warn_format_conversion_argument_type_mismatch_pedantic;
+ }
// In this case, the specifier is wrong and should be changed to match
// the argument.
- EmitFormatDiagnostic(
- S.PDiag(diag::warn_format_conversion_argument_type_mismatch)
- << AT.getRepresentativeTypeName(S.Context) << IntendedTy << IsEnum
- << E->getSourceRange(),
- E->getLocStart(),
- /*IsStringLocation*/false,
- SpecRange,
- FixItHint::CreateReplacement(SpecRange, os.str()));
+ EmitFormatDiagnostic(S.PDiag(diag)
+ << AT.getRepresentativeTypeName(S.Context)
+ << IntendedTy << IsEnum << E->getSourceRange(),
+ E->getLocStart(),
+ /*IsStringLocation*/ false, SpecRange,
+ FixItHint::CreateReplacement(SpecRange, os.str()));
} else {
// The canonical type for formatting this value is different from the
Added: cfe/trunk/test/SemaCXX/format-strings-0x-nopedantic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/format-strings-0x-nopedantic.cpp?rev=231242&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/format-strings-0x-nopedantic.cpp (added)
+++ cfe/trunk/test/SemaCXX/format-strings-0x-nopedantic.cpp Wed Mar 4 08:18:20 2015
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wformat -std=c++11 %s
+// expected-no-diagnostics
+extern "C" {
+extern int scanf(const char *restrict, ...);
+extern int printf(const char *restrict, ...);
+}
+
+void f(char *c) {
+ printf("%p", c);
+}
More information about the cfe-commits
mailing list