gcc/gcc/testsuite/gcc.dg/c2x-has-c-attribute-3.c

26 lines
663 B
C

/* Test __has_c_attribute. Test GNU attributes. */
/* { dg-do preprocess } */
/* { dg-options "-std=c2x -pedantic-errors" } */
#if __has_c_attribute (gnu::packed) != 1
#error "bad result for gnu::packed"
#endif
#if __has_c_attribute (__gnu__::__packed__) != 1
#error "bad result for __gnu__::__packed__"
#endif
#if __has_c_attribute (gnu::__packed__) != 1
#error "bad result for gnu::__packed__"
#endif
#if __has_c_attribute (__gnu__::packed) != 1
#error "bad result for __gnu__::packed"
#endif
/* GNU attributes should not be reported as accepted without a scope
specified. */
#if __has_c_attribute (packed) != 0
#error "bad result for packed"
#endif