#define NULL (void*)0
#define ATTR __attribute__ ((__sentinel__))
void foo1 (int x, ...) ATTR; void foo5 (int x, ...) __attribute__ ((__sentinel__(1))); void foo6 (int x, ...) __attribute__ ((__sentinel__(5))); void foo7 (int x, ...) __attribute__ ((__sentinel__(0))); void foo10 (int x, ...) __attribute__ ((__sentinel__(1,1)));
void foo12 (int x, ... ) ATTR;
#define FOOMACRO(...) foo1(__VA_ARGS__)
void test1(void) {
foo1(1, NULL); foo1(1, 0) ; foo5(1, NULL, 2); foo5(1,2,NULL, 1); foo5(1, NULL, 2, 1);
foo6(1,2,3,4,5,6,7); foo6(1,NULL,3,4,5,6,7); foo7(1); foo7(1, NULL);
foo12(1);
struct A {};
struct A a, b, c;
foo1(3, &a, &b, &c); foo1(3, &a, &b, &c, (struct A*) 0);
FOOMACRO(1, 2); }
void (*e) (int arg, const char * format, ...) __attribute__ ((__sentinel__ (1,1)));
void test2(void) {
void (*b) (int arg, const char * format, ...) __attribute__ ((__sentinel__)); void (*z) (int arg, const char * format, ...) __attribute__ ((__sentinel__ (2)));
void (*y) (int arg, const char * format, ...) __attribute__ ((__sentinel__ (5)));
b(1, "%s", (void*)0); b(1, "%s", 0); z(1, "%s",4 ,1,0); z(1, "%s", (void*)0, 1, 0);
y(1, "%s", 1,2,3,4,5,6,7);
y(1, "%s", (void*)0,3,4,5,6,7); }