1 // RUN: %clang_cc1 -triple=x86_64-unknown-unknown -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -triple=x86_64-unknown-unknown -fsyntax-only -DSYSTEM -verify %s
3 // RUN: %clang_cc1 -triple=s390x-none-zos -fsyntax-only -verify=unknown %s
4 // RUN: %clang_cc1 -triple=s390x-none-zos -fsyntax-only -DSYSTEM -verify=unknown-system %s
7 #5 "init-priority-attr.cpp" 3 // system header
15 Two( int ii
, int jj
) { i
= ii
; j
= jj
; k
= count
++; };
16 Two( void ) { i
= 0; j
= 0; k
= count
++; };
17 int eye( void ) { return i
; };
18 int jay( void ) { return j
; };
19 int kay( void ) { return k
; };
27 Two foo
__attribute__((init_priority(101))) ( 5, 6 );
28 // unknown-system-no-diagnostics
29 // unknown-warning@-2 {{unknown attribute 'init_priority' ignored}}
31 Two goo
__attribute__((init_priority(2,3))) ( 5, 6 ); // expected-error {{'init_priority' attribute takes one argument}}
32 // unknown-warning@-1 {{unknown attribute 'init_priority' ignored}}
34 Two coo
[2] __attribute__((init_priority(100)));
36 // expected-error@-2 {{'init_priority' attribute requires integer constant between 101 and 65535 inclusive}}
37 // unknown-warning@-3 {{unknown attribute 'init_priority' ignored}}
40 Two boo
[2] __attribute__((init_priority(65536)));
42 // expected-error@-2 {{'init_priority' attribute requires integer constant between 101 and 65535 inclusive}}
43 // unknown-warning@-3 {{unknown attribute 'init_priority' ignored}}
46 Two koo
[4] __attribute__((init_priority(1.13))); // expected-error {{'init_priority' attribute requires an integer constant}}
47 // unknown-warning@-1 {{unknown attribute 'init_priority' ignored}}
49 Two
func() __attribute__((init_priority(1001))); // expected-error {{'init_priority' attribute only applies to variables}}
50 // unknown-warning@-1 {{unknown attribute 'init_priority' ignored}}
53 int i
__attribute__((init_priority(1001))); // expected-error {{can only use 'init_priority' attribute on file-scope definitions of objects of class type}}
54 // unknown-warning@-1 {{unknown attribute 'init_priority' ignored}}
57 Two foo
__attribute__((init_priority(1001))); // expected-error {{can only use 'init_priority' attribute on file-scope definitions of objects of class type}}
58 // unknown-warning@-1 {{unknown attribute 'init_priority' ignored}}