]> granicus.if.org Git - clang/commitdiff
add c testcase for string literal diagnostic improvement.
authorChris Lattner <sabre@nondot.org>
Wed, 18 Feb 2009 18:25:31 +0000 (18:25 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 18 Feb 2009 18:25:31 +0000 (18:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64929 91177308-0d34-0410-b5e6-96231b3b80d8

test/Sema/format-strings.c

index 707873feaf8fc3287e218b0d4073e4b95fd044f3..024e06ab591ff8ceb1868fcc99a0ecd9214e6845 100644 (file)
@@ -29,6 +29,9 @@ void check_string_literal( FILE* fp, const char* s, char *buf, ... ) {
   vsnprintf(buf,2,global_fmt,ap); // expected-warning {{format string is not a string literal}}
   __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'}}
 }
 
 void check_conditional_literal(const char* s, int i) {