Ruby  3.4.0dev (2024-11-05 revision e440268d51fe02b303e3817a7a733a0dac1c5091)
c_attribute.h
Go to the documentation of this file.
1 #ifndef RBIMPL_HAS_C_ATTRIBUTE_H /*-*-C++-*-vi:se ft=cpp:*/
2 #define RBIMPL_HAS_C_ATTRIBUTE_H
26 
28 #if defined(__cplusplus)
29 # /* Makes no sense. */
30 # define RBIMPL_HAS_C_ATTRIBUTE(_) 0
31 
32 #elif RBIMPL_HAS_EXTENSION(c_attributes)
33 # /* Hmm. It seems Clang 17 has this macro defined even when -std=c99 mode,
34 # * _and_ fails to compile complaining that attributes are C2X feature. We
35 # * need to work around this nonsense. */
36 # define RBIMPL_HAS_C_ATTRIBUTE(_) __has_c_attribute(_)
37 
38 #elif RBIMPL_HAS_WARNING("-Wc2x-extensions")
39 # define RBIMPL_HAS_C_ATTRIBUTE(_) 0
40 
41 #elif defined(__has_c_attribute)
42 # define RBIMPL_HAS_C_ATTRIBUTE(_) __has_c_attribute(_)
43 
44 #else
45 # /* As of writing everything that lacks __has_c_attribute also completely
46 # * lacks C2x attributes as well. Might change in future? */
47 # define RBIMPL_HAS_C_ATTRIBUTE(_) 0
48 #endif
49 
50 #endif /* RBIMPL_HAS_C_ATTRIBUTE_H */
Defines RBIMPL_HAS_WARNING.
Defines RBIMPL_HAS_EXTENSION.