OSDN Git Service

PR c/36507
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / initpri2.c
1 /* { dg-do compile { target init_priority } } */
2
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" } */
12
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" } */
18
19 /* Priorities must be integral constants.  */
20
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" } */
26
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" } */
33
34 /* Enumeration constants are allowed.  */
35 enum E { e = 500 };
36 void c6() 
37      __attribute__((constructor ((e))));
38 void d6()    
39      __attribute__((destructor ((e))));