1 #ifndef INTERNAL_COMPILERS_H
2 #define INTERNAL_COMPILERS_H
19 #include "ruby/backward/2/gcc_version_since.h"
21 #define MSC_VERSION_SINCE(_) RBIMPL_COMPILER_SINCE(MSVC, (_) / 100, (_) % 100, 0)
22 #define MSC_VERSION_BEFORE(_) RBIMPL_COMPILER_BEFORE(MSVC, (_) / 100, (_) % 100, 0)
24 #ifndef __has_attribute
25 # define __has_attribute(...) RBIMPL_HAS_ATTRIBUTE(__VA_ARGS__)
28 #ifndef __has_c_attribute
31 # define __has_c_attribute(...) 0
34 #ifndef __has_declspec_attribute
35 # define __has_declspec_attribute(...) RBIMPL_HAS_DECLSPEC_ATTRIBUTE(__VA_ARGS__)
39 # define __has_builtin(...) RBIMPL_HAS_BUILTIN(__VA_ARGS__)
43 # define __has_feature(...) RBIMPL_HAS_FEATURE(__VA_ARGS__)
46 #ifndef __has_extension
47 # define __has_extension(...) RBIMPL_HAS_EXTENSION(__VA_ARGS__)
51 # define __has_warning(...) RBIMPL_HAS_WARNING(__VA_ARGS__)
55 # define __extension__
59 # define MAYBE_UNUSED(x) x
62 #ifndef WARN_UNUSED_RESULT
63 # define WARN_UNUSED_RESULT(x) x
66 #define RB_OBJ_BUILTIN_TYPE(obj) rb_obj_builtin_type(obj)
67 #define OBJ_BUILTIN_TYPE(obj) RB_OBJ_BUILTIN_TYPE(obj)
69 #define rb_obj_builtin_type(obj) \
71 VALUE arg_obj = (obj); \
72 RB_SPECIAL_CONST_P(arg_obj) ? -1 : \
73 (int)RB_BUILTIN_TYPE(arg_obj); \
78 rb_obj_builtin_type(
VALUE obj)
86 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
88 #elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
89 # define FLEX_ARY_LEN 0
91 # define FLEX_ARY_LEN 1
101 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
102 # define BITFIELD(type, name, size) type name : size
104 # define BITFIELD(type, name, size) unsigned int name : size
Defines RBIMPL_HAS_ATTRIBUTE.
Defines RBIMPL_HAS_C_ATTRIBUTE.
Defines RBIMPL_COMPILER_SINCE.
Defines RBIMPL_HAS_DECLSPEC_ATTRIBUTE.
Defines RBIMPL_HAS_EXTENSION.
Defines RBIMPL_HAS_FEATURE.
Defines RBIMPL_HAS_WARNING.
Defines RBIMPL_HAS_BUILTIN.
static bool RB_SPECIAL_CONST_P(VALUE obj)
Checks if the given object is of enum ruby_special_consts.
uintptr_t VALUE
Type that represents a Ruby object.
static enum ruby_value_type RB_BUILTIN_TYPE(VALUE obj)
Queries the type of the object.