Mercurial > hg > CbC > CbC_llvm
comparison clang/test/Parser/c2x-attributes.c @ 221:79ff65ed7e25
LLVM12 Original
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Jun 2021 19:15:29 +0900 |
parents | 1d019706d866 |
children | c4bab56944e8 |
comparison
equal
deleted
inserted
replaced
220:42394fc6a535 | 221:79ff65ed7e25 |
---|---|
14 enum { [[]] Six }; // expected-error {{expected identifier}} | 14 enum { [[]] Six }; // expected-error {{expected identifier}} |
15 | 15 |
16 // FIXME: this diagnostic can be improved. | 16 // FIXME: this diagnostic can be improved. |
17 enum E3 [[]] { Seven }; // expected-error {{expected identifier or '('}} | 17 enum E3 [[]] { Seven }; // expected-error {{expected identifier or '('}} |
18 | 18 |
19 [[deprecated([""])]] int WrongArgs; // expected-error {{expected expression}} | |
20 [[,,,,,]] int Commas1; // ok | |
21 [[,, maybe_unused]] int Commas2; // ok | |
22 [[maybe_unused,,,]] int Commas3; // ok | |
23 [[,,maybe_unused,]] int Commas4; // ok | |
24 [[foo bar]] int NoComma; // expected-error {{expected ','}} \ | |
25 // expected-warning {{unknown attribute 'foo' ignored}} | |
26 | |
19 struct [[]] S1 { | 27 struct [[]] S1 { |
20 int i [[]]; | 28 int i [[]]; |
21 int [[]] j; | 29 int [[]] j; |
22 int k[10] [[]]; | 30 int k[10] [[]]; |
23 int l[[]][10]; | 31 int l[[]][10]; |
24 [[]] int m, n; | 32 [[]] int m, n; |
25 int o [[]] : 12; | 33 int o [[]] : 12; |
34 int [[]] : 0; // OK, attribute applies to the type. | |
35 int p, [[]] : 0; // expected-error {{an attribute list cannot appear here}} | |
36 int q, [[]] r; // expected-error {{an attribute list cannot appear here}} | |
26 }; | 37 }; |
27 | 38 |
28 [[]] struct S2 { int a; }; // expected-error {{misplaced attributes}} | 39 [[]] struct S2 { int a; }; // expected-error {{misplaced attributes}} |
29 struct S3 [[]] { int a; }; // expected-error {{an attribute list cannot appear here}} | 40 struct S3 [[]] { int a; }; // expected-error {{an attribute list cannot appear here}} |
30 | 41 |
112 asm("ret" :::); | 123 asm("ret" :::); |
113 asm("foo" :: "r" (xx)); // expected-error {{use of undeclared identifier 'xx'}} | 124 asm("foo" :: "r" (xx)); // expected-error {{use of undeclared identifier 'xx'}} |
114 } | 125 } |
115 | 126 |
116 // Do not allow 'using' to introduce vendor attribute namespaces. | 127 // Do not allow 'using' to introduce vendor attribute namespaces. |
117 [[using vendor: attr1, attr2]] void f14(void); // expected-error {{expected ']'}} \ | 128 [[using vendor: attr1, attr2]] void f14(void); // expected-error {{expected ','}} \ |
118 // expected-warning {{unknown attribute 'vendor' ignored}} \ | |
119 // expected-warning {{unknown attribute 'using' ignored}} | 129 // expected-warning {{unknown attribute 'using' ignored}} |
120 | 130 |
121 struct [[]] S4 *s; // expected-error {{an attribute list cannot appear here}} | 131 struct [[]] S4 *s; // expected-error {{an attribute list cannot appear here}} |
122 struct S5 {}; | 132 struct S5 {}; |
123 int c = sizeof(struct [[]] S5); // expected-error {{an attribute list cannot appear here}} | 133 int c = sizeof(struct [[]] S5); // expected-error {{an attribute list cannot appear here}} |