Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
compilers.h
Go to the documentation of this file.
1#ifndef INTERNAL_COMPILERS_H /*-*-C-*-vi:se ft=c:*/
2#define INTERNAL_COMPILERS_H
21
22#define MSC_VERSION_SINCE(_) RBIMPL_COMPILER_SINCE(MSVC, (_) / 100, (_) % 100, 0)
23#define MSC_VERSION_BEFORE(_) RBIMPL_COMPILER_BEFORE(MSVC, (_) / 100, (_) % 100, 0)
24
25#ifndef __has_attribute
26# define __has_attribute(...) RBIMPL_HAS_ATTRIBUTE(__VA_ARGS__)
27#endif
28
29#ifndef __has_c_attribute
30# /* As of writing everything that lacks __has_c_attribute also completely
31# * lacks C2x attributes as well. Might change in future? */
32# define __has_c_attribute(...) 0
33#endif
34
35#ifndef __has_declspec_attribute
36# define __has_declspec_attribute(...) RBIMPL_HAS_DECLSPEC_ATTRIBUTE(__VA_ARGS__)
37#endif
38
39#ifndef __has_builtin
40# define __has_builtin(...) RBIMPL_HAS_BUILTIN(__VA_ARGS__)
41#endif
42
43#ifndef __has_feature
44# define __has_feature(...) RBIMPL_HAS_FEATURE(__VA_ARGS__)
45#endif
46
47#ifndef __has_extension
48# define __has_extension(...) RBIMPL_HAS_EXTENSION(__VA_ARGS__)
49#endif
50
51#ifndef __has_warning
52# define __has_warning(...) RBIMPL_HAS_WARNING(__VA_ARGS__)
53#endif
54
55#ifndef __GNUC__
56# define __extension__ /* void */
57#endif
58
59#ifndef MAYBE_UNUSED
60# define MAYBE_UNUSED(x) x
61#endif
62
63#ifndef WARN_UNUSED_RESULT
64# define WARN_UNUSED_RESULT(x) x
65#endif
66
67#define RB_OBJ_BUILTIN_TYPE(obj) rb_obj_builtin_type(obj)
68#define OBJ_BUILTIN_TYPE(obj) RB_OBJ_BUILTIN_TYPE(obj)
69#ifdef __GNUC__
70#define rb_obj_builtin_type(obj) \
71__extension__({ \
72 VALUE arg_obj = (obj); \
73 RB_SPECIAL_CONST_P(arg_obj) ? -1 : \
74 (int)RB_BUILTIN_TYPE(arg_obj); \
75 })
76#else
77# include "ruby/ruby.h"
78static inline int
80{
81 return RB_SPECIAL_CONST_P(obj) ? -1 :
82 (int)RB_BUILTIN_TYPE(obj);
83}
84#endif
85
86/* A macro for defining a flexible array, like: VALUE ary[FLEX_ARY_LEN]; */
87#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
88# define FLEX_ARY_LEN /* VALUE ary[]; */
89#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
90# define FLEX_ARY_LEN 0 /* VALUE ary[0]; */
91#else
92# define FLEX_ARY_LEN 1 /* VALUE ary[1]; */
93#endif
94
95/*
96 * For declaring bitfields out of non-unsigned int types:
97 * struct date {
98 * BITFIELD(enum months, month, 4);
99 * ...
100 * };
101 */
102#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
103# define BITFIELD(type, name, size) type name : size
104#else
105# define BITFIELD(type, name, size) unsigned int name : size
106#endif
107
108#endif /* INTERNAL_COMPILERS_H */
Defines RBIMPL_HAS_ATTRIBUTE.
Defines RBIMPL_HAS_C_ATTRIBUTE.
Defines RBIMPL_COMPILER_SINCE.
#define rb_obj_builtin_type(obj)
Definition: compilers.h:70
Defines RBIMPL_HAS_DECLSPEC_ATTRIBUTE.
Defines RBIMPL_HAS_EXTENSION.
Defines RBIMPL_HAS_FEATURE.
Defines old GCC_VERSION_SINCE.
Defines RBIMPL_HAS_WARNING.
Defines RBIMPL_HAS_BUILTIN.
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
unsigned long VALUE
Definition: value.h:38