The format-security warning is a special case of format-nonliteral that applies when there are no arguments besides the format string. In those cases, for printf and NSLog-style functions, there is an easy fix to provide a literal format string of "%s" (or @"%@" for Objective-C), with the nonliteral string as the argument. This patch teaches clang to provide fix-its for those cases.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
What about wprintf? Do we currently warn for wprintf(str)? If so, then the fixit probably needs to involve L"%ls".
Comment Actions
Darwin does not mark wprintf functions with an attribute. Linux (at least the version I checked) has an attribute that is commented out, but it uses a distinct "wprintf" format type. Clang does not currently support that format type. If that is added in the future, you are right that the fix-it will need to be different.
Comment Actions
LGTM. I don't have a lot of authority over this code, so you may want to get a separate LGTM from someone else.