diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-07-13 17:25:47 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-07-13 17:25:47 +0000 |
commit | 45eb7022ff059ff5a291e24f57ff56428a1e8210 (patch) | |
tree | 22e0569623d9a1240269d9d72fcd2a85e1b863f5 /test/Sema/format-strings.c | |
parent | fbf780a9d1dbb191fc40c8af967c590e08724b74 (diff) |
Fix inversion in argument type checking for format strings with conversion specifiers for character types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135046 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, 9 insertions, 0 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c index 35210c341a..83f96ff3a0 100644 --- a/test/Sema/format-strings.c +++ b/test/Sema/format-strings.c @@ -363,3 +363,12 @@ int printf(const char * restrict, ...) __attribute__((__format__ (__printf__, 1, void rdar9612060(void) { printf("%s", 2); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int'}} } + +void check_char(unsigned char x, signed char y) { + printf("%c", y); // no-warning + printf("%hhu", x); // no-warning + printf("%hhi", y); // no-warning + printf("%hhi", x); // expected-warning{{conversion specifies type 'signed char' but the argument has type 'unsigned char'}} + printf("%c", x); // no-warning + printf("%hhu", y); // expected-warning{{conversion specifies type 'unsigned char' but the argument has type 'signed char'}} +} |