Open Quuxplusone opened 6 years ago
The reason this happens is that basename is a macro defined in a system header,
and the extra printf argument diagnostic is suppressed if the expression
contains a system macro:
f883b21a961 lib/Sema/SemaChecking.cpp (Andy Gibbs 2016-02-26
15:35:16 +0000 5514) if (S.getSourceManager().isInSystemMacro(Loc))
f883b21a961 lib/Sema/SemaChecking.cpp (Andy Gibbs 2016-02-26
15:35:16 +0000 5515) return;
The check for system macros was added in this commit: https://github.com/llvm-mirror/clang/commit/c03f2df2a2b
It was intended as a work-around to suppress the diagnostic for NSAssert macros defined in the OS X 10.7 system headers. I think it's time to revisit, since the current OS X headers seem to be disabling the warning:
GCC currently emits the warning, so I don't expect a lot of code to break if clang went back to the same behavior.
Attached 0001-Sema-Re-enable-Wformat-extra-args-even-when-system-m.patch
(1483 bytes, text/plain): patch
Attached the obvious patch, in case maintainers agree with my analysis
(but feel free to propose a different fix, of course).
Please be aware that comments posted to bugzilla after a bug is filed do not trigger notifications to anyone not on the CC list (and even the llvm-bugs@ list doesn't get mail for added comments). Patches should be sent to cfe-commits@lists.llvm.org or to the phabricator instance at reviews.llvm.org so that someone sees them :)
(Your patch will also need a test.)
0001-Sema-Re-enable-Wformat-extra-args-even-when-system-m.patch
(1483 bytes, text/plain)