Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / initpri2.c
blobfa9fda0d7f3def0880edbe4261daf160ee2ac68a
1 /* { dg-do compile { target init_priority } } */
3 /* Priorities must be in the range [0, 65535]. */
4 void c1()
5 __attribute__((constructor (-1))); /* { dg-error "priorities" } */
6 void c2()
7 __attribute__((constructor (65536))); /* { dg-error "priorities" } */
8 void d1()
9 __attribute__((destructor (-1))); /* { dg-error "priorities" } */
10 void d2()
11 __attribute__((destructor (65536))); /* { dg-error "priorities" } */
13 /* Priorities 0-100 are reserved for system libraries. */
14 void c3()
15 __attribute__((constructor (50))); /* { dg-warning "reserved" } */
16 void d3()
17 __attribute__((constructor (50))); /* { dg-warning "reserved" } */
19 /* Priorities must be integral constants. */
21 /* Pointers, even with constant values, are not allowed. */
22 void c4()
23 __attribute__((constructor ((void*) 500))); /* { dg-error "priorities" } */
24 void d4()
25 __attribute__((destructor ((void*) 500))); /* { dg-error "priorities" } */
27 /* Integer variables are not allowed. */
28 int i;
29 void c5()
30 __attribute__((constructor ((i)))); /* { dg-error "priorities" } */
31 void d5()
32 __attribute__((destructor ((i)))); /* { dg-error "priorities" } */
34 /* Enumeration constants are allowed. */
35 enum E { e = 500 };
36 void c6()
37 __attribute__((constructor ((e))));
38 void d6()
39 __attribute__((destructor ((e))));