[PATCH] Add new -Wformat warning for invalid type passed to a non-literal format string

Richard Trieu rtrieu at google.com
Tue Mar 31 19:50:44 PDT 2015


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.

http://reviews.llvm.org/D8757

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Sema/SemaChecking.cpp
  test/SemaCXX/format-strings-invalid-args.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8757.23026.patch
Type: text/x-patch
Size: 14757 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150401/5913e383/attachment.bin>


More information about the cfe-commits mailing list