10 #ifndef RUBY_DEFINES_H 11 #define RUBY_DEFINES_H 1 13 #if defined(__cplusplus) 20 #include "ruby/config.h" 22 #include RUBY_EXTCONF_H 27 # define CONSTFUNC(x) x 30 # define PUREFUNC(x) x 32 #define NORETURN_STYLE_NEW 1 34 # define NORETURN(x) x 37 # define DEPRECATED(x) x 40 # define DEPRECATED_BY(n,x) DEPRECATED(x) 42 #ifndef DEPRECATED_TYPE 43 # define DEPRECATED_TYPE(mesg, decl) decl 46 # define NOINLINE(x) x 49 # define ALWAYS_INLINE(x) x 52 # define HAVE_ATTRIBUTE_ERRORFUNC 0 53 # define ERRORFUNC(mesg, x) x 55 # define HAVE_ATTRIBUTE_ERRORFUNC 1 58 # define HAVE_ATTRIBUTE_WARNINGFUNC 0 59 # define WARNINGFUNC(mesg, x) x 61 # define HAVE_ATTRIBUTE_WARNINGFUNC 1 64 #ifndef GCC_VERSION_SINCE 65 # if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__) 66 # define GCC_VERSION_SINCE(major, minor, patchlevel) \ 67 ((__GNUC__ > (major)) || \ 68 ((__GNUC__ == (major) && \ 69 ((__GNUC_MINOR__ > (minor)) || \ 70 (__GNUC_MINOR__ == (minor) && __GNUC_PATCHLEVEL__ >= (patchlevel)))))) 72 # define GCC_VERSION_SINCE(major, minor, patchlevel) 0 78 #define RB_LIKELY(x) (__builtin_expect(!!(x), 1)) 79 #define RB_UNLIKELY(x) (__builtin_expect(!!(x), 0)) 81 #define RB_LIKELY(x) (x) 82 #define RB_UNLIKELY(x) (x) 86 #define PRINTF_ARGS(decl, string_index, first_to_check) \ 87 decl __attribute__((format(printf, string_index, first_to_check))) 89 #define PRINTF_ARGS(decl, string_index, first_to_check) decl 93 #define RB_GNUC_EXTENSION __extension__ 94 #define RB_GNUC_EXTENSION_BLOCK(x) __extension__ ({ x; }) 96 #define RB_GNUC_EXTENSION 97 #define RB_GNUC_EXTENSION_BLOCK(x) (x) 102 #ifdef HAVE_SYS_TYPES_H 103 # include <sys/types.h> 105 #ifdef HAVE_SYS_STAT_H 106 # include <sys/stat.h> 112 # ifdef HAVE_STDLIB_H 117 # if !defined STDC_HEADERS && defined HAVE_MEMORY_H 122 #ifdef HAVE_STRINGS_H 123 # include <strings.h> 125 #ifdef HAVE_INTTYPES_H 126 # include <inttypes.h> 135 #ifdef HAVE_SYS_SELECT_H 136 # include <sys/select.h> 139 #ifdef RUBY_USE_SETJMPEX 140 #include <setjmpex.h> 148 # ifndef HAVE_PROTOTYPES 149 # define HAVE_PROTOTYPES 1 151 # ifndef HAVE_STDARG_PROTOTYPES 152 # define HAVE_STDARG_PROTOTYPES 1 157 #ifdef HAVE_PROTOTYPES 158 # define _(args) args 164 #ifdef HAVE_STDARG_PROTOTYPES 165 # define __(args) args 176 #ifndef RUBY_SYMBOL_EXPORT_BEGIN 177 # define RUBY_SYMBOL_EXPORT_BEGIN 178 # define RUBY_SYMBOL_EXPORT_END 183 #define xmalloc ruby_xmalloc 184 #define xmalloc2 ruby_xmalloc2 185 #define xcalloc ruby_xcalloc 186 #define xrealloc ruby_xrealloc 187 #define xrealloc2 ruby_xrealloc2 188 #define xfree ruby_xfree 190 #if GCC_VERSION_SINCE(4,3,0) 191 # define RUBY_ATTR_ALLOC_SIZE(params) __attribute__ ((alloc_size params)) 193 # define RUBY_ATTR_ALLOC_SIZE(params) 203 #define STRINGIZE(expr) STRINGIZE0(expr) 205 #define STRINGIZE0(expr) #expr 208 #ifdef HAVE_LONG_LONG 209 # define HAVE_TRUE_LONG_LONG 1 212 #if SIZEOF_LONG_LONG > 0 213 # define LONG_LONG long long 214 #elif SIZEOF___INT64 > 0 215 # define HAVE_LONG_LONG 1 216 # define LONG_LONG __int64 217 # undef SIZEOF_LONG_LONG 218 # define SIZEOF_LONG_LONG SIZEOF___INT64 232 # define DOSISH_DRIVE_LETTER 235 #ifdef AC_APPLE_UNIVERSAL_BUILD 236 #undef WORDS_BIGENDIAN 237 #ifdef __BIG_ENDIAN__ 238 #define WORDS_BIGENDIAN 252 # error FALSE must be false 257 # error TRUE must be true 262 #ifndef RUBY_FUNC_EXPORTED 263 #define RUBY_FUNC_EXPORTED 267 #define RUBY_EXTERN extern 271 # if defined __GNUC__ 272 # define EXTERN _Pragma("message \"EXTERN is deprecated, use RUBY_EXTERN instead\""); \ 274 # elif defined _MSC_VER 275 # define EXTERN __pragma(message(__FILE__"("STRINGIZE(__LINE__)"): warning: "\ 276 "EXTERN is deprecated, use RUBY_EXTERN instead")); \ 279 # define EXTERN <-<-"EXTERN is deprecated, use RUBY_EXTERN instead"->-> 283 #ifndef RUBY_MBCHAR_MAXSIZE 284 #define RUBY_MBCHAR_MAXSIZE INT_MAX 290 # define FLUSH_REGISTER_WINDOWS rb_sparc_flush_register_windows() 291 #elif defined(__ia64) 292 void *rb_ia64_bsp(
void);
293 void rb_ia64_flushrs(
void);
294 # define FLUSH_REGISTER_WINDOWS rb_ia64_flushrs() 296 # define FLUSH_REGISTER_WINDOWS ((void)0) 304 #define PATH_SEP_CHAR PATH_SEP[0] 306 #define PATH_ENV "PATH" 309 #define ENV_IGNORECASE 312 #ifndef CASEFOLD_FILESYSTEM 314 # define CASEFOLD_FILESYSTEM 1 316 # define CASEFOLD_FILESYSTEM 0 321 #define DLEXT_MAXLEN 4 324 #ifndef RUBY_PLATFORM 325 #define RUBY_PLATFORM "unknown-unknown" 328 #ifndef FUNC_MINIMIZED 329 #define FUNC_MINIMIZED(x) x 331 #ifndef FUNC_UNOPTIMIZED 332 #define FUNC_UNOPTIMIZED(x) x 334 #ifndef RUBY_ALIAS_FUNCTION_TYPE 335 #define RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) \ 336 FUNC_MINIMIZED(type prot) {return (type)name args;} 338 #ifndef RUBY_ALIAS_FUNCTION_VOID 339 #define RUBY_ALIAS_FUNCTION_VOID(prot, name, args) \ 340 FUNC_MINIMIZED(void prot) {name args;} 342 #ifndef RUBY_ALIAS_FUNCTION 343 #define RUBY_ALIAS_FUNCTION(prot, name, args) \ 344 RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args) 347 #ifndef UNALIGNED_WORD_ACCESS 348 # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ 349 defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \ 350 defined(__powerpc64__) || \ 352 # define UNALIGNED_WORD_ACCESS 1 354 # define UNALIGNED_WORD_ACCESS 0 357 #ifndef PACKED_STRUCT 358 # define PACKED_STRUCT(x) x 360 #ifndef PACKED_STRUCT_UNALIGNED 361 # if UNALIGNED_WORD_ACCESS 362 # define PACKED_STRUCT_UNALIGNED(x) PACKED_STRUCT(x) 364 # define PACKED_STRUCT_UNALIGNED(x) x 370 #if defined(__cplusplus)
#define RUBY_ATTR_ALLOC_SIZE(params)
#define RUBY_SYMBOL_EXPORT_END
#define RUBY_SYMBOL_EXPORT_BEGIN
void rb_sparc_flush_register_windows(void)