aboutsummaryrefslogtreecommitdiff
path: root/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
commit180f2840d1d8bcb2139bfb53e2d88eda280e939e (patch)
tree6323b5ef907a1f2f47d62005a4c1f4d45287e3f8 /test/Sema/format-strings.c
parentabb485f0b58dd3d2da20f9b34f99695899a68cf2 (diff)
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'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94992 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/format-strings.c')
-rw-r--r--test/Sema/format-strings.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 02e39a426b..a055bfe182 100644
--- a/test/Sema/format-strings.c
+++ b/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;