1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s 2*f4a2713aSLionel Sambuc foo(int i)3*f4a2713aSLionel Sambucvoid foo(int i) { 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambuc [[unknown_attribute]] ; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 6*f4a2713aSLionel Sambuc [[unknown_attribute]] { } // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 7*f4a2713aSLionel Sambuc [[unknown_attribute]] if (0) { } // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 8*f4a2713aSLionel Sambuc [[unknown_attribute]] for (;;); // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 9*f4a2713aSLionel Sambuc [[unknown_attribute]] do { // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 10*f4a2713aSLionel Sambuc [[unknown_attribute]] continue; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 11*f4a2713aSLionel Sambuc } while (0); 12*f4a2713aSLionel Sambuc [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc [[unknown_attribute]] switch (i) { // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 15*f4a2713aSLionel Sambuc [[unknown_attribute]] case 0: // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 16*f4a2713aSLionel Sambuc [[unknown_attribute]] default: // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 17*f4a2713aSLionel Sambuc [[unknown_attribute]] break; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 18*f4a2713aSLionel Sambuc } 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc [[unknown_attribute]] goto here; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 21*f4a2713aSLionel Sambuc [[unknown_attribute]] here: // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc [[unknown_attribute]] try { // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 24*f4a2713aSLionel Sambuc } catch (...) { 25*f4a2713aSLionel Sambuc } 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc [[unknown_attribute]] return; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 28*f4a2713aSLionel Sambuc 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc alignas(8) ; // expected-error {{'alignas' attribute cannot be applied to a statement}} 31*f4a2713aSLionel Sambuc [[noreturn]] { } // expected-error {{'noreturn' attribute cannot be applied to a statement}} 32*f4a2713aSLionel Sambuc [[noreturn]] if (0) { } // expected-error {{'noreturn' attribute cannot be applied to a statement}} 33*f4a2713aSLionel Sambuc [[noreturn]] for (;;); // expected-error {{'noreturn' attribute cannot be applied to a statement}} 34*f4a2713aSLionel Sambuc [[noreturn]] do { // expected-error {{'noreturn' attribute cannot be applied to a statement}} 35*f4a2713aSLionel Sambuc [[unavailable]] continue; // expected-warning {{unknown attribute 'unavailable' ignored}} 36*f4a2713aSLionel Sambuc } while (0); 37*f4a2713aSLionel Sambuc [[unknown_attributqqq]] while (0); // expected-warning {{unknown attribute 'unknown_attributqqq' ignored}} 38*f4a2713aSLionel Sambuc // TODO: remove 'qqq' part and enjoy 'empty loop body' warning here (DiagnoseEmptyLoopBody) 39*f4a2713aSLionel Sambuc 40*f4a2713aSLionel Sambuc [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}} 41*f4a2713aSLionel Sambuc 42*f4a2713aSLionel Sambuc [[unused]] switch (i) { // expected-warning {{unknown attribute 'unused' ignored}} 43*f4a2713aSLionel Sambuc [[uuid]] case 0: // expected-warning {{unknown attribute 'uuid' ignored}} 44*f4a2713aSLionel Sambuc [[visibility]] default: // expected-warning {{unknown attribute 'visibility' ignored}} 45*f4a2713aSLionel Sambuc [[carries_dependency]] break; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 46*f4a2713aSLionel Sambuc } 47*f4a2713aSLionel Sambuc 48*f4a2713aSLionel Sambuc [[fastcall]] goto there; // expected-warning {{unknown attribute 'fastcall' ignored}} 49*f4a2713aSLionel Sambuc [[noinline]] there: // expected-warning {{unknown attribute 'noinline' ignored}} 50*f4a2713aSLionel Sambuc 51*f4a2713aSLionel Sambuc [[lock_returned]] try { // expected-warning {{unknown attribute 'lock_returned' ignored}} 52*f4a2713aSLionel Sambuc } catch (...) { 53*f4a2713aSLionel Sambuc } 54*f4a2713aSLionel Sambuc 55*f4a2713aSLionel Sambuc [[weakref]] return; // expected-warning {{unknown attribute 'weakref' ignored}} 56*f4a2713aSLionel Sambuc 57*f4a2713aSLionel Sambuc [[carries_dependency]] ; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 58*f4a2713aSLionel Sambuc [[carries_dependency]] { } // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 59*f4a2713aSLionel Sambuc [[carries_dependency]] if (0) { } // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 60*f4a2713aSLionel Sambuc [[carries_dependency]] for (;;); // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 61*f4a2713aSLionel Sambuc [[carries_dependency]] do { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 62*f4a2713aSLionel Sambuc [[carries_dependency]] continue; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} ignored}} 63*f4a2713aSLionel Sambuc } while (0); 64*f4a2713aSLionel Sambuc [[carries_dependency]] while (0); // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 65*f4a2713aSLionel Sambuc 66*f4a2713aSLionel Sambuc [[carries_dependency]] switch (i) { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} ignored}} 67*f4a2713aSLionel Sambuc [[carries_dependency]] case 0: // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 68*f4a2713aSLionel Sambuc [[carries_dependency]] default: // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 69*f4a2713aSLionel Sambuc [[carries_dependency]] break; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 70*f4a2713aSLionel Sambuc } 71*f4a2713aSLionel Sambuc 72*f4a2713aSLionel Sambuc [[carries_dependency]] goto here; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 73*f4a2713aSLionel Sambuc 74*f4a2713aSLionel Sambuc [[carries_dependency]] try { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 75*f4a2713aSLionel Sambuc } catch (...) { 76*f4a2713aSLionel Sambuc } 77*f4a2713aSLionel Sambuc 78*f4a2713aSLionel Sambuc [[carries_dependency]] return; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} 79*f4a2713aSLionel Sambuc 80*f4a2713aSLionel Sambuc { 81*f4a2713aSLionel Sambuc [[ ]] // expected-error {{an attribute list cannot appear here}} 82*f4a2713aSLionel Sambuc #pragma STDC FP_CONTRACT ON // expected-error {{can only appear at file scope or at the start of a compound statement}} 83*f4a2713aSLionel Sambuc } 84*f4a2713aSLionel Sambuc } 85