1 /* Test __has_c_attribute.  Test supported attributes.  */
2 /* { dg-do preprocess } */
3 /* { dg-options "-std=c2x -pedantic-errors" } */
4 
5 #if __has_c_attribute ( nodiscard ) != 202003L
6 #error "bad result for nodiscard"
7 #endif
8 
9 #if __has_c_attribute ( __nodiscard__ ) != 202003L
10 #error "bad result for __nodiscard__"
11 #endif
12 
13 #if __has_c_attribute(maybe_unused) != 201904L
14 #error "bad result for maybe_unused"
15 #endif
16 
17 #if __has_c_attribute(__maybe_unused__) != 201904L
18 #error "bad result for __maybe_unused__"
19 #endif
20 
21 #if __has_c_attribute (deprecated) != 201904L
22 #error "bad result for deprecated"
23 #endif
24 
25 #if __has_c_attribute (__deprecated__) != 201904L
26 #error "bad result for __deprecated__"
27 #endif
28 
29 #if __has_c_attribute (fallthrough) != 201904L
30 #error "bad result for fallthrough"
31 #endif
32 
33 #if __has_c_attribute (__fallthrough__) != 201904L
34 #error "bad result for __fallthrough__"
35 #endif
36 
37 /* Macros in the attribute name are expanded.  */
38 #define foo deprecated
39 #if __has_c_attribute (foo) != 201904L
40 #error "bad result for foo"
41 #endif
42