summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/attr-sentinel.c
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-09-27 23:46:37 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-09-27 23:46:37 +0000
commit9ab36372dbac59491c589ab3092b54c469079f8f (patch)
tree0b37cd91c77478ecad32b073380e5d69f62994fe /clang/test/Sema/attr-sentinel.c
parentab2dcc8de6c1973751dd326fe1401e674fe91207 (diff)
downloadbcm5719-llvm-9ab36372dbac59491c589ab3092b54c469079f8f.tar.gz
bcm5719-llvm-9ab36372dbac59491c589ab3092b54c469079f8f.zip
PR11002: Make sure we emit sentinel warnings with a valid source location. (Ideally, we want to use the location returned by getLocForEndOfToken, but that is not always successful.)
llvm-svn: 140658
Diffstat (limited to 'clang/test/Sema/attr-sentinel.c')
-rw-r--r--clang/test/Sema/attr-sentinel.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/test/Sema/attr-sentinel.c b/clang/test/Sema/attr-sentinel.c
index 5ca6a8d0011..abc108fdc78 100644
--- a/clang/test/Sema/attr-sentinel.c
+++ b/clang/test/Sema/attr-sentinel.c
@@ -4,13 +4,15 @@
#define ATTR __attribute__ ((__sentinel__))
-void foo1 (int x, ...) ATTR; // expected-note 2 {{function has been explicitly marked sentinel here}}
+void foo1 (int x, ...) ATTR; // expected-note 3 {{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}}
void foo10 (int x, ...) __attribute__ ((__sentinel__(1,1)));
void foo12 (int x, ... ) ATTR; // expected-note {{function has been explicitly marked sentinel here}}
+#define FOOMACRO(...) foo1(__VA_ARGS__)
+
void test1() {
foo1(1, NULL); // OK
foo1(1, 0) ; // expected-warning {{missing sentinel in function call}}
@@ -30,6 +32,9 @@ void test1() {
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);
+
+ // PR11002
+ FOOMACRO(1, 2); // expected-warning {{missing sentinel in function call}}
}
OpenPOWER on IntegriCloud