Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s |
| 2 | |
| 3 | void foo(int i) { |
| 4 | |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 5 | [[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 Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 11 | } while (0); |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 12 | [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}} |
Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 13 | |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 14 | [[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 Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 18 | } |
| 19 | |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 20 | [[unknown_attribute]] goto here; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} |
| 21 | [[unknown_attribute]] here: // expected-warning {{unknown attribute 'unknown_attribute' ignored}} |
Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 22 | |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 23 | [[unknown_attribute]] try { // expected-warning {{unknown attribute 'unknown_attribute' ignored}} |
Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 24 | } catch (...) { |
| 25 | } |
| 26 | |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 27 | [[unknown_attribute]] return; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} |
| 28 | |
Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 29 | |
Richard Smith | 0532140 | 2013-02-19 23:47:15 +0000 | [diff] [blame] | 30 | alignas(8) ; // expected-error {{'alignas' attribute cannot be applied to a statement}} |
| 31 | [[noreturn]] { } // expected-error {{'noreturn' attribute cannot be applied to a statement}} |
| 32 | [[noreturn]] if (0) { } // expected-error {{'noreturn' attribute cannot be applied to a statement}} |
| 33 | [[noreturn]] for (;;); // expected-error {{'noreturn' attribute cannot be applied to a statement}} |
| 34 | [[noreturn]] do { // expected-error {{'noreturn' attribute cannot be applied to a statement}} |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 35 | [[unavailable]] continue; // expected-warning {{unknown attribute 'unavailable' ignored}} |
Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 36 | } while (0); |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 37 | [[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 Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 39 | |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 40 | [[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 Smith | 0532140 | 2013-02-19 23:47:15 +0000 | [diff] [blame] | 45 | [[carries_dependency]] break; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 46 | } |
| 47 | |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 48 | [[fastcall]] goto there; // expected-warning {{unknown attribute 'fastcall' ignored}} |
| 49 | [[noinline]] there: // expected-warning {{unknown attribute 'noinline' ignored}} |
Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 50 | |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 51 | [[lock_returned]] try { // expected-warning {{unknown attribute 'lock_returned' ignored}} |
Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 52 | } catch (...) { |
| 53 | } |
| 54 | |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 55 | [[weakref]] return; // expected-warning {{unknown attribute 'weakref' ignored}} |
| 56 | |
Richard Smith | 0532140 | 2013-02-19 23:47:15 +0000 | [diff] [blame] | 57 | [[carries_dependency]] ; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
| 58 | [[carries_dependency]] { } // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
| 59 | [[carries_dependency]] if (0) { } // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
| 60 | [[carries_dependency]] for (;;); // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
| 61 | [[carries_dependency]] do { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
| 62 | [[carries_dependency]] continue; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} ignored}} |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 63 | } while (0); |
Richard Smith | 0532140 | 2013-02-19 23:47:15 +0000 | [diff] [blame] | 64 | [[carries_dependency]] while (0); // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 65 | |
Richard Smith | 0532140 | 2013-02-19 23:47:15 +0000 | [diff] [blame] | 66 | [[carries_dependency]] switch (i) { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} ignored}} |
| 67 | [[carries_dependency]] case 0: // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
| 68 | [[carries_dependency]] default: // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
| 69 | [[carries_dependency]] break; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 70 | } |
| 71 | |
Richard Smith | 0532140 | 2013-02-19 23:47:15 +0000 | [diff] [blame] | 72 | [[carries_dependency]] goto here; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 73 | |
Richard Smith | 0532140 | 2013-02-19 23:47:15 +0000 | [diff] [blame] | 74 | [[carries_dependency]] try { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
Michael Han | 6880f49 | 2012-10-03 01:56:22 +0000 | [diff] [blame] | 75 | } catch (...) { |
| 76 | } |
| 77 | |
Richard Smith | 0532140 | 2013-02-19 23:47:15 +0000 | [diff] [blame] | 78 | [[carries_dependency]] return; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} |
Richard Smith | 534986f | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 79 | } |