Ruby 3.5.0dev (2025-02-22 revision 412997300569c1853c09813e4924b6df3d7e8669)
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.