History log of /llvm-project/clang/test/Sema/format-strings.c (Results 101 – 125 of 128)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 605b0113 29-Jan-2010 Ted Kremenek <kremenek@apple.com>

Be a little more permissive than C99: allow 'unsigned' to be used for
the field width and precision of a format specifier instead of just
'int'. This matches GCC, and fixes <rdar://problem/6079850>.

Be a little more permissive than C99: allow 'unsigned' to be used for
the field width and precision of a format specifier instead of just
'int'. This matches GCC, and fixes <rdar://problem/6079850>.

llvm-svn: 94856

show more ...


# 8d9842d4 29-Jan-2010 Ted Kremenek <kremenek@apple.com>

Switch Sema over to using the new implementation of format string
checking. It passes all existing tests, and the diagnostics have been
refined to provide better range information (we now highlight

Switch Sema over to using the new implementation of format string
checking. It passes all existing tests, and the diagnostics have been
refined to provide better range information (we now highlight
individual format specifiers) and more precise wording in the
diagnostics.

llvm-svn: 94837

show more ...


# f9895c48 09-Jan-2010 Chris Lattner <sabre@nondot.org>

add a bunch of missing prototypes to tests

llvm-svn: 93072


# d806cbc9 22-Dec-2009 Chris Lattner <sabre@nondot.org>

fix a bug handling the gnu ?: extension. Patch by Storlek on IRC,
who prefers to be stealthy and mysterious.

llvm-svn: 91888


# 8fbe78f6 15-Dec-2009 Daniel Dunbar <daniel@zuster.org>

Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
which is substituted. It is '%clang_cc1' instead o

Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
can be useful to redefine what gets run as 'clang -cc1' (for example, to set
a default target).

llvm-svn: 91446

show more ...


# feedba68 17-Nov-2009 Daniel Dunbar <daniel@zuster.org>

Don't #include <stdio.h> when tests don't need it, or use clang instead of clang-cc when they do.

llvm-svn: 89070


# e413e88f 29-Oct-2009 John Thompson <John.Thompson.JTSoftware@gmail.com>

Fix some Window-isms to get these tests to pass on Windows.

llvm-svn: 85450


Revision tags: llvmorg-2.6.0
# 4554f9b1 13-May-2009 Ted Kremenek <kremenek@apple.com>

Fix <rdar://problem/6880975> [format string] Assertion failed: (Arg < NumArgs && "Arg access out of range!").

For format string checking, only check the type of the format
specifier for non-vararg f

Fix <rdar://problem/6880975> [format string] Assertion failed: (Arg < NumArgs && "Arg access out of range!").

For format string checking, only check the type of the format
specifier for non-vararg functions.

llvm-svn: 71672

show more ...


# cc5d1c2e 29-Apr-2009 Chris Lattner <sabre@nondot.org>

implement -Wformat-security properly, which is enabled by default.
This enables one specific class of non-literal format warnings.

llvm-svn: 70368


# 941153af 29-Apr-2009 Chris Lattner <sabre@nondot.org>

tweak warning options to be more like gcc:

1. All all variants of -Wformat*, make them imply -Wformat. GCC warns
if you use -Wformatfoo without -Wformat. We just make one imply the
other.

tweak warning options to be more like gcc:

1. All all variants of -Wformat*, make them imply -Wformat. GCC warns
if you use -Wformatfoo without -Wformat. We just make one imply the
other.
2. Make -Wformat-nonliteral default to off, like gcc. It is an incredible
nuisance.
3. Accept but currently ignore -Wformat-extra-args.

llvm-svn: 70362

show more ...


# a45cf5b6 24-Mar-2009 Daniel Dunbar <daniel@zuster.org>

Rename clang to clang-cc.

Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602


# dfd72c2b 20-Mar-2009 Ted Kremenek <kremenek@apple.com>

Fix <rdar://problem/6704086> by allowing the format string checking in Sema to
allow non-literal format strings that are variables that (a) permanently bind to
a string constant and (b) whose string

Fix <rdar://problem/6704086> by allowing the format string checking in Sema to
allow non-literal format strings that are variables that (a) permanently bind to
a string constant and (b) whose string constants are resolvable within the same
translation unit.

llvm-svn: 67404

show more ...


Revision tags: llvmorg-2.5.0
# f638b97f 18-Feb-2009 Chris Lattner <sabre@nondot.org>

use the full spelling of a string literal token so that trigraphs
and escaped newlines don't throw off the offset computation.

On this testcase:
printf("abc\
def"
"%*d", (unsigned) 1, 1);

use the full spelling of a string literal token so that trigraphs
and escaped newlines don't throw off the offset computation.

On this testcase:
printf("abc\
def"
"%*d", (unsigned) 1, 1);

Before:
t.m:5:5: warning: field width should have type 'int', but argument has type 'unsigned int'
def"
^

after:
t.m:6:12: warning: field width should have type 'int', but argument has type 'unsigned int'
"%*d", (unsigned) 1, 1);
^ ~~~~~~~~~~~~

