| 1 |
/* Test __has_c_attribute. Test basic properties. */ |
| 2 |
/* { dg-do preprocess } */ |
| 3 |
/* { dg-options "-std=c23 -pedantic-errors" } */ |
| 4 |
|
| 5 |
#ifdef __has_c_attribute |
| 6 |
/* OK. */ |
| 7 |
#else |
| 8 |
#error "__has_c_attribute not defined" |
| 9 |
#endif |
| 10 |
|
| 11 |
#ifndef __has_c_attribute |
| 12 |
#error "__has_c_attribute not defined" |
| 13 |
#endif |
| 14 |
|
| 15 |
#if defined __has_c_attribute |
| 16 |
/* OK. */ |
| 17 |
#else |
| 18 |
#error "__has_c_attribute not defined" |
| 19 |
#endif |
| 20 |
|
| 21 |
#if __has_c_attribute(foo) |
| 22 |
#error "foo attribute supported" |
| 23 |
#endif |
| 24 |
|
| 25 |
#if 0 |
| 26 |
#elif __has_c_attribute(foo) |
| 27 |
#error "foo attribute supported" |
| 28 |
#endif |