blob: a9958471d640536f62f9e7ad853756699c5eb5a5 [file] [log] [blame]
Richard Smith534986f2012-04-14 00:33:13 +00001// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s
2
3void foo(int i) {
4
Michael Han6880f492012-10-03 01:56:22 +00005 [[unknown_attribute]] ; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
6 [[unknown_attribute]] { } // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
7 [[unknown_attribute]] if (0) { } // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
8 [[unknown_attribute]] for (;;); // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
9 [[unknown_attribute]] do { // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
10 [[unknown_attribute]] continue; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
Richard Smith534986f2012-04-14 00:33:13 +000011 } while (0);
Michael Han6880f492012-10-03 01:56:22 +000012 [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
Richard Smith534986f2012-04-14 00:33:13 +000013
Michael Han6880f492012-10-03 01:56:22 +000014 [[unknown_attribute]] switch (i) { // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
15 [[unknown_attribute]] case 0: // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
16 [[unknown_attribute]] default: // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
17 [[unknown_attribute]] break; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
Richard Smith534986f2012-04-14 00:33:13 +000018 }
19
Michael Han6880f492012-10-03 01:56:22 +000020 [[unknown_attribute]] goto here; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
21 [[unknown_attribute]] here: // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
Richard Smith534986f2012-04-14 00:33:13 +000022
Michael Han6880f492012-10-03 01:56:22 +000023 [[unknown_attribute]] try { // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
Richard Smith534986f2012-04-14 00:33:13 +000024 } catch (...) {
25 }
26
Michael Han6880f492012-10-03 01:56:22 +000027 [[unknown_attribute]] return; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
28
Richard Smith534986f2012-04-14 00:33:13 +000029
Richard Smith33f04a22013-01-29 01:48:07 +000030 alignas(8) ; // expected-warning {{attribute alignas cannot be specified on a statement}}
Richard Smith534986f2012-04-14 00:33:13 +000031 [[noreturn]] { } // expected-warning {{attribute noreturn cannot be specified on a statement}}
32 [[noreturn]] if (0) { } // expected-warning {{attribute noreturn cannot be specified on a statement}}
33 [[noreturn]] for (;;); // expected-warning {{attribute noreturn cannot be specified on a statement}}
34 [[noreturn]] do { // expected-warning {{attribute noreturn cannot be specified on a statement}}
Michael Han6880f492012-10-03 01:56:22 +000035 [[unavailable]] continue; // expected-warning {{unknown attribute 'unavailable' ignored}}
Richard Smith534986f2012-04-14 00:33:13 +000036 } while (0);
Michael Han6880f492012-10-03 01:56:22 +000037 [[unknown_attributqqq]] while (0); // expected-warning {{unknown attribute 'unknown_attributqqq' ignored}}
38 // TODO: remove 'qqq' part and enjoy 'empty loop body' warning here (DiagnoseEmptyLoopBody)
Richard Smith534986f2012-04-14 00:33:13 +000039
Michael Han6880f492012-10-03 01:56:22 +000040 [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
41
42 [[unused]] switch (i) { // expected-warning {{unknown attribute 'unused' ignored}}
43 [[uuid]] case 0: // expected-warning {{unknown attribute 'uuid' ignored}}
44 [[visibility]] default: // expected-warning {{unknown attribute 'visibility' ignored}}
Richard Smith534986f2012-04-14 00:33:13 +000045 [[carries_dependency]] break; // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
46 }
47
Michael Han6880f492012-10-03 01:56:22 +000048 [[fastcall]] goto there; // expected-warning {{unknown attribute 'fastcall' ignored}}
49 [[noinline]] there: // expected-warning {{unknown attribute 'noinline' ignored}}
Richard Smith534986f2012-04-14 00:33:13 +000050
Michael Han6880f492012-10-03 01:56:22 +000051 [[lock_returned]] try { // expected-warning {{unknown attribute 'lock_returned' ignored}}
Richard Smith534986f2012-04-14 00:33:13 +000052 } catch (...) {
53 }
54
Michael Han6880f492012-10-03 01:56:22 +000055 [[weakref]] return; // expected-warning {{unknown attribute 'weakref' ignored}}
56
57 [[carries_dependency]] ; // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
58 [[carries_dependency]] { } // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
59 [[carries_dependency]] if (0) { } // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
60 [[carries_dependency]] for (;;); // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
61 [[carries_dependency]] do { // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
62 [[carries_dependency]] continue; // expected-warning {{attribute carries_dependency cannot be specified on a statement}} ignored}}
63 } while (0);
64 [[carries_dependency]] while (0); // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
65
66 [[carries_dependency]] switch (i) { // expected-warning {{attribute carries_dependency cannot be specified on a statement}} ignored}}
67 [[carries_dependency]] case 0: // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
68 [[carries_dependency]] default: // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
69 [[carries_dependency]] break; // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
70 }
71
72 [[carries_dependency]] goto here; // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
73
74 [[carries_dependency]] try { // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
75 } catch (...) {
76 }
77
78 [[carries_dependency]] return; // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
Richard Smith534986f2012-04-14 00:33:13 +000079}