brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 067974d Raw
42 lines · c
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3#if !__has_extension(pragma_clang_attribute_namespaces)4#error5#endif6 7#pragma clang attribute MyNamespace.push (__attribute__((annotate)), apply_to=function) // expected-error 2 {{'annotate' attribute}}8 9int some_func(void); // 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 16int some_other_func(void); // expected-note 2 {{when applied to this declaration}}17 18// Out of order!19#pragma clang attribute MyNamespace.pop20 21int some_other_other_func(void); // expected-note 1 {{when applied to this declaration}}22 23#pragma clang attribute MyOtherNamespace.pop24 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}}34int test(void); // expected-note{{when applied to this declaration}}35#pragma clang attribute Merp.pop36 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}}40int test2(void); // expected-note{{when applied to this declaration}}41#pragma clang attribute Merp.pop42