diff options
author | Bob Wilson <bob.wilson@apple.com> | 2012-05-03 19:47:19 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2012-05-03 19:47:19 +0000 |
commit | 23cd434202b5ca2ffca15e20131be4462063ae00 (patch) | |
tree | 0623a649db8e989fb79366991ea96ab0fc8447a1 /clang/lib/Sema/SemaChecking.cpp | |
parent | 29a8eebc94e1695c503d90f391f3bd46d91a4ee5 (diff) | |
download | bcm5719-llvm-23cd434202b5ca2ffca15e20131be4462063ae00.tar.gz bcm5719-llvm-23cd434202b5ca2ffca15e20131be4462063ae00.zip |
Disable -Wformat-extra-args for arguments defined in system headers.
Some of the NSAssert macros in OS X 10.7 are implemented in a way that
adds extra arguments that trigger the -Wformat-extra-args warning.
Earlier versions of clang failed to detect those -Wformat issues, but now
that clang is reporting those problems, we need to quiet them since there's
nothing to be done to fix them. <rdar://problem/11317765>
I don't know how to write a testcase for this. Suggestions welcome.
Patch by Ted Kremenek!
llvm-svn: 156092
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 002c985e0c5..dad08274882 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -1975,9 +1975,12 @@ void CheckFormatHandler::DoneProcessing() { signed notCoveredArg = CoveredArgs.find_first(); if (notCoveredArg >= 0) { assert((unsigned)notCoveredArg < NumDataArgs); - EmitFormatDiagnostic(S.PDiag(diag::warn_printf_data_arg_not_used), - getDataArg((unsigned) notCoveredArg)->getLocStart(), - /*IsStringLocation*/false, getFormatStringRange()); + SourceLocation Loc = getDataArg((unsigned) notCoveredArg)->getLocStart(); + if (!S.getSourceManager().isInSystemMacro(Loc)) { + EmitFormatDiagnostic(S.PDiag(diag::warn_printf_data_arg_not_used), + Loc, + /*IsStringLocation*/false, getFormatStringRange()); + } } } } |