]> granicus.if.org Git - clang/commitdiff
For warnings like this:
authorChris Lattner <sabre@nondot.org>
Sun, 26 Aug 2007 17:38:22 +0000 (17:38 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 26 Aug 2007 17:38:22 +0000 (17:38 +0000)
t.c:3:9: warning: invalid conversion '%B'
printf("%B\a\n", p);
~~~~~~  ^

Don't beep the console or print the newline.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41453 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaChecking.cpp

index cc682af99f070e99534019e997db105c64310119..d5445a17eea0c6d95bfd3b1730c7202406737d75 100644 (file)
@@ -365,7 +365,8 @@ Sema::CheckPrintfArguments(Expr *Fn,
                                  LastConversionIdx+1);
     
     Diag(Loc, diag::warn_printf_invalid_conversion,
-         std::string(Str+LastConversionIdx, Str+StrIdx),
+         std::string(Str+LastConversionIdx,
+                     Str+std::min(LastConversionIdx+2, StrLen)),
          Fn->getSourceRange());
     return;
   }