]> granicus.if.org Git - clang/commit
Modified format-string checking to not emit a warning when all of the
authorTed Kremenek <kremenek@apple.com>
Mon, 17 Dec 2007 19:03:13 +0000 (19:03 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 17 Dec 2007 19:03:13 +0000 (19:03 +0000)
commit4a33646560c4faf8fb82a681360eb2dc0573d558
tree7bffe6120ece1ff1e67399232b36df4614509e49
parentba8326517548d1d7773c4040aef4a4d91bb99df0
Modified format-string checking to not emit a warning when all of the
following hold:

(1) A vprintf-like function is called that takes the argument list via a
    via_list argument.

(2) The format string is a non-literal that is the parameter value of
    the enclosing function, e.g:

    void logmessage(const char *fmt,...) {
      va_list ap;
      va_start(ap,fmt);
      fprintf(fmt,ap);  // Do not emit a warning.
    }

In the future this special case will be enhanced to consult the "format"
attribute attached to a function declaration instead of just allowing a blank
check for all function parameters to be used as format strings to vprintf-like
functions. This will happen when more support for attributes becomes
available.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45114 91177308-0d34-0410-b5e6-96231b3b80d8
Sema/SemaChecking.cpp
test/Sema/format-strings.c