Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6b9412cb0de9b85fe093118b695ee676f09fa7e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
//!Attributed Lambda
//%CPP
auto t = []() mutable throw (char*) [[noreturn]] {
    throw "exception";
}
;

//!Attributed Array New Initialization
//%CPP
int* arr = new int[1][[attr]]{2};

//!Attributed Multidimensional Array
//%CPP
int (*matrix) = new int[2][[attr1]][2][[attr2]];

//!Attributed Label
//%CPP
void foo()
{
    [[attr]] label:
    ;
}

//!Attributed Switch Labels
//%CPP
void foo(int i)
{
    switch (i){
        [[attr]] case 42:
        [[attr]] default:
            ;
    }
}

//!Attributed Expression Statement
//%CPP
void foo()
{
    int i{0};
    [[attr]] i++;
}

//!Attributed Compound Statement
//%CPP
void foo()
{
    [[attr]] {
    }
}

//!Attributed Selection Statement
//%CPP
void foo()
{
    [[attr]] if (false);

}

//!Attributed Iteration Statement
//%CPP
void foo()
{
    [[attr]] while (false);

}

//!Attributed Jump Statement
//%CPP
void foo()
{
    [[attr]] return;
}

//!Attributed Try Block Statement
//%CPP
void foo()
{
    [[attr]] try {
    }
    catch (...){
    }
}

//!Attributed Condition with Initializer
//%CPP
void foo()
{
    if ([[attr]] int i{0});

}

//!Attributed For Range Declaration
//%CPP
void foo()
{
    int a[1]{0};
    for ([[attr]] auto i: a){
    }
}

//!Attributed Alias Declaration
//%CPP
using number [[attr]] = int;

//!Attributed Enum Declaration
//%CPP
enum [[attr]] e{ };

//!Attributed Using Directive
//%CPP
namespace NS
{


}

[[attr]] using namespace NS;

//!Attributed Function Declarator in Definition
//%CPP
void foo() throw (char*) [[noreturn]] -> void
{
    throw "exception";
}

//!Attributed Class
//%CPP
class [[attr]] C
{
};

//!Attributed Exception Declaration
//%CPP
void f()
{
    try {
    }
    catch ([[attr]] int& id){
    }
}

//!Attributed Elaborated Type Specifier
//%CPP
struct [[attr]] S;

//!Attributed Decl Specifier
//%CPP
static int [[int_attr]] v;

//!Attributed Type Specifier
//%CPP
const volatile unsigned long int [[attr]] cvuli;

//!Attributed Ptr Operators
//%CPP
int*[[pointer_attribute]]*[[pointer_attribute]] ipp;

//!Attributed Reference Operator
//%CPP
int&[[ref_attribute]] iRef;

//!Attributed Rvalue Reference Operator
//%CPP
int&&[[rvalue_ref_attribute]] iRvalueRef;

//!Attributed Function Declaration
//%CPP
void foo() [[function_attr]];

//!Attributed Declarator
//%CPP
int ipp [[declarator_attr]];

//!Attributed Array Declarator
//%CPP
int iArr[5][[arr_attr]];

//!Attributed Simple Declaration
//%CPP
[[attr]] int i;

//!Attributed Function Definition
//%CPP
[[attr]] void bar()
{
}

//!Attributed Deleted Constructor
//%CPP
struct S
{
    [[ctor_attr]] S() = delete;
};

//!Attributed Simple Declaration in Statement
//%CPP
void bar()
{
    [[attr]] int i;
}

//!Attributed Do-while Statement 514684
//%CPP
void foo()
{
    [[attr]] do{
    } while (true);
}

//!Attributed For Statement 514684
//%CPP
void foo()
{
    [[attr]] for (int i = 0;i < 10;i++){
    }
}

//!Attributed Range-Based For Statement 514684
//%CPP
void foo()
{
    int a[] = {0, 1, 2};
    [[attr]] for (int n: a){
    }
}

//!Attributed Break Statement 514684
//%CPP
void foo()
{
    while (true){
        [[attr]] break;
    }
}

//!Attributed Continue Statement 514684
//%CPP
void foo()
{
    while (true){
        [[attr]] continue;
    }
}

//!Attributed Goto Statement 514684
//%CPP
void foo()
{
    [[attr]] goto label;
    label:
    ;
}

//!Attributed GNU Goto Statement 514684
//%CPP GNU
void foo()
{
    label2:
    ;
    void* ptr = &&label2;
    [[attr]] goto *ptr;
}

//!Attributed Null Statement 514684
//%CPP
void foo()
{
    [[attr]];
}

//!Attributed Switch Statement 514684
//%CPP
void foo()
{
    [[attr]] switch (1){
        default:
    }
}

//!Empty Attribute
//%CPP
[[]] int i;

//!Multiple Sequential Attribute Specifiers
//%CPP
[[attr]][[attr2]][[attr3]] int i;

//!Multiple Attributes
//%CPP
[[attr1, attr2]] int i;

//!Pack Expansion Attribute
//%CPP
[[attribute ...]] int i;

//!Multiple Pack Expansions Attribute
//%CPP
[[attribute1 ..., attribute2 ...]] int i;

//!Scoped Attribute
//%CPP
[[scope::attribute]] int i;

//!Attribute with Empty Argument
//%CPP
[[attr()]] int i;

//!Attribute with Balanced Argument
//%CPP
[[attr(this(is){[my]}(argument[with]{some},parentheses))]] int i;

//!Attribute with Keyword Argument
//%CPP
[[attr(class)]] int i;

//!GCC Attribute Sequence
//%CPP GNU
void bar(void* a1, void* a2) __attribute__((nonnull(1,2)));

//!GCC Attributed Using Directive
//%CPP GNU
namespace inner
{


}

using namespace inner __attribute__((__strong__));

//!GCC Attributed Namespace Declaration
//%CPP GNU
namespace NS __attribute__((__visibility__("default")))
{


}

//!GCC Attributed Function Definition
//%CPP GNU
inline static int __attribute__((always_inline)) f(int x)
{
    return x;
}

//!GCC Attributed Enum Declaration
//%CPP GNU
enum __attribute__((deprecated)) Obsolete{ o1, o2};

//!GCC Attributed Elaborated Type Specifier
//%CPP GNU
struct __attribute__((declspec)) S;

//!GCC Attributed Pointer Declarator
//%CPP GNU
void (*__attribute__((__stdcall__))*foo3)(int);
char*__attribute__((aligned(8)))* f;

//!GCC Attributed Declarator
//%CPP GNU
void __attribute__((noreturn)) foo();
void (__attribute__((__stdcall__))*foo1)(int);

//!Attributed Enumerator
//%CPP
enum E{ value1 [[attr1]], value2 [[attr2]] = 1};

//!MS declspec attribute on class
//%CPP GNU
__declspec(dllimport) class X
{
} varX;

//!MS declspec attribute on declarator
//%CPP GNU
int __declspec(selectany)* pi2 = 0;

//!MS declspec attribute on simple declaration
//%CPP GNU
__declspec(thread) int tls_i = 1;

//!Attributed structured binding declaration
//%CPP
int arr[]{1, 2, 3};
[[nodiscard]] auto [a, b, c] = arr;

Back to the top