summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-18 18:34:12 +0000
committerChris Lattner <sabre@nondot.org>2009-02-18 18:34:12 +0000
commitf638b97fe06a36e3b6de5ce1705ac4181cbf6f9b (patch)
treea9d8bb2756d003a572a2fb119ebe6371e25c53a7 /clang/test/Sema/format-strings.c
parentdf18c6a9af34550404058f80f9d2e74b42bb4a74 (diff)
downloadbcm5719-llvm-f638b97fe06a36e3b6de5ce1705ac4181cbf6f9b.tar.gz
bcm5719-llvm-f638b97fe06a36e3b6de5ce1705ac4181cbf6f9b.zip
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
Diffstat (limited to 'clang/test/Sema/format-strings.c')
-rw-r--r--clang/test/Sema/format-strings.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index 024e06ab591..5007bb0fa40 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/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) {
OpenPOWER on IntegriCloud