This is an archive of the discontinued LLVM Phabricator instance.

Add new -Wformat warning for invalid type passed to a non-literal format string
Needs ReviewPublic

Authored by rtrieu on Mar 31 2015, 7:50 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Currently, when the format string is a non-literal, the only warning emitted and checked for is the non-literal format string. This patch checks the arguments passed to printf/scanf functions and checks that they are valid for the format string. For instance, warning on user defined types or non-pointers to scanf functions. Additionally, if only one argument is present, warn if it is a va_list. For built-in functions, suggest the proper va_list function to fix it.

Diff Detail

Event Timeline

rtrieu updated this revision to Diff 23026.Mar 31 2015, 7:50 PM
rtrieu retitled this revision from to Add new -Wformat warning for invalid type passed to a non-literal format string.
rtrieu updated this object.
rtrieu edited the test plan for this revision. (Show Details)
rtrieu added a subscriber: Unknown Object (MLST).