1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 #if !__has_extension(pragma_clang_attribute_namespaces)
7 #pragma clang attribute MyNamespace.push (__attribute__((annotate)), apply_to=function) // expected-error 2 {{'annotate' attribute}}
9 int some_func(void); // expected-note{{when applied to this declaration}}
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'}}
14 #pragma clang attribute MyOtherNamespace.push (__attribute__((annotate)), apply_to=function) // expected-error 2 {{'annotate' attribute}}
16 int some_other_func(void); // expected-note 2 {{when applied to this declaration}}
19 #pragma clang attribute MyNamespace.pop
21 int some_other_other_func(void); // expected-note 1 {{when applied to this declaration}}
23 #pragma clang attribute MyOtherNamespace.pop
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}}
27 #pragma clang attribute Misc push // expected-error{{expected '.' after pragma attribute namespace 'Misc'}}
29 // Test how pushes with namespaces interact with pushes without namespaces.
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(void); // expected-note{{when applied to this declaration}}
35 #pragma clang attribute Merp.pop
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(void); // expected-note{{when applied to this declaration}}
41 #pragma clang attribute Merp.pop