1 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s 2 3 void foo(int i) { 4 5 [[unknown_attribute]] ; 6 [[unknown_attribute]] { } 7 [[unknown_attribute]] if (0) { } 8 [[unknown_attribute]] for (;;); 9 [[unknown_attribute]] do { 10 [[unknown_attribute]] continue; 11 } while (0); 12 [[unknown_attribute]] while (0); 13 14 [[unknown_attribute]] switch (i) { 15 [[unknown_attribute]] case 0: 16 [[unknown_attribute]] default: 17 [[unknown_attribute]] break; 18 } 19 20 [[unknown_attribute]] goto here; 21 [[unknown_attribute]] here: 22 23 [[unknown_attribute]] try { 24 } catch (...) { 25 } 26 27 [[unknown_attribute]] return; 28 29 30 alignas(8) ; // expected-warning {{attribute aligned cannot be specified on a statement}} 31 [[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}} 35 [[unavailable]] continue; // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here 36 } while (0); 37 [[unknown_attributqqq]] while (0); // TODO: remove 'qqq' part and enjoy 'empty loop body' warning here (DiagnoseEmptyLoopBody) 38 [[unknown_attribute]] while (0); // no warning here yet, just an unknown attribute 39 40 [[unused]] switch (i) { // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here 41 [[uuid]] case 0: // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here 42 [[visibility]] default: // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here 43 [[carries_dependency]] break; // expected-warning {{attribute carries_dependency cannot be specified on a statement}} 44 } 45 46 [[fastcall]] goto there; // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here 47 [[noinline]] there: // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here 48 49 [[lock_returned]] try { // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here 50 } catch (...) { 51 } 52 53 [[weakref]] return; // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here 54 } 55