aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-10-25 04:20:41 +0000
committerTed Kremenek <kremenek@apple.com>2011-10-25 04:20:41 +0000
commit6ca4a9ae99d65948e578d3e7d1f58ab6a947d2d7 (patch)
tree21674dba3381aed147c09cbf8f37a0798fa74769 /test/Sema/format-strings.c
parent5c27ee0c9499fa6a2ee728cb8ca4311a1f2ab675 (diff)
Tweak printf format string parsing to accept 'hh' conversion specifier to accept any char, not just signed char. Fixes <rdar://problem/10303638>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142908 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 6b5f7e2c26..4f2ad99a57 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -212,6 +212,12 @@ void test12(char *b) {
asprintf(&b, "%d", "asprintf"); // expected-warning{{conversion specifies type 'int' but the argument has type 'char *'}}
}
+void test13(short x) {
+ char bel = 007;
+ printf("bel: '0%hhd'\n", bel); // no-warning
+ printf("x: '0%hhd'\n", x); // expected-warning {{conversion specifies type 'char' but the argument has type 'short'}}
+}
+
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)));