aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-02-16 01:46:59 +0000
committerTed Kremenek <kremenek@apple.com>2010-02-16 01:46:59 +0000
commit4e4b30ec62d78b24e6556fea2624855c193d0e3e (patch)
treec4d277ecc23e3313dd7145b30d068e3fb16c4b44 /test/Sema/format-strings.c
parent252bee91e9961d9182323c4017092f90d6a09b1d (diff)
Refactor the logic for printf argument type-checking into analyze_printf::ArgTypeResult.
Implement printf argument type checking for '%s'. Fixes <rdar://problem/3065808>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96310 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/format-strings.c')
-rw-r--r--test/Sema/format-strings.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 1bbc68cd0d..ab37e3abdd 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -183,6 +183,12 @@ void test11(void *p, char *s) {
printf("%0s", p); // expected-warning{{flag '0' results in undefined behavior in 's' conversion specifier}}
}
+void test12() {
+ unsigned char buf[4];
+ printf ("%.4s\n", buf); // no-warning
+ printf ("%.4s\n", &buf); // expected-result{{conversion specifies type 'char *' but the argument has type 'unsigned char (*)[4]'}}
+}
+
typedef struct __aslclient *aslclient;
typedef struct __aslmsg *aslmsg;
int asl_log(aslclient asl, aslmsg msg, int level, const char *format, ...) __attribute__((__format__ (__printf__, 4, 5)));