summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/attr-sentinel.c
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-05-06 23:53:00 +0000
committerJohn McCall <rjmccall@apple.com>2010-05-06 23:53:00 +0000
commit7ddbcf4f4b85e31ab69beb38fc12d7ee4754154e (patch)
treed9a5bce9be8976194abb54d802e42646d495c47c /clang/test/Sema/attr-sentinel.c
parent90fbedcb5421f18c1346dfc87cd112e2513c1c6d (diff)
downloadbcm5719-llvm-7ddbcf4f4b85e31ab69beb38fc12d7ee4754154e.tar.gz
bcm5719-llvm-7ddbcf4f4b85e31ab69beb38fc12d7ee4754154e.zip
After some discussion, conservatively extend our sentinel check to discard
casts, but still require the (casted) type to be a pointer. Fixes PR5685. llvm-svn: 103216
Diffstat (limited to 'clang/test/Sema/attr-sentinel.c')
-rw-r--r--clang/test/Sema/attr-sentinel.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/test/Sema/attr-sentinel.c b/clang/test/Sema/attr-sentinel.c
index db90d078b3f..5ca6a8d0011 100644
--- a/clang/test/Sema/attr-sentinel.c
+++ b/clang/test/Sema/attr-sentinel.c
@@ -4,7 +4,7 @@
#define ATTR __attribute__ ((__sentinel__))
-void foo1 (int x, ...) ATTR; // expected-note {{function has been explicitly marked sentinel here}}
+void foo1 (int x, ...) ATTR; // expected-note 2 {{function has been explicitly marked sentinel here}}
void foo5 (int x, ...) __attribute__ ((__sentinel__(1))); // expected-note {{function has been explicitly marked sentinel here}}
void foo6 (int x, ...) __attribute__ ((__sentinel__(5))); // expected-note {{function has been explicitly marked sentinel here}}
void foo7 (int x, ...) __attribute__ ((__sentinel__(0))); // expected-note {{function has been explicitly marked sentinel here}}
@@ -24,6 +24,12 @@ void test1() {
foo7(1, NULL); // OK
foo12(1); // expected-warning {{not enough variable arguments in 'foo12' declaration to fit a sentinel}}
+
+ // PR 5685
+ struct A {};
+ struct A a, b, c;
+ foo1(3, &a, &b, &c); // expected-warning {{missing sentinel in function call}}
+ foo1(3, &a, &b, &c, (struct A*) 0);
}
OpenPOWER on IntegriCloud