diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-18 18:34:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-18 18:34:12 +0000 |
commit | d0d082f2eba4e3ed4eb467d76fd227c6dcd6cce7 (patch) | |
tree | ea0e36306ec2e9ed40cc6675204d738076914864 /test/Sema/format-strings.c | |
parent | 07f192e1d7af64d63fd80eafd724b70a18ebfbd9 (diff) |
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);
^ ~~~~~~~~~~~~
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64930 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/format-strings.c')
-rw-r--r-- | test/Sema/format-strings.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c index 024e06ab59..5007bb0fa4 100644 --- a/test/Sema/format-strings.c +++ b/test/Sema/format-strings.c @@ -30,8 +30,13 @@ void check_string_literal( FILE* fp, const char* s, char *buf, ... ) { __builtin___vsnprintf_chk(buf,2,0,-1,s,ap); // no-warning __builtin___vsnprintf_chk(buf,2,0,-1,global_fmt,ap); // expected-warning {{format string is not a string literal}} - printf("abc" - "%*d", (unsigned) 1, 1); // expected-warning {{field width should have type 'int'}} + // rdar://6079877 + printf("abc" + "%*d", (unsigned) 1, 1); // expected-warning {{field width should have type 'int'}} + printf("abc\ +def" + "%*d", (unsigned) 1, 1); // expected-warning {{field width should have type 'int'}} + } void check_conditional_literal(const char* s, int i) { |