1 // RUN: %clang_cc1 -fsyntax-only -verify %s
5 static const int test_in
6 __attribute__((type_tag_for_datatype(test
, int))) = INT_TAG
;
8 // Argument index: 1, Type tag index: 2
9 void test_bounds_index(...)
10 __attribute__((argument_with_type_tag(test
, 1, 2)));
12 // Argument index: 1, Type tag index: 2
13 void test_bounds_index_ptr(void *, ...)
14 __attribute__((pointer_with_type_tag(test
, 1, 2)));
16 // Argument index: 3, Type tag index: 1
17 void test_bounds_arg_index(...)
18 __attribute__((argument_with_type_tag(test
, 3, 1)));
22 // Argument index: 2, Type tag index: 3
23 void test_bounds_index(...)
24 __attribute__((argument_with_type_tag(test
, 2, 3)));
26 // Argument index: 2, Type tag index: 3
27 void test_bounds_index_ptr(void *, ...)
28 __attribute__((pointer_with_type_tag(test
, 2, 3)));
30 // Argument index: 4, Type tag index: 2
31 void test_bounds_arg_index(...)
32 __attribute__((argument_with_type_tag(test
, 4, 2)));
39 // Test the boundary edges (ensure no off-by-one) with argument indexing.
40 test_bounds_index(1, INT_TAG
);
41 c
.test_bounds_index(1, INT_TAG
);
42 test_bounds_index_ptr(0, INT_TAG
);
43 c
.test_bounds_index_ptr(0, INT_TAG
);
45 test_bounds_index(1); // expected-error {{type tag index 2 is greater than the number of arguments specified}}
46 c
.test_bounds_index(1); // expected-error {{type tag index 3 is greater than the number of arguments specified}}
47 test_bounds_index_ptr(0); // expected-error {{type tag index 2 is greater than the number of arguments specified}}
48 c
.test_bounds_index_ptr(0); // expected-error {{type tag index 3 is greater than the number of arguments specified}}
50 test_bounds_arg_index(INT_TAG
, 1); // expected-error {{argument index 3 is greater than the number of arguments specified}}
51 c
.test_bounds_arg_index(INT_TAG
, 1); // expected-error {{argument index 4 is greater than the number of arguments specified}}