aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/warn-type-safety.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
commit13cc256e404620c1de0cbcc4e43ce1e2dbbc4898 (patch)
tree2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /test/Sema/warn-type-safety.c
parent657bc3d9848e3be92029b2416031340988cd0111 (diff)
Notes
Diffstat (limited to 'test/Sema/warn-type-safety.c')
-rw-r--r--test/Sema/warn-type-safety.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Sema/warn-type-safety.c b/test/Sema/warn-type-safety.c
index 6f548aa2567d6..4ac453d380bd7 100644
--- a/test/Sema/warn-type-safety.c
+++ b/test/Sema/warn-type-safety.c
@@ -80,6 +80,14 @@ void test_tag_mismatch(int *ptr)
C_func(ptr, 20); // should warn, but may cause false positives
}
+void test_null_pointer()
+{
+ C_func(0, C_tag); // no-warning
+ C_func((void *) 0, C_tag); // no-warning
+ C_func((int *) 0, C_tag); // no-warning
+ C_func((long *) 0, C_tag); // expected-warning {{argument type 'long *' doesn't match specified 'c' type tag that requires 'int *'}}
+}
+
// Check that we look through typedefs in the special case of allowing 'char'
// to be matched with 'signed char' or 'unsigned char'.
void E_func(void *ptr, int tag) __attribute__(( pointer_with_type_tag(e,1,2) ));