1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 #if !__has_extension(pragma_clang_attribute_namespaces) 4 #error 5 #endif 6 7 #pragma clang attribute MyNamespace.push (__attribute__((annotate)), apply_to=function) // expected-error 2 {{'annotate' attribute}} 8 9 int some_func(); // expected-note{{when applied to this declaration}} 10 11 #pragma clang attribute pop // expected-error{{'#pragma clang attribute pop' with no matching '#pragma clang attribute push'}} 12 #pragma clang attribute NotMyNamespace.pop // expected-error{{'#pragma clang attribute NotMyNamespace.pop' with no matching '#pragma clang attribute NotMyNamespace.push'}} 13 14 #pragma clang attribute MyOtherNamespace.push (__attribute__((annotate)), apply_to=function) // expected-error 2 {{'annotate' attribute}} 15 16 int some_other_func(); // expected-note 2 {{when applied to this declaration}} 17 18 // Out of order! 19 #pragma clang attribute MyNamespace.pop 20 21 int some_other_other_func(); // expected-note 1 {{when applied to this declaration}} 22 23 #pragma clang attribute MyOtherNamespace.pop 24 25 #pragma clang attribute Misc. () // expected-error{{namespace can only apply to 'push' or 'pop' directives}} expected-note {{omit the namespace to add attributes to the most-recently pushed attribute group}} 26 27 #pragma clang attribute Misc push // expected-error{{expected '.' after pragma attribute namespace 'Misc'}} 28 29 // Test how pushes with namespaces interact with pushes without namespaces. 30 31 #pragma clang attribute Merp.push (__attribute__((annotate)), apply_to=function) // expected-error{{'annotate' attribute}} 32 #pragma clang attribute push (__attribute__((annotate)), apply_to=function) // expected-warning {{unused attribute}} 33 #pragma clang attribute pop // expected-note{{ends here}} 34 int test(); // expected-note{{when applied to this declaration}} 35 #pragma clang attribute Merp.pop 36 37 #pragma clang attribute push (__attribute__((annotate)), apply_to=function) // expected-warning {{unused attribute}} 38 #pragma clang attribute Merp.push (__attribute__((annotate)), apply_to=function) // expected-error{{'annotate' attribute}} 39 #pragma clang attribute pop // expected-note{{ends here}} 40 int test2(); // expected-note{{when applied to this declaration}} 41 #pragma clang attribute Merp.pop 42