annotate clang/test/Parser/cxx11-stmt-attributes.cpp @ 223:5f17cb93ff66 llvm-original

LLVM13 (2021/7/18)
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:43:00 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 void foo(int i) {
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 [[unknown_attribute]] ; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
6 [[unknown_attribute]] { } // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
7 [[unknown_attribute]] if (0) { } // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
8 [[unknown_attribute]] for (;;); // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
9 [[unknown_attribute]] do { // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
10 [[unknown_attribute]] continue; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
11 } while (0);
anatofuz
parents:
diff changeset
12 [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 [[unknown_attribute]] switch (i) { // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
15 [[unknown_attribute]] case 0: // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
16 [[unknown_attribute]] default: // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
17 [[unknown_attribute]] break; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
18 }
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 [[unknown_attribute]] goto here; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
21 [[unknown_attribute]] here: // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 [[unknown_attribute]] try { // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
24 } catch (...) {
anatofuz
parents:
diff changeset
25 }
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 [[unknown_attribute]] return; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 alignas(8) ; // expected-error {{'alignas' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
31 [[noreturn]] { } // expected-error {{'noreturn' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
32 [[noreturn]] if (0) { } // expected-error {{'noreturn' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
33 [[noreturn]] for (;;); // expected-error {{'noreturn' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
34 [[noreturn]] do { // expected-error {{'noreturn' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
35 [[unavailable]] continue; // expected-warning {{unknown attribute 'unavailable' ignored}}
anatofuz
parents:
diff changeset
36 } while (0);
anatofuz
parents:
diff changeset
37 [[unknown_attributqqq]] while (0); // expected-warning {{unknown attribute 'unknown_attributqqq' ignored}}
anatofuz
parents:
diff changeset
38 // TODO: remove 'qqq' part and enjoy 'empty loop body' warning here (DiagnoseEmptyLoopBody)
anatofuz
parents:
diff changeset
39
anatofuz
parents:
diff changeset
40 [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
anatofuz
parents:
diff changeset
41
anatofuz
parents:
diff changeset
42 [[unused]] switch (i) { // expected-warning {{unknown attribute 'unused' ignored}}
anatofuz
parents:
diff changeset
43 [[uuid]] case 0: // expected-warning {{unknown attribute 'uuid' ignored}}
anatofuz
parents:
diff changeset
44 [[visibility]] default: // expected-warning {{unknown attribute 'visibility' ignored}}
anatofuz
parents:
diff changeset
45 [[carries_dependency]] break; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
46 }
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 [[fastcall]] goto there; // expected-warning {{unknown attribute 'fastcall' ignored}}
anatofuz
parents:
diff changeset
49 [[noinline]] there: // expected-warning {{unknown attribute 'noinline' ignored}}
anatofuz
parents:
diff changeset
50
anatofuz
parents:
diff changeset
51 [[lock_returned]] try { // expected-warning {{unknown attribute 'lock_returned' ignored}}
anatofuz
parents:
diff changeset
52 } catch (...) {
anatofuz
parents:
diff changeset
53 }
anatofuz
parents:
diff changeset
54
anatofuz
parents:
diff changeset
55 [[weakref]] return; // expected-warning {{unknown attribute 'weakref' ignored}}
anatofuz
parents:
diff changeset
56
anatofuz
parents:
diff changeset
57 [[carries_dependency]] ; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
58 [[carries_dependency]] { } // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
59 [[carries_dependency]] if (0) { } // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
60 [[carries_dependency]] for (;;); // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
61 [[carries_dependency]] do { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
62 [[carries_dependency]] continue; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} ignored}}
anatofuz
parents:
diff changeset
63 } while (0);
anatofuz
parents:
diff changeset
64 [[carries_dependency]] while (0); // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
65
anatofuz
parents:
diff changeset
66 [[carries_dependency]] switch (i) { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} ignored}}
anatofuz
parents:
diff changeset
67 [[carries_dependency]] case 0: // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
68 [[carries_dependency]] default: // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
69 [[carries_dependency]] break; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
70 }
anatofuz
parents:
diff changeset
71
anatofuz
parents:
diff changeset
72 [[carries_dependency]] goto here; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
73
anatofuz
parents:
diff changeset
74 [[carries_dependency]] try { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
75 } catch (...) {
anatofuz
parents:
diff changeset
76 }
anatofuz
parents:
diff changeset
77
anatofuz
parents:
diff changeset
78 [[carries_dependency]] return; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
79
anatofuz
parents:
diff changeset
80 {
anatofuz
parents:
diff changeset
81 [[ ]] // expected-error {{an attribute list cannot appear here}}
anatofuz
parents:
diff changeset
82 #pragma STDC FP_CONTRACT ON // expected-error {{can only appear at file scope or at the start of a compound statement}}
anatofuz
parents:
diff changeset
83 #pragma clang fp contract(fast) // expected-error {{can only appear at file scope or at the start of a compound statement}}
anatofuz
parents:
diff changeset
84 }
anatofuz
parents:
diff changeset
85 }