1 // RUN: sed -e "s@ATTR_USE@__arm_streaming@g" -e "s@ATTR_NAME@__arm_streaming@g" %s > %t
2 // RUN: %clang_cc1 -fsyntax-only -triple aarch64-none-linux-gnu -target-feature +sme -verify=expected,notc2x -Wno-strict-prototypes %t
3 // RUN: %clang_cc1 -fsyntax-only -triple aarch64-none-linux-gnu -target-feature +sme -verify=expected,c2x %t
4 // RUN: sed -e "s@ATTR_USE@__arm_inout\(\"za\"\)@g" -e "s@ATTR_NAME@__arm_inout@g" %s > %t
5 // RUN: %clang_cc1 -fsyntax-only -triple aarch64-none-linux-gnu -target-feature +sme -verify=expected,notc2x -Wno-strict-prototypes %t
6 // RUN: %clang_cc1 -fsyntax-only -triple aarch64-none-linux-gnu -target-feature +sme -verify=expected,c2x %t
8 enum ATTR_USE E
{ // expected-error {{'ATTR_NAME' only applies to non-K&R-style functions}}
9 One ATTR_USE
, // expected-error {{'ATTR_NAME' only applies to non-K&R-style functions}}
11 Three ATTR_USE
// expected-error {{'ATTR_NAME' only applies to non-K&R-style functions}}
14 enum ATTR_USE
{ Four
}; // expected-error {{'ATTR_NAME' only applies to non-K&R-style functions}}
15 ATTR_USE
enum E2
{ Five
}; // expected-error {{misplaced 'ATTR_NAME'}}
17 // FIXME: this diagnostic can be improved.
18 enum { ATTR_USE Six
}; // expected-error {{expected identifier}}
20 // FIXME: this diagnostic can be improved.
21 enum E3 ATTR_USE
{ Seven
}; // expected-error {{expected identifier or '('}}
23 struct ATTR_USE S1
{ // expected-error {{'ATTR_NAME' only applies to non-K&R-style functions}}
24 int i ATTR_USE
; // expected-error {{'ATTR_NAME' only applies to function types}}
25 int ATTR_USE j
; // expected-error {{'ATTR_NAME' only applies to function types}}
26 int k
[10] ATTR_USE
; // expected-error {{'ATTR_NAME' only applies to function types}}
27 int l ATTR_USE
[10]; // expected-error {{'ATTR_NAME' only applies to function types}}
28 ATTR_USE
int m
, n
; // expected-error {{'ATTR_NAME' only applies to function types}}
29 int o ATTR_USE
: 12; // expected-error {{'ATTR_NAME' only applies to function types}}
30 int ATTR_USE
: 0; // expected-error {{'ATTR_NAME' only applies to function types}}
31 int p
, ATTR_USE
: 0; // expected-error {{'ATTR_NAME' cannot appear here}}
32 int q
, ATTR_USE r
; // expected-error {{'ATTR_NAME' cannot appear here}}
33 ATTR_USE
int; // expected-error {{'ATTR_NAME' cannot appear here}} \
34 // expected-warning {{declaration does not declare anything}}
37 ATTR_USE
struct S2
{ int a
; }; // expected-error {{misplaced 'ATTR_NAME'}}
38 struct S3 ATTR_USE
{ int a
; }; // expected-error {{'ATTR_NAME' cannot appear here}} \
39 expected
-error
{{'ATTR_NAME' only applies to non
-K
&R
-style functions
}}
41 union ATTR_USE U
{ // expected-error {{'ATTR_NAME' only applies to non-K&R-style functions}}
42 double d ATTR_USE
; // expected-error {{'ATTR_NAME' only applies to function types; type here is 'double'}}
43 ATTR_USE
int i
; // expected-error {{'ATTR_NAME' only applies to function types; type here is 'int'}}
46 ATTR_USE
union U2
{ double d
; }; // expected-error {{misplaced 'ATTR_NAME'}}
47 union U3 ATTR_USE
{ double d
; }; // expected-error {{'ATTR_NAME' cannot appear here}} \
48 expected
-error
{{'ATTR_NAME' only applies to non
-K
&R
-style functions
}}
50 struct ATTR_USE IncompleteStruct
; // expected-error {{'ATTR_NAME' only applies to non-K&R-style functions}}
51 union ATTR_USE IncompleteUnion
; // expected-error {{'ATTR_NAME' only applies to non-K&R-style functions}}
52 enum ATTR_USE IncompleteEnum
; // expected-error {{'ATTR_NAME' only applies to non-K&R-style functions}}
54 ATTR_USE
void f1(void); // expected-error {{'ATTR_NAME' cannot be applied to a declaration}}
55 void ATTR_USE
f2(void); // expected-error {{'ATTR_NAME' only applies to function types}}
56 void f3
ATTR_USE (void); // expected-error {{'ATTR_NAME' cannot be applied to a declaration}}
57 void f4(void) ATTR_USE
;
59 void f5(int i ATTR_USE
, ATTR_USE
int j
, int ATTR_USE k
); // expected-error 3 {{'ATTR_NAME' only applies to function types}}
61 void f6(a
, b
) ATTR_USE
int a
; int b
; { // expected-error {{'ATTR_NAME' cannot appear here}} \
62 c2x
-warning
{{deprecated
}}
65 // FIXME: technically, an attribute list cannot appear here, but we currently
66 // parse it as part of the return type of the function, which is reasonable
67 // behavior given that we *don't* want to parse it as part of the K&R parameter
68 // declarations. It is disallowed to avoid a parsing ambiguity we already
70 int (*f7(a
, b
))(int, int) ATTR_USE
int a
; int b
; { // c2x-warning {{deprecated}}
74 ATTR_USE
int a
, b
; // expected-error {{'ATTR_NAME' only applies to function types}}
75 int c ATTR_USE
, d ATTR_USE
; // expected-error 2 {{'ATTR_NAME' only applies to function types}}
77 void f8(void) ATTR_USE
{
78 ATTR_USE
int i
, j
; // expected-error {{'ATTR_NAME' only applies to function types}}
79 int k
, l ATTR_USE
; // expected-error {{'ATTR_NAME' only applies to function types}}
82 ATTR_USE
void f9(void) { // expected-error {{'ATTR_NAME' cannot be applied to a declaration}}
83 int i
[10] ATTR_USE
; // expected-error {{'ATTR_NAME' only applies to function types}}
84 int (*fp1
)(void)ATTR_USE
;
85 int (*fp2 ATTR_USE
)(void); // expected-error {{'ATTR_NAME' cannot be applied to a declaration}}
87 int * ATTR_USE
*ipp
; // expected-error {{'ATTR_NAME' only applies to function types}}
90 void f10(int j
[static 10] ATTR_USE
, int k
[*] ATTR_USE
); // expected-error 2 {{'ATTR_NAME' only applies to function types}}
93 ATTR_USE
{} // expected-error {{'ATTR_NAME' cannot be applied to a statement}}
94 ATTR_USE
if (1) {} // expected-error {{'ATTR_NAME' cannot be applied to a statement}}
96 ATTR_USE
switch (1) { // expected-error {{'ATTR_NAME' cannot be applied to a statement}}
97 ATTR_USE
case 1: ATTR_USE
break; // expected-error 2 {{'ATTR_NAME' cannot be applied to a statement}}
98 ATTR_USE
default: break; // expected-error {{'ATTR_NAME' cannot be applied to a statement}}
102 ATTR_USE foo
: (void)1; // expected-error {{'ATTR_NAME' only applies to non-K&R-style functions}}
104 ATTR_USE
for (;;); // expected-error {{'ATTR_NAME' cannot be applied to a statement}}
105 ATTR_USE
while (1); // expected-error {{'ATTR_NAME' cannot be applied to a statement}}
106 ATTR_USE
do ATTR_USE
{ } while(1); // expected-error 2 {{'ATTR_NAME' cannot be applied to a statement}}
108 ATTR_USE (void)1; // expected-error {{'ATTR_NAME' cannot be applied to a statement}}
110 ATTR_USE
; // expected-error {{'ATTR_NAME' cannot be applied to a statement}}
112 (void)sizeof(int [4]ATTR_USE
); // expected-error {{'ATTR_NAME' only applies to function types}}
113 (void)sizeof(struct ATTR_USE S3
{ int a ATTR_USE
; }); // expected-error {{'ATTR_NAME' only applies to non-K&R-style functions}} \
114 // expected-error {{'ATTR_NAME' only applies to function types; type here is 'int'}}
116 ATTR_USE
return; // expected-error {{'ATTR_NAME' cannot be applied to a statement}}
118 ATTR_USE
asm (""); // expected-error {{'ATTR_NAME' cannot appear here}}
121 struct ATTR_USE S4
*s
; // expected-error {{'ATTR_NAME' cannot appear here}}
123 int c
= sizeof(struct ATTR_USE S5
); // expected-error {{'ATTR_NAME' cannot appear here}}
125 void invalid_parentheses1() __arm_inout
; // expected-error {{expected '(' after ''__arm_inout''}}
126 void invalid_parentheses2() __arm_inout(; // expected-error {{expected string literal as argument of '__arm_inout' attribute}}
127 void invalid_parentheses3() __arm_inout((); // expected-error {{expected string literal as argument of '__arm_inout' attribute}}
128 void invalid_parentheses4() __arm_inout
); // expected-error {{expected '(' after ''__arm_inout''}} \
129 // expected-error {{expected function body after function declarator}}
130 void invalid_parentheses5() __arm_inout(()); // expected-error {{expected string literal as argument of '__arm_inout' attribute}}
131 void invalid_parentheses6() __arm_inout("za"; // expected-error {{expected ')'}}
132 void invalid_parentheses7() __arm_streaming(; // expected-error {{expected parameter declarator}} \
133 // expected-error {{expected ')'}} \
134 // expected-note {{to match this '('}} \
135 // expected-error {{function cannot return function type 'void ()'}} \
136 // expected-error {{'__arm_streaming' only applies to function types; type here is 'int ()'}} \
137 // expected-warning {{'__arm_streaming' only applies to non-K&R-style functions}}
138 void invalid_parentheses8() __arm_streaming(); // expected-error {{function cannot return function type 'void ()'}} \
139 // expected-error {{'__arm_streaming' only applies to function types; type here is 'int ()'}} \
140 // expected-warning {{'__arm_streaming' only applies to non-K&R-style functions}}