llvm-svn: 64930

show more ...


# df18c6a9 18-Feb-2009 Chris Lattner <sabre@nondot.org>

add c testcase for string literal diagnostic improvement.

llvm-svn: 64929


# e711f705 14-Feb-2009 Douglas Gregor <dgregor@apple.com>

Add hook to add attributes to function declarations that we know
about, whether they are builtins or not. Use this to add the
appropriate "format" attribute to NSLog, NSLogv, asprintf, and
vasprintf,

Add hook to add attributes to function declarations that we know
about, whether they are builtins or not. Use this to add the
appropriate "format" attribute to NSLog, NSLogv, asprintf, and
vasprintf, and to translate builtin attributes (from Builtins.def)
into actual attributes on the function declaration.

Use the "printf" format attribute on function declarations to
determine whether we should do format string checking, rather than
looking at an ad hoc list of builtins and "known" function names.

Be a bit more careful about when we consider a function a "builtin" in
C++.

llvm-svn: 64561

show more ...


# 94a5f6f9 12-Jan-2009 Ted Kremenek <kremenek@apple.com>

Fix test case (incomplete "expected-warning" line)

llvm-svn: 62119


# 6dfeb558 12-Jan-2009 Ted Kremenek <kremenek@apple.com>

Patch by Roman Divacky:

Extend string-literal checking for printf() format string to handle conditional
ternary operators where both sides are literals.

This fixes PR 3319: http://llvm.org/bugs/sho

Patch by Roman Divacky:

Extend string-literal checking for printf() format string to handle conditional
ternary operators where both sides are literals.

This fixes PR 3319: http://llvm.org/bugs/show_bug.cgi?id=3319

llvm-svn: 62117

show more ...


Revision tags: llvmorg-2.4.0
# dd9b2d16 02-Oct-2008 Daniel Dunbar <daniel@zuster.org>

Add support for format string checking of object-size checking
versions of sprintf and friends.
- Added FIXME that this mechanism should be generalized.

llvm-svn: 56962


# 5dd15a3c 20-Aug-2008 Eli Friedman <eli.friedman@gmail.com>

Fix test failure on Linux.

llvm-svn: 55032


# 81f7f290 05-Aug-2008 Daniel Dunbar <daniel@zuster.org>

Add EXTWARN Diagnostic class.
- Like EXTENSION but always generates a warning (even without
-pedantic).
- Updated ptr -> int, int -> ptr, and incompatible cast warnings to
be EXTWARN.
- Othe

Add EXTWARN Diagnostic class.
- Like EXTENSION but always generates a warning (even without
-pedantic).
- Updated ptr -> int, int -> ptr, and incompatible cast warnings to
be EXTWARN.
- Other EXTENSION level diagnostics should be audited for upgrade.
- Updated several test cases to fix code which produced unanticipated
warnings.

llvm-svn: 54335

show more ...


Revision tags: llvmorg-2.3.0, llvmorg-2.2.0
# 3fbeaea7 17-Dec-2007 Ted Kremenek <kremenek@apple.com>

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

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.

llvm-svn: 45114

show more ...


# b30f47a8 15-Oct-2007 Anders Carlsson <andersca@mac.com>

Fix a warning

llvm-svn: 42973


# 41362cea 12-Oct-2007 Ted Kremenek <kremenek@apple.com>

Added notion of '*' specified format width/specifiers when checking
printf format strings. Added type checking to see if the matching
width/precision argument was of type 'int'.

Thanks to Anders Ca

Added notion of '*' specified format width/specifiers when checking
printf format strings. Added type checking to see if the matching
width/precision argument was of type 'int'.

Thanks to Anders Carlsson for reporting this missing feature.

llvm-svn: 42933

show more ...


# 431ef632 12-Oct-2007 Anders Carlsson <andersca@mac.com>

Add some more diagnostics for va_start, fix tests so they pass with these new diags.

llvm-svn: 42917


# 5e4c75f4 11-Oct-2007 Chris Lattner <sabre@nondot.org>

rename -parse-ast-print to -ast-print
rename -parse-ast-dump to -ast-dump
remove -parse-ast, which is redundant with -fsyntax-only

llvm-svn: 42852


123456