summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-02-01 19:28:15 +0000
committerTed Kremenek <kremenek@apple.com>2010-02-01 19:28:15 +0000
commitcd83106151285041c4e5f492bb80e9cb22276db2 (patch)
tree3b296156e9fdf18df4c6821b71bb6c2b8f184d4b /clang/test/Sema/format-strings.c
parent973f2eb0cd69d3d331ce66c3395d9fea696875dd (diff)
downloadbcm5719-llvm-cd83106151285041c4e5f492bb80e9cb22276db2.tar.gz
bcm5719-llvm-cd83106151285041c4e5f492bb80e9cb22276db2.zip
Format string checking: selectively ignore implicit casts to 'int'
when checking if the format specifier matches the type of the data argument and the length modifier indicates the data type is 'char' or 'short'. llvm-svn: 94992
Diffstat (limited to 'clang/test/Sema/format-strings.c')
-rw-r--r--clang/test/Sema/format-strings.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index 02e39a426be..a055bfe1822 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/test/Sema/format-strings.c
@@ -162,6 +162,11 @@ void test10(int x, float f, int i, long long lli) {
printf("%.", x); // expected-warning{{incomplete format specifier}}
printf("%f", 4); // expected-warning{{conversion specifies type 'double' but the argument has type 'int'}}
printf("%qd", lli);
+ printf("hhX %hhX", (unsigned char)10); // no-warning
+ printf("llX %llX", (long long) 10); // no-warning
+ // This is fine, because there is an implicit conversion to an int.
+ printf("%d", (unsigned char) 10); // no-warning
+ printf("%d", (long long) 10); // expected-warning{{conversion specifies type 'int' but the argument has type 'long long'}}
}
typedef struct __aslclient *aslclient;
OpenPOWER on IntegriCloud