summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/array.h18
-rw-r--r--internal/bignum.h14
-rw-r--r--internal/bits.h12
-rw-r--r--internal/class.h12
-rw-r--r--internal/compar.h10
-rw-r--r--internal/compile.h12
-rw-r--r--internal/compilers.h184
-rw-r--r--internal/complex.h10
-rw-r--r--internal/cont.h10
-rw-r--r--internal/dir.h10
-rw-r--r--internal/enc.h10
-rw-r--r--internal/encoding.h10
-rw-r--r--internal/enum.h10
-rw-r--r--internal/enumerator.h10
-rw-r--r--internal/error.h34
-rw-r--r--internal/eval.h10
-rw-r--r--internal/file.h10
-rw-r--r--internal/fixnum.h14
-rw-r--r--internal/gc.h22
-rw-r--r--internal/hash.h18
-rw-r--r--internal/imemo.h14
-rw-r--r--internal/inits.h10
-rw-r--r--internal/io.h10
-rw-r--r--internal/load.h10
-rw-r--r--internal/loadpath.h10
-rw-r--r--internal/math.h10
-rw-r--r--internal/missing.h12
-rw-r--r--internal/mjit.h12
-rw-r--r--internal/numeric.h10
-rw-r--r--internal/object.h10
-rw-r--r--internal/parse.h10
-rw-r--r--internal/proc.h10
-rw-r--r--internal/process.h12
-rw-r--r--internal/random.h10
-rw-r--r--internal/range.h10
-rw-r--r--internal/rational.h12
-rw-r--r--internal/re.h12
-rw-r--r--internal/sanitizers.h14
-rw-r--r--internal/serial.h12
-rw-r--r--internal/signal.h10
-rw-r--r--internal/static_assert.h29
-rw-r--r--internal/stdbool.h34
-rw-r--r--internal/string.h14
-rw-r--r--internal/struct.h17
-rw-r--r--internal/symbol.h10
-rw-r--r--internal/thread.h10
-rw-r--r--internal/time.h12
-rw-r--r--internal/transcode.h12
-rw-r--r--internal/util.h12
-rw-r--r--internal/variable.h14
-rw-r--r--internal/vm.h12
-rw-r--r--internal/warnings.h52
52 files changed, 328 insertions, 560 deletions
diff --git a/internal/array.h b/internal/array.h
index 1c5de4bb32..b566f48435 100644
--- a/internal/array.h
+++ b/internal/array.h
@@ -1,18 +1,18 @@
-#ifndef INTERNAL_ARRAY_H /* -*- C -*- */
-#define INTERNAL_ARRAY_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Array.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Array.
*/
-#include "ruby/config.h"
+#ifndef INTERNAL_ARRAY_H
+#define INTERNAL_ARRAY_H
+#include "ruby/3/config.h"
#include <stddef.h> /* for size_t */
#include "internal/static_assert.h" /* for STATIC_ASSERT */
-#include "internal/stdbool.h" /* for bool */
+#include "ruby/3/stdbool.h" /* for bool */
#include "ruby/ruby.h" /* for RARRAY_LEN */
#ifndef ARRAY_DEBUG
@@ -87,7 +87,9 @@ RARY_TRANSIENT_UNSET(VALUE ary)
}
#undef rb_ary_new_from_args
-#if defined(__GNUC__) && defined(HAVE_VA_ARGS_MACRO)
+#if RUBY3_HAS_WARNING("-Wgnu-zero-variadic-macro-arguments")
+# /* Skip it; clang -pedantic doesn't like the following */
+#elif defined(__GNUC__) && defined(HAVE_VA_ARGS_MACRO)
#define rb_ary_new_from_args(n, ...) \
__extension__ ({ \
const VALUE args_to_new_ary[] = {__VA_ARGS__}; \
diff --git a/internal/bignum.h b/internal/bignum.h
index 508386452c..a49ecd8c0e 100644
--- a/internal/bignum.h
+++ b/internal/bignum.h
@@ -1,22 +1,22 @@
-#ifndef INTERNAL_BIGNUM_H /* -*- C -*- */
-#define INTERNAL_BIGNUM_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Bignums.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Bignums.
*/
-#include "ruby/config.h" /* for HAVE_LIBGMP */
+#ifndef INTERNAL_BIGNUM_H
+#define INTERNAL_BIGNUM_H
+#include "ruby/3/config.h" /* for HAVE_LIBGMP */
#include <stddef.h> /* for size_t */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h> /* for ssize_t (note: on Windows ssize_t is */
#endif /* `#define`d in ruby/config.h) */
-#include "internal/stdbool.h" /* for bool */
+#include "ruby/3/stdbool.h" /* for bool */
#include "ruby/ruby.h" /* for struct RBasic */
#ifndef BDIGIT
diff --git a/internal/bits.h b/internal/bits.h
index 410c2b9a97..32ec1cd36c 100644
--- a/internal/bits.h
+++ b/internal/bits.h
@@ -1,13 +1,11 @@
-#ifndef INTERNAL_BITS_H /* -*- C -*- */
-#define INTERNAL_BITS_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for bitwise integer algorithms.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for bitwise integer algorithms.
* @see Henry S. Warren Jr., "Hacker's Delight" (2nd ed.), 2013.
* @see SEI CERT C Coding Standard INT32-C. "Ensure that operations on
* signed integers do not result in overflow"
@@ -26,7 +24,9 @@
* @see https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_rotr64
* @see https://stackoverflow.com/a/776523
*/
-#include "ruby/config.h"
+#ifndef INTERNAL_BITS_H
+#define INTERNAL_BITS_H
+#include "ruby/3/config.h"
#include <limits.h> /* for CHAR_BITS */
#include <stdint.h> /* for uintptr_t */
#include "internal/compilers.h" /* for MSC_VERSION_SINCE */
diff --git a/internal/class.h b/internal/class.h
index 67ea6e2a83..f5df0a6a70 100644
--- a/internal/class.h
+++ b/internal/class.h
@@ -1,18 +1,18 @@
-#ifndef INTERNAL_CLASS_H /* -*- C -*- */
-#define INTERNAL_CLASS_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Class.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Class.
*/
+#ifndef INTERNAL_CLASS_H
+#define INTERNAL_CLASS_H
#include "id_table.h" /* for struct rb_id_table */
#include "internal/gc.h" /* for RB_OBJ_WRITE */
#include "internal/serial.h" /* for rb_serial_t */
-#include "internal/stdbool.h" /* for bool */
+#include "ruby/3/stdbool.h" /* for bool */
#include "ruby/intern.h" /* for rb_alloc_func_t */
#include "ruby/ruby.h" /* for struct RBasic */
diff --git a/internal/compar.h b/internal/compar.h
index a2808d62be..aba1cdf25e 100644
--- a/internal/compar.h
+++ b/internal/compar.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_COMPAR_H /* -*- C -*- */
-#define INTERNAL_COMPAR_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Comparable.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Comparable.
*/
+#ifndef INTERNAL_COMPAR_H
+#define INTERNAL_COMPAR_H
#include "internal/vm.h" /* for rb_method_basic_definition_p */
#define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString)
diff --git a/internal/compile.h b/internal/compile.h
index 43ca055198..468d3d0a6b 100644
--- a/internal/compile.h
+++ b/internal/compile.h
@@ -1,15 +1,15 @@
-#ifndef INTERNAL_COMPILE_H /* -*- C -*- */
-#define INTERNAL_COMPILE_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for the compiler.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for the compiler.
*/
-#include "ruby/config.h"
+#ifndef INTERNAL_COMPILE_H
+#define INTERNAL_COMPILE_H
+#include "ruby/3/config.h"
#include <stddef.h> /* for size_t */
#include "ruby/ruby.h" /* for rb_event_flag_t */
diff --git a/internal/compilers.h b/internal/compilers.h
index bdaaa20a21..591b5de9ed 100644
--- a/internal/compilers.h
+++ b/internal/compilers.h
@@ -1,61 +1,29 @@
-#ifndef INTERNAL_COMPILERS_H /* -*- C -*- */
-#define INTERNAL_COMPILERS_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header absorbing C compipler differences.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header absorbing C compipler differences.
*/
-#include "ruby/defines.h" /* for GCC_VERSION_SINCE */
+#ifndef INTERNAL_COMPILERS_H
+#define INTERNAL_COMPILERS_H
+#include "ruby/3/compiler_since.h"
+#include "ruby/3/has/attribute.h"
+#include "ruby/3/has/builtin.h"
+#include "ruby/3/has/c_attribute.h"
+#include "ruby/3/has/declspec_attribute.h"
+#include "ruby/3/has/extension.h"
+#include "ruby/3/has/feature.h"
+#include "ruby/3/has/warning.h"
+#include "ruby/backward/2/gcc_version_since.h"
-#ifdef _MSC_VER
-# define MSC_VERSION_SINCE(_) (_MSC_VER >= _)
-# define MSC_VERSION_BEFORE(_) (_MSC_VER < _)
-#else
-# define MSC_VERSION_SINCE(_) 0
-# define MSC_VERSION_BEFORE(_) 0
-#endif
+#define MSC_VERSION_SINCE(_) RUBY3_COMPILER_SINCE(MSVC, (_) / 100, (_) % 100, 0)
+#define MSC_VERSION_BEFORE(_) RUBY3_COMPILER_BEFORE(MSVC, (_) / 100, (_) % 100, 0)
#ifndef __has_attribute
-# define __has_attribute(...) __has_attribute_##__VA_ARGS__
-# /* GCC <= 4 lacks __has_attribute predefined macro, while has attributes
-# * themselves. We can simulate the macro like the following: */
-# define __has_attribute_aligned GCC_VERSION_SINCE(0, 0, 0)
-# define __has_attribute_alloc_size GCC_VERSION_SINCE(4, 3, 0)
-# define __has_attribute_artificial GCC_VERSION_SINCE(4, 3, 0)
-# define __has_attribute_always_inline GCC_VERSION_SINCE(3, 1, 0)
-# define __has_attribute_cdecl GCC_VERSION_SINCE(0, 0, 0)
-# define __has_attribute_cold GCC_VERSION_SINCE(4, 3, 0)
-# define __has_attribute_const GCC_VERSION_SINCE(2, 6, 0)
-# define __has_attribute_deprecated GCC_VERSION_SINCE(3, 1, 0)
-# define __has_attribute_dllexport GCC_VERSION_SINCE(0, 0, 0)
-# define __has_attribute_dllimport GCC_VERSION_SINCE(0, 0, 0)
-# define __has_attribute_error GCC_VERSION_SINCE(4, 3, 0)
-# define __has_attribute_format GCC_VERSION_SINCE(0, 0, 0)
-# define __has_attribute_hot GCC_VERSION_SINCE(4, 3, 0)
-# define __has_attribute_leaf GCC_VERSION_SINCE(4, 6, 0)
-# define __has_attribute_malloc GCC_VERSION_SINCE(3, 0, 0)
-# define __has_attribute_no_address_safety_analysis GCC_VERSION_SINCE(4, 8, 0)
-# define __has_attribute_no_sanitize_address GCC_VERSION_SINCE(4, 8, 0)
-# define __has_attribute_no_sanitize_undefined GCC_VERSION_SINCE(4, 9, 0)
-# define __has_attribute_noinline GCC_VERSION_SINCE(3, 1, 0)
-# define __has_attribute_nonnull GCC_VERSION_SINCE(3, 3, 0)
-# define __has_attribute_noreturn GCC_VERSION_SINCE(2, 5, 0)
-# define __has_attribute_nothrow GCC_VERSION_SINCE(3, 3, 0)
-# define __has_attribute_pure GCC_VERSION_SINCE(2, 96, 0)
-# define __has_attribute_returns_nonnull GCC_VERSION_SINCE(4, 9, 0)
-# define __has_attribute_returns_twice GCC_VERSION_SINCE(4, 1, 0)
-# define __has_attribute_stdcall GCC_VERSION_SINCE(0, 0, 0)
-# define __has_attribute_unused GCC_VERSION_SINCE(0, 0, 0)
-# define __has_attribute_visibility GCC_VERSION_SINCE(3, 3, 0)
-# define __has_attribute_visibility GCC_VERSION_SINCE(3, 3, 0)
-# define __has_attribute_warn_unused_result GCC_VERSION_SINCE(3, 4, 0)
-# define __has_attribute_warning GCC_VERSION_SINCE(4, 3, 0)
-# define __has_attribute_weak GCC_VERSION_SINCE(0, 0, 0)
-# /* Note that 0,0,0 might be inaccurate. */
+# define __has_attribute(...) RUBY3_HAS_ATTRIBUTE(__VA_ARGS__)
#endif
#ifndef __has_c_attribute
@@ -65,127 +33,23 @@
#endif
#ifndef __has_declspec_attribute
-# define __has_declspec_attribute(...) __has_declspec_attribute_##__VA_ARGS__
-# define __has_declspec_attribute_align MSC_VERSION_SINCE( 800)
-# define __has_declspec_attribute_deprecated MSC_VERSION_SINCE(1300)
-# define __has_declspec_attribute_dllexport MSC_VERSION_SINCE( 800)
-# define __has_declspec_attribute_dllimport MSC_VERSION_SINCE( 800)
-# define __has_declspec_attribute_noalias MSC_VERSION_SINCE( 800)
-# define __has_declspec_attribute_noinline MSC_VERSION_SINCE(1300)
-# define __has_declspec_attribute_noreturn MSC_VERSION_SINCE(1100)
-# define __has_declspec_attribute_nothrow MSC_VERSION_SINCE( 800)
-# define __has_declspec_attribute_restrict MSC_VERSION_SINCE( 800)
-# /* Note that 800 might be inaccurate. */
+# define __has_declspec_attribute(...) RUBY3_HAS_DECLSPEC_ATTRIBUTE(__VA_ARGS__)
#endif
#ifndef __has_builtin
-# /* :FIXME: Historically GCC has had tons of builtins, but it implemented
-# * __has_builtin only since GCC 10. This section can be made more
-# * granular. */
-# /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66970 */
-# define __has_builtin(...) __has_builtin_##__VA_ARGS__
-# define __has_builtin____builtin_add_overflow GCC_VERSION_SINCE(5, 1, 0)
-# define __has_builtin____builtin_bswap16 GCC_VERSION_SINCE(4, 8, 0) /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 */
-# define __has_builtin____builtin_bswap32 GCC_VERSION_SINCE(3, 6, 0)
-# define __has_builtin____builtin_bswap64 GCC_VERSION_SINCE(3, 6, 0)
-# define __has_builtin____builtin_clz GCC_VERSION_SINCE(3, 6, 0)
-# define __has_builtin____builtin_clzl GCC_VERSION_SINCE(3, 6, 0)
-# define __has_builtin____builtin_clzll GCC_VERSION_SINCE(3, 6, 0)
-# define __has_builtin____builtin_constant_p GCC_VERSION_SINCE(2,95, 3)
-# define __has_builtin____builtin_ctz GCC_VERSION_SINCE(3, 6, 0)
-# define __has_builtin____builtin_ctzl GCC_VERSION_SINCE(3, 6, 0)
-# define __has_builtin____builtin_ctzll GCC_VERSION_SINCE(3, 6, 0)
-# define __has_builtin____builtin_mul_overflow GCC_VERSION_SINCE(5, 1, 0)
-# define __has_builtin____builtin_mul_overflow_p GCC_VERSION_SINCE(7, 0, 0)
-# define __has_builtin____builtin_popcount GCC_VERSION_SINCE(3, 6, 0)
-# define __has_builtin____builtin_popcountl GCC_VERSION_SINCE(3, 6, 0)
-# define __has_builtin____builtin_popcountll GCC_VERSION_SINCE(3, 6, 0)
-# define __has_builtin____builtin_sub_overflow GCC_VERSION_SINCE(5, 1, 0)
-# /* Take config.h definition when available */
-# ifdef HAVE_BUILTIN____BUILTIN_ADD_OVERFLOW
-# undef __has_builtin____builtin_add_overflow
-# define __has_builtin____builtin_add_overflow HAVE_BUILTIN____BUILTIN_ADD_OVERFLOW
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_BSWAP16
-# undef __has_builtin____builtin_bswap16
-# define __has_builtin____builtin_bswap16 HAVE_BUILTIN____BUILTIN_BSWAP16
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_BSWAP32
-# undef __has_builtin____builtin_bswap32
-# define __has_builtin____builtin_bswap16 HAVE_BUILTIN____BUILTIN_BSWAP32
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_BSWAP64
-# undef __has_builtin____builtin_bswap64
-# define __has_builtin____builtin_bswap64 HAVE_BUILTIN____BUILTIN_BSWAP64
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_CLZ
-# undef __has_builtin____builtin_clz
-# define __has_builtin____builtin_clz HAVE_BUILTIN____BUILTIN_CLZ
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_CLZL
-# undef __has_builtin____builtin_clzl
-# define __has_builtin____builtin_clzl HAVE_BUILTIN____BUILTIN_CLZL
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_CLZLL
-# undef __has_builtin____builtin_clzll
-# define __has_builtin____builtin_clzll HAVE_BUILTIN____BUILTIN_CLZLL
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_CONSTANT_P
-# undef __has_builtin____builtin_constant_p
-# define __has_builtin____builtin_constant_p HAVE_BUILTIN____BUILTIN_CONSTANT_P
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_CTZ
-# undef __has_builtin____builtin_ctz
-# define __has_builtin____builtin_ctz HAVE_BUILTIN____BUILTIN_CTZ
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_CTZL
-# undef __has_builtin____builtin_ctzl
-# define __has_builtin____builtin_ctzl HAVE_BUILTIN____BUILTIN_CTZL
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_CTZLL
-# undef __has_builtin____builtin_ctzll
-# define __has_builtin____builtin_ctzll HAVE_BUILTIN____BUILTIN_CTZLL
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_MUL_OVERFLOW
-# undef __has_builtin____builtin_mul_overflow
-# define __has_builtin____builtin_mul_overflow HAVE_BUILTIN____BUILTIN_MUL_OVERFLOW
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_MUL_OVERFLOW_P
-# undef __has_builtin____builtin_mul_overflow_p
-# define __has_builtin____builtin_mul_overflow_p HAVE_BUILTIN____BUILTIN_MUL_OVERFLOW_P
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_POPCOUNT
-# undef __has_builtin____builtin_popcount
-# define __has_builtin____builtin_popcount HAVE_BUILTIN____BUILTIN_POPCOUNT
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_POPCOUNTL
-# undef __has_builtin____builtin_popcountl
-# define __has_builtin____builtin_popcountl HAVE_BUILTIN____BUILTIN_POPCOUNTL
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_POPCOUNTLL
-# undef __has_builtin____builtin_popcountll
-# define __has_builtin____builtin_popcountll HAVE_BUILTIN____BUILTIN_POPCOUNTLL
-# endif
-# ifdef HAVE_BUILTIN____BUILTIN_SUB_OVERFLOW
-# undef __has_builtin____builtin_SUB_overflow
-# define __has_builtin____builtin_sub_overflow HAVE_BUILTIN____BUILTIN_SUB_OVERFLOW
-# endif
+# define __has_builtin(...) RUBY3_HAS_BUILTIN(__VA_ARGS__)
#endif
#ifndef __has_feature
-# define __has_feature(...) 0
+# define __has_feature(...) RUBY3_HAS_FEATURE(__VA_ARGS__)
#endif
#ifndef __has_extension
-# /* Pre-3.0 clang had __has_feature but not __has_extension. */
-# define __has_extension __has_feature
+# define __has_extension(...) RUBY3_HAS_EXTENSION(__VA_ARGS__)
#endif
#ifndef __has_warning
-# /* We cannot simulate __has_warning like the ones above, because it takes
-# * string liteals (we can stringize a macro arugment but there is no such
-# * thing like an unquote of strrings). */
-# define __has_warning(...) 0
+# define __has_warning(...) RUBY3_HAS_WARNING(__VA_ARGS__)
#endif
#ifndef __GNUC__
@@ -207,7 +71,7 @@
__extension__({ \
VALUE arg_obj = (obj); \
RB_SPECIAL_CONST_P(arg_obj) ? -1 : \
- RB_BUILTIN_TYPE(arg_obj); \
+ (int)RB_BUILTIN_TYPE(arg_obj); \
})
#else
# include "ruby/ruby.h"
@@ -215,7 +79,7 @@ static inline int
rb_obj_builtin_type(VALUE obj)
{
return RB_SPECIAL_CONST_P(obj) ? -1 :
- RB_BUILTIN_TYPE(obj);
+ (int)RB_BUILTIN_TYPE(obj);
}
#endif
diff --git a/internal/complex.h b/internal/complex.h
index 0a8ecfb0d9..f435f143ef 100644
--- a/internal/complex.h
+++ b/internal/complex.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_COMPLEX_H /* -*- C -*- */
-#define INTERNAL_COMPLEX_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Complex.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Complex.
*/
+#ifndef INTERNAL_COMPLEX_H
+#define INTERNAL_COMPLEX_H
#include "ruby/ruby.h" /* for struct RBasic */
struct RComplex {
diff --git a/internal/cont.h b/internal/cont.h
index f77fb20a5c..9b7dd9a9e4 100644
--- a/internal/cont.h
+++ b/internal/cont.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_CONT_H /* -*- C -*- */
-#define INTERNAL_CONT_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Fiber.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Fiber.
*/
+#ifndef INTERNAL_CONT_H
+#define INTERNAL_CONT_H
#include "ruby/ruby.h" /* for VALUE */
struct rb_thread_struct; /* in vm_core.h */
diff --git a/internal/dir.h b/internal/dir.h
index 07312f327e..fa165b67bd 100644
--- a/internal/dir.h
+++ b/internal/dir.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_DIR_H /* -*- C -*- */
-#define INTERNAL_DIR_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Dir.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Dir.
*/
+#ifndef INTERNAL_DIR_H
+#define INTERNAL_DIR_H
#include "ruby/ruby.h" /* for VALUE */
/* dir.c */
diff --git a/internal/enc.h b/internal/enc.h
index 8c28c69357..79a52b94a8 100644
--- a/internal/enc.h
+++ b/internal/enc.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_ENC_H /* -*- C -*- */
-#define INTERNAL_ENC_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Encoding.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Encoding.
*/
+#ifndef INTERNAL_ENC_H
+#define INTERNAL_ENC_H
#include "ruby/encoding.h" /* for rb_encoding */
/* us_ascii.c */
diff --git a/internal/encoding.h b/internal/encoding.h
index 1489065d3a..62a35093e7 100644
--- a/internal/encoding.h
+++ b/internal/encoding.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_ENCODING_H /* -*- C -*- */
-#define INTERNAL_ENCODING_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Encoding.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Encoding.
*/
+#ifndef INTERNAL_ENCODING_H
+#define INTERNAL_ENCODING_H
#include "ruby/ruby.h" /* for ID */
#include "ruby/encoding.h" /* for rb_encoding */
diff --git a/internal/enum.h b/internal/enum.h
index 70eec55c7f..d14a7b367a 100644
--- a/internal/enum.h
+++ b/internal/enum.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_ENUM_H /* -*- C -*- */
-#define INTERNAL_ENUM_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Enumerable.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Enumerable.
*/
+#ifndef INTERNAL_ENUM_H
+#define INTERNAL_ENUM_H
#include "ruby/ruby.h" /* for VALUE */
/* enum.c */
diff --git a/internal/enumerator.h b/internal/enumerator.h
index e4575f2c49..f9b3fdac4f 100644
--- a/internal/enumerator.h
+++ b/internal/enumerator.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_ENUMERATOR_H /* -*- C -*- */
-#define INTERNAL_ENUMERATOR_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Enumerator.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Enumerator.
*/
+#ifndef INTERNAL_ENUMERATOR_H
+#define INTERNAL_ENUMERATOR_H
#include "ruby/ruby.h" /* for VALUE */
#include "ruby/intern.h" /* for rb_enumerator_size_func */
diff --git a/internal/error.h b/internal/error.h
index ebedc9bc1e..5b44f25624 100644
--- a/internal/error.h
+++ b/internal/error.h
@@ -1,18 +1,18 @@
-#ifndef INTERNAL_ERROR_H /* -*- C -*- */
-#define INTERNAL_ERROR_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Exception.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Exception.
*/
-#include "ruby/config.h"
+#ifndef INTERNAL_ERROR_H
+#define INTERNAL_ERROR_H
+#include "ruby/3/config.h"
#include <stdarg.h> /* for va_list */
-#include "internal/stdbool.h" /* for bool */
#include "internal/string.h" /* for rb_fstring_cstr */
+#include "ruby/3/stdbool.h" /* for bool */
#include "ruby/encoding.h" /* for rb_encoding */
#include "ruby/intern.h" /* for rb_exc_raise */
#include "ruby/ruby.h" /* for enum ruby_value_type */
@@ -76,7 +76,6 @@ static inline bool rb_typeddata_is_instance_of_inline(VALUE obj, const rb_data_t
RUBY_SYMBOL_EXPORT_BEGIN
/* error.c (export) */
int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
-NORETURN(void rb_unexpected_type(VALUE,int));
#ifdef RUBY_FUNCTION_NAME_STRING
NORETURN(void rb_sys_fail_path_in(const char *func_name, VALUE path));
NORETURN(void rb_syserr_fail_path_in(const char *func_name, int err, VALUE path));
@@ -118,25 +117,6 @@ rb_key_err_raise(VALUE mesg, VALUE recv, VALUE name)
rb_exc_raise(exc);
}
-static inline void
-Check_Type(VALUE v, enum ruby_value_type t)
-{
- if (! RB_TYPE_P(v, (int)t)) {
- goto unexpected;
- }
- else if (t != T_DATA) {
- return;
- }
- else if (! RTYPEDDATA_P(v)) {
- goto unexpected;
- }
- else {
- return;
- }
- unexpected:
- rb_unexpected_type(v, t);
-}
-
static inline bool
rb_typeddata_is_instance_of_inline(VALUE obj, const rb_data_type_t *data_type)
{
diff --git a/internal/eval.h b/internal/eval.h
index 86729a8ff0..75c07692d4 100644
--- a/internal/eval.h
+++ b/internal/eval.h
@@ -1,16 +1,16 @@
-#ifndef INTERNAL_EVAL_H /* -*- C -*- */
-#define INTERNAL_EVAL_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for the evaluator.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for the evaluator.
* @note There also is eval_intern.h, which is evaluator's internal
* header (related to this file, but not the same role).
*/
+#ifndef INTERNAL_EVAL_H
+#define INTERNAL_EVAL_H
#include "ruby/ruby.h" /* for ID */
#define id_signo ruby_static_id_signo
diff --git a/internal/file.h b/internal/file.h
index ac65ddad3c..4b87d0dddf 100644
--- a/internal/file.h
+++ b/internal/file.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_FILE_H /* -*- C -*- */
-#define INTERNAL_FILE_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for File.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for File.
*/
+#ifndef INTERNAL_FILE_H
+#define INTERNAL_FILE_H
#include "ruby/ruby.h" /* for VALUE */
#include "ruby/encoding.h" /* for rb_encodinng */
diff --git a/internal/fixnum.h b/internal/fixnum.h
index a388ddb36a..f6313855eb 100644
--- a/internal/fixnum.h
+++ b/internal/fixnum.h
@@ -1,18 +1,18 @@
-#ifndef INTERNAL_FIXNUM_H /* -*- C -*- */
-#define INTERNAL_FIXNUM_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Fixnums.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Fixnums.
*/
-#include "ruby/config.h" /* for HAVE_LONG_LONG */
+#ifndef INTERNAL_FIXNUM_H
+#define INTERNAL_FIXNUM_H
+#include "ruby/3/config.h" /* for HAVE_LONG_LONG */
#include <limits.h> /* for CHAR_BIT */
#include "internal/compilers.h" /* for __has_builtin */
-#include "internal/stdbool.h" /* for bool */
+#include "ruby/3/stdbool.h" /* for bool */
#include "ruby/intern.h" /* for rb_big_mul */
#include "ruby/ruby.h" /* for RB_FIXABLE */
diff --git a/internal/gc.h b/internal/gc.h
index 86a3113b62..451f461de0 100644
--- a/internal/gc.h
+++ b/internal/gc.h
@@ -1,15 +1,15 @@
-#ifndef INTERNAL_GC_H /* -*- C -*- */
-#define INTERNAL_GC_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for GC.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for GC.
*/
-#include "ruby/config.h"
+#ifndef INTERNAL_GC_H
+#define INTERNAL_GC_H
+#include "ruby/3/config.h"
#include <stddef.h> /* for size_t */
@@ -58,7 +58,7 @@ struct rb_objspace; /* in vm_core.h */
/* gc.c */
extern VALUE *ruby_initial_gc_stress_ptr;
extern int ruby_disable_gc;
-void *ruby_mimmalloc(size_t size) RUBY_ATTR_MALLOC;
+RUBY_ATTR_MALLOC void *ruby_mimmalloc(size_t size);
void ruby_mimfree(void *ptr);
void rb_objspace_set_event_hook(const rb_event_flag_t event);
VALUE rb_objspace_gc_enable(struct rb_objspace *);
@@ -68,13 +68,13 @@ void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj);
#if __has_attribute(alloc_align)
__attribute__((__alloc_align__(1)))
#endif
-void *rb_aligned_malloc(size_t, size_t) RUBY_ATTR_MALLOC RUBY_ATTR_ALLOC_SIZE((2));
+RUBY_ATTR_MALLOC void *rb_aligned_malloc(size_t, size_t) RUBY_ATTR_ALLOC_SIZE((2));
size_t rb_size_mul_or_raise(size_t, size_t, VALUE); /* used in compile.c */
size_t rb_size_mul_add_or_raise(size_t, size_t, size_t, VALUE); /* used in iseq.h */
-void *rb_xmalloc_mul_add(size_t, size_t, size_t) RUBY_ATTR_MALLOC;
+RUBY_ATTR_MALLOC void *rb_xmalloc_mul_add(size_t, size_t, size_t);
void *rb_xrealloc_mul_add(const void *, size_t, size_t, size_t);
-void *rb_xmalloc_mul_add_mul(size_t, size_t, size_t, size_t) RUBY_ATTR_MALLOC;
-void *rb_xcalloc_mul_add_mul(size_t, size_t, size_t, size_t) RUBY_ATTR_MALLOC;
+RUBY_ATTR_MALLOC void *rb_xmalloc_mul_add_mul(size_t, size_t, size_t, size_t);
+RUBY_ATTR_MALLOC void *rb_xcalloc_mul_add_mul(size_t, size_t, size_t, size_t);
static inline void *ruby_sized_xrealloc_inlined(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2));
static inline void *ruby_sized_xrealloc2_inlined(void *ptr, size_t new_count, size_t elemsiz, size_t old_count) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2, 3));
static inline void ruby_sized_xfree_inlined(void *ptr, size_t size);
diff --git a/internal/hash.h b/internal/hash.h
index 90a27fd189..4c2e663a65 100644
--- a/internal/hash.h
+++ b/internal/hash.h
@@ -1,17 +1,17 @@
-#ifndef INTERNAL_HASH_H /* -*- C -*- */
-#define INTERNAL_HASH_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Hash.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Hash.
*/
-#include "ruby/config.h"
+#ifndef INTERNAL_HASH_H
+#define INTERNAL_HASH_H
+#include "ruby/3/config.h"
#include <stddef.h> /* for size_t */
-#include "internal/stdbool.h" /* for bool */
+#include "ruby/3/stdbool.h" /* for bool */
#include "ruby/ruby.h" /* for struct RBasic */
#include "ruby/st.h" /* for struct st_table */
@@ -200,9 +200,9 @@ RHASH_ST_CLEAR(VALUE h)
static inline unsigned
RHASH_AR_TABLE_SIZE_RAW(VALUE h)
{
- unsigned ret = FL_TEST_RAW(h, RHASH_AR_TABLE_SIZE_MASK);
+ VALUE ret = FL_TEST_RAW(h, RHASH_AR_TABLE_SIZE_MASK);
ret >>= RHASH_AR_TABLE_SIZE_SHIFT;
- return ret;
+ return (unsigned)ret;
}
static inline bool
diff --git a/internal/imemo.h b/internal/imemo.h
index f09a195e7b..3475606e90 100644
--- a/internal/imemo.h
+++ b/internal/imemo.h
@@ -1,19 +1,19 @@
-#ifndef INTERNAL_IMEMO_H /* -*- C -*- */
-#define INTERNAL_IMEMO_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief IMEMO: Internal memo object.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief IMEMO: Internal memo object.
*/
-#include "ruby/config.h"
+#ifndef INTERNAL_IMEMO_H
+#define INTERNAL_IMEMO_H
+#include "ruby/3/config.h"
#include <stddef.h> /* for size_t */
#include "internal/array.h" /* for rb_ary_tmp_new_fill */
#include "internal/gc.h" /* for RB_OBJ_WRITE */
-#include "internal/stdbool.h" /* for bool */
+#include "ruby/3/stdbool.h" /* for bool */
#include "ruby/ruby.h" /* for rb_block_call_func_t */
#ifndef IMEMO_DEBUG
diff --git a/internal/inits.h b/internal/inits.h
index c9ef513728..e0d417455d 100644
--- a/internal/inits.h
+++ b/internal/inits.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_INITS_H /* -*- C -*- */
-#define INTERNAL_INITS_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header aggregating init functions.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header aggregating init functions.
*/
+#ifndef INTERNAL_INITS_H
+#define INTERNAL_INITS_H
/* class.c */
void Init_class_hierarchy(void);
diff --git a/internal/io.h b/internal/io.h
index acdb4ffab7..a08601faea 100644
--- a/internal/io.h
+++ b/internal/io.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_IO_H /* -*- C -*- */
-#define INTERNAL_IO_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for IO.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for IO.
*/
+#ifndef INTERNAL_IO_H
+#define INTERNAL_IO_H
#include "ruby/ruby.h" /* for VALUE */
#include "ruby/io.h" /* for rb_io_t */
diff --git a/internal/load.h b/internal/load.h
index 17eb2552bf..febf9eb200 100644
--- a/internal/load.h
+++ b/internal/load.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_LOAD_H /* -*- C -*- */
-#define INTERNAL_LOAD_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for require.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for require.
*/
+#ifndef INTERNAL_LOAD_H
+#define INTERNAL_LOAD_H
#include "ruby/ruby.h" /* for VALUE */
/* load.c */
diff --git a/internal/loadpath.h b/internal/loadpath.h
index df8078924c..b975d4992d 100644
--- a/internal/loadpath.h
+++ b/internal/loadpath.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_LOADPATH_H /* -*- C -*- */
-#define INTERNAL_LOADPATH_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for $LOAD_PATH.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for $LOAD_PATH.
*/
+#ifndef INTERNAL_LOADPATH_H
+#define INTERNAL_LOADPATH_H
/* loadpath.c */
extern const char ruby_exec_prefix[];
diff --git a/internal/math.h b/internal/math.h
index ec46f47f48..bbf4f798dd 100644
--- a/internal/math.h
+++ b/internal/math.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_MATH_H /* -*- C -*- */
-#define INTERNAL_MATH_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Math.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Math.
*/
+#ifndef INTERNAL_MATH_H
+#define INTERNAL_MATH_H
#include "ruby/ruby.h" /* for VALUE */
/* math.c */
diff --git a/internal/missing.h b/internal/missing.h
index bb62495ff7..866b8aa472 100644
--- a/internal/missing.h
+++ b/internal/missing.h
@@ -1,15 +1,15 @@
-#ifndef INTERNAL_MISSING_H /* -*- C -*- */
-#define INTERNAL_MISSING_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header corresponding missing.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header corresponding missing.
*/
-#include "ruby/config.h" /* for HAVE_SETPROCTITLE */
+#ifndef INTERNAL_MISSING_H
+#define INTERNAL_MISSING_H
+#include "ruby/3/config.h" /* for HAVE_SETPROCTITLE */
/* missing/setproctitle.c */
#ifndef HAVE_SETPROCTITLE
diff --git a/internal/mjit.h b/internal/mjit.h
index 84cc611197..47f620bc39 100644
--- a/internal/mjit.h
+++ b/internal/mjit.h
@@ -1,15 +1,15 @@
-#ifndef INTERNAL_MJIT_H /* -*- C -*- */
-#define INTERNAL_MJIT_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for MJIT.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for MJIT.
*/
-#include "internal/stdbool.h" /* for bool */
+#ifndef INTERNAL_MJIT_H
+#define INTERNAL_MJIT_H
+#include "ruby/3/stdbool.h" /* for bool */
#include "ruby/ruby.h" /* for VALUE */
/* mjit.c */
diff --git a/internal/numeric.h b/internal/numeric.h
index a5875fbbff..cd5347f5d2 100644
--- a/internal/numeric.h
+++ b/internal/numeric.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_NUMERIC_H /* -*- C -*- */
-#define INTERNAL_NUMERIC_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Numeric.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Numeric.
*/
+#ifndef INTERNAL_NUMERIC_H
+#define INTERNAL_NUMERIC_H
#include "internal/bignum.h" /* for BIGNUM_POSITIVE_P */
#include "internal/bits.h" /* for RUBY_BIT_ROTL */
#include "internal/fixnum.h" /* for FIXNUM_POSITIVE_P */
diff --git a/internal/object.h b/internal/object.h
index 959400a47a..a2d053bbb4 100644
--- a/internal/object.h
+++ b/internal/object.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_OBJECT_H /* -*- C -*- */
-#define INTERNAL_OBJECT_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Object.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Object.
*/
+#ifndef INTERNAL_OBJECT_H
+#define INTERNAL_OBJECT_H
#include "ruby/ruby.h" /* for VALUE */
/* object.c */
diff --git a/internal/parse.h b/internal/parse.h
index 782c06a437..bcfe0c2d0e 100644
--- a/internal/parse.h
+++ b/internal/parse.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_PARSE_H /* -*- C -*- */
-#define INTERNAL_PARSE_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for the parser.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for the parser.
*/
+#ifndef INTERNAL_PARSE_H
+#define INTERNAL_PARSE_H
#include "ruby/ruby.h" /* for VALUE */
struct rb_iseq_struct; /* in vm_core.h */
diff --git a/internal/proc.h b/internal/proc.h
index 35bc43a4ee..aebaf28fb0 100644
--- a/internal/proc.h
+++ b/internal/proc.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_PROC_H /* -*- C -*- */
-#define INTERNAL_PROC_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Proc.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Proc.
*/
+#ifndef INTERNAL_PROC_H
+#define INTERNAL_PROC_H
#include "ruby/ruby.h" /* for rb_block_call_func_t */
#include "ruby/st.h" /* for st_index_t */
struct rb_block; /* in vm_core.h */
diff --git a/internal/process.h b/internal/process.h
index c62b95bf80..5c8af817a8 100644
--- a/internal/process.h
+++ b/internal/process.h
@@ -1,15 +1,15 @@
-#ifndef INTERNAL_PROCESS_H /* -*- C -*- */
-#define INTERNAL_PROCESS_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Process.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Process.
*/
-#include "ruby/config.h" /* for rb_pid_t */
+#ifndef INTERNAL_PROCESS_H
+#define INTERNAL_PROCESS_H
+#include "ruby/3/config.h" /* for rb_pid_t */
#include <stddef.h> /* for size_t */
#ifdef HAVE_SYS_TYPES_H
diff --git a/internal/random.h b/internal/random.h
index 87fcc48988..008b644700 100644
--- a/internal/random.h
+++ b/internal/random.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_RANDOM_H /* -*- C -*- */
-#define INTERNAL_RANDOM_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Random.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Random.
*/
+#ifndef INTERNAL_RANDOM_H
+#define INTERNAL_RANDOM_H
#include <stddef.h> /* for size_t */
/* random.c */
diff --git a/internal/range.h b/internal/range.h
index 86ff92379a..948072ebf0 100644
--- a/internal/range.h
+++ b/internal/range.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_RANGE_H /* -*- C -*- */
-#define INTERNAL_RANGE_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Range.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Range.
*/
+#ifndef INTERNAL_RANGE_H
+#define INTERNAL_RANGE_H
#include "internal/struct.h" /* for RSTRUCT */
/* range.c */
diff --git a/internal/rational.h b/internal/rational.h
index d514050641..1e64b4a799 100644
--- a/internal/rational.h
+++ b/internal/rational.h
@@ -1,15 +1,15 @@
-#ifndef INTERNAL_RATIONAL_H /* -*- C -*- */
-#define INTERNAL_RATIONAL_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Rational.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Rational.
*/
-#include "ruby/config.h" /* for HAVE_LIBGMP */
+#ifndef INTERNAL_RATIONAL_H
+#define INTERNAL_RATIONAL_H
+#include "ruby/3/config.h" /* for HAVE_LIBGMP */
#include "ruby/ruby.h" /* for struct RBasic */
#include "internal/gc.h" /* for RB_OBJ_WRITE */
#include "internal/numeric.h" /* for INT_POSITIVE_P */
diff --git a/internal/re.h b/internal/re.h
index 9cf8439345..b769ce30b3 100644
--- a/internal/re.h
+++ b/internal/re.h
@@ -1,15 +1,15 @@
-#ifndef INTERNAL_RE_H /* -*- C -*- */
-#define INTERNAL_RE_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Regexp.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Regexp.
*/
-#include "internal/stdbool.h" /* for bool */
+#ifndef INTERNAL_RE_H
+#define INTERNAL_RE_H
+#include "ruby/3/stdbool.h" /* for bool */
#include "ruby/ruby.h" /* for VALUE */
/* re.c */
diff --git a/internal/sanitizers.h b/internal/sanitizers.h
index e64a04bbe4..7ef5959916 100644
--- a/internal/sanitizers.h
+++ b/internal/sanitizers.h
@@ -1,15 +1,15 @@
-#ifndef INTERNAL_SANITIZERS_H /* -*- C -*- */
-#define INTERNAL_SANITIZERS_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for ASAN / MSAN / etc.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for ASAN / MSAN / etc.
*/
-#include "ruby/config.h"
+#ifndef INTERNAL_SANITIZERS_H
+#define INTERNAL_SANITIZERS_H
+#include "ruby/3/config.h"
#include "internal/compilers.h" /* for __has_feature */
#ifdef HAVE_VALGRIND_MEMCHECK_H
@@ -26,7 +26,7 @@
# endif
#endif
-#include "internal/stdbool.h" /* for bool */
+#include "ruby/3/stdbool.h" /* for bool */
#include "ruby/ruby.h" /* for VALUE */
#if 0
diff --git a/internal/serial.h b/internal/serial.h
index f97a8dc9f3..143d7c6819 100644
--- a/internal/serial.h
+++ b/internal/serial.h
@@ -1,15 +1,15 @@
-#ifndef INTERNAL_SERIAL_H /* -*- C -*- */
-#define INTERNAL_SERIAL_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for rb_serial_t.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for rb_serial_t.
*/
-#include "ruby/config.h" /* for HAVE_LONG_LONG */
+#ifndef INTERNAL_SERIAL_H
+#define INTERNAL_SERIAL_H
+#include "ruby/3/config.h" /* for HAVE_LONG_LONG */
#include "ruby/defines.h" /* for LONG_LONG */
#ifndef HAVE_LONG_LONG
diff --git a/internal/signal.h b/internal/signal.h
index 0d501f7895..352052550f 100644
--- a/internal/signal.h
+++ b/internal/signal.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_SIGNAL_H /* -*- C -*- */
-#define INTERNAL_SIGNAL_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for SignalException.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for SignalException.
*/
+#ifndef INTERNAL_SIGNAL_H
+#define INTERNAL_SIGNAL_H
/* signal.c */
extern int ruby_enable_coredump;
diff --git a/internal/static_assert.h b/internal/static_assert.h
index 6fe18d1261..7b20b252d2 100644
--- a/internal/static_assert.h
+++ b/internal/static_assert.h
@@ -1,28 +1,13 @@
-#ifndef INTERNAL_STATIC_ASSERT_H /* -*- C -*- */
-#define INTERNAL_STATIC_ASSERT_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief C11 shim for _Static_assert.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief C11 shim for _Static_assert.
*/
-#include <assert.h> /* for static_assert */
-#include "compilers.h" /* for __has_extension */
-
-#if defined(static_assert)
-/* Take assert.h definition */
-# define STATIC_ASSERT(name, expr) static_assert(expr, # name ": " # expr)
-
-#elif __has_extension(c_static_assert) || GCC_VERSION_SINCE(4, 6, 0)
-# define STATIC_ASSERT(name, expr) \
- __extension__ _Static_assert(expr, # name ": " # expr)
-
-#else
-# define STATIC_ASSERT(name, expr) \
- typedef int static_assert_ ## name ## _check[1 - 2 * !(expr)]
-
-#endif /* static_assert */
-#endif /* INTERNAL_STATIC_ASSERT_H */
+#include "ruby/3/static_assert.h"
+#ifndef STATIC_ASSERT
+# define STATIC_ASSERT RUBY3_STATIC_ASSERT
+#endif
diff --git a/internal/stdbool.h b/internal/stdbool.h
deleted file mode 100644
index e090e575e7..0000000000
--- a/internal/stdbool.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef INTERNAL_STDBOOL_H /* -*- C -*- */
-#define INTERNAL_STDBOOL_H
-/**
- * @file
- * @brief Thin wrapper to <stdbool.h>
- * @author \@shyouhei
- * @copyright This file is a part of the programming language Ruby.
- * Permission is hereby granted, to either redistribute and/or
- * modify this file, provided that the conditions mentioned in the
- * file COPYING are met. Consult the file for details.
- */
-#include "ruby/config.h" /* for HAVE_STDBOOL_H */
-
-#ifdef HAVE_STDBOOL_H
-# include <stdbool.h>
-#endif
-
-/* Note that we assume the compiler isn't C++. */
-#ifdef __bool_true_false_are_defined
-# undef bool
-# undef true
-# undef false
-# undef __bool_true_false_are_defined
-#else
-typedef unsigned char _Bool;
-#endif
-
-/* See also http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2229.htm */
-#define bool _Bool
-#define true ((_Bool)+1)
-#define false ((_Bool)+0)
-#define __bool_true_false_are_defined
-
-#endif /* INTERNAL_STDBOOL_H */
diff --git a/internal/string.h b/internal/string.h
index f585163594..7635fa9ebf 100644
--- a/internal/string.h
+++ b/internal/string.h
@@ -1,18 +1,18 @@
-#ifndef INTERNAL_STRING_H /* -*- C -*- */
-#define INTERNAL_STRING_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for String.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for String.
*/
-#include "ruby/config.h"
+#ifndef INTERNAL_STRING_H
+#define INTERNAL_STRING_H
+#include "ruby/3/config.h"
#include <stddef.h> /* for size_t */
#include "internal/compilers.h" /* for __has_builtin */
-#include "internal/stdbool.h" /* for bool */
+#include "ruby/3/stdbool.h" /* for bool */
#include "ruby/encoding.h" /* for rb_encoding */
#include "ruby/ruby.h" /* for VALUE */
diff --git a/internal/struct.h b/internal/struct.h
index f205dbd89e..66efbf3712 100644
--- a/internal/struct.h
+++ b/internal/struct.h
@@ -1,18 +1,17 @@
-#ifndef INTERNAL_STRUCT_H /* -*- C -*- */
-#define INTERNAL_STRUCT_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Struct.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Struct.
*/
+#ifndef INTERNAL_STRUCT_H
+#define INTERNAL_STRUCT_H
+#include "ruby/3/stdbool.h" /* for bool */
#include "internal/gc.h" /* for RB_OBJ_WRITE */
-#include "internal/stdbool.h" /* for bool */
#include "ruby/ruby.h" /* for struct RBasic */
-#include "internal/gc.h" /* for RB_OBJ_WRITE */
enum {
RSTRUCT_EMBED_LEN_MAX = RVALUE_EMBED_LEN_MAX,
@@ -50,6 +49,10 @@ struct RStruct {
# undef RSTRUCT_GET
#endif
+#define RSTRUCT_LEN internal_RSTRUCT_LEN
+#define RSTRUCT_SET internal_RSTRUCT_SET
+#define RSTRUCT_GET internal_RSTRUCT_GET
+
/* struct.c */
VALUE rb_struct_init_copy(VALUE copy, VALUE s);
VALUE rb_struct_lookup(VALUE s, VALUE idx);
diff --git a/internal/symbol.h b/internal/symbol.h
index 8de6903ae2..8a354ffbab 100644
--- a/internal/symbol.h
+++ b/internal/symbol.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_SYMBOL_H /* -*- C -*- */
-#define INTERNAL_SYMBOL_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Symbol.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Symbol.
*/
+#ifndef INTERNAL_SYMBOL_H
+#define INTERNAL_SYMBOL_H
#include "ruby/ruby.h" /* for VALUE */
#include "ruby/encoding.h" /* for rb_encoding */
#include "internal/compilers.h" /* for __has_builtin */
diff --git a/internal/thread.h b/internal/thread.h
index 886818b023..b5cae53e6d 100644
--- a/internal/thread.h
+++ b/internal/thread.h
@@ -1,14 +1,14 @@
-#ifndef INTERNAL_THREAD_H /* -*- C -*- */
-#define INTERNAL_THREAD_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Thread.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Thread.
*/
+#ifndef INTERNAL_THREAD_H
+#define INTERNAL_THREAD_H
#include "ruby/ruby.h" /* for VALUE */
#include "ruby/intern.h" /* for rb_blocking_function_t */
diff --git a/internal/time.h b/internal/time.h
index 8f84899221..3566dfe564 100644
--- a/internal/time.h
+++ b/internal/time.h
@@ -1,15 +1,15 @@
-#ifndef INTERNAL_TIME_H /* -*- C -*- */
-#define INTERNAL_TIME_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Time.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Time.
*/
-#include "ruby/config.h" /* for SIGNEDNESS_OF_TIME_T */
+#ifndef INTERNAL_TIME_H
+#define INTERNAL_TIME_H
+#include "ruby/3/config.h" /* for SIGNEDNESS_OF_TIME_T */
#include "internal/bits.h" /* for SIGNED_INTEGER_MAX */
#include "ruby/ruby.h" /* for VALUE */
diff --git a/internal/transcode.h b/internal/transcode.h
index 8dfd1a68ad..5f0a7845b7 100644
--- a/internal/transcode.h
+++ b/internal/transcode.h
@@ -1,15 +1,15 @@
-#ifndef INTERNAL_TRANSCODE_H /* -*- C -*- */
-#define INTERNAL_TRANSCODE_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for Encoding::Converter.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for Encoding::Converter.
*/
-#include "ruby/config.h"
+#ifndef INTERNAL_TRANSCODE_H
+#define INTERNAL_TRANSCODE_H
+#include "ruby/3/config.h"
#include <stddef.h> /* for size_t */
#include "ruby/ruby.h" /* for VALUE */
#include "ruby/encoding.h" /* for rb_econv_t */
diff --git a/internal/util.h b/internal/util.h
index 528bee070e..ba35c789a2 100644
--- a/internal/util.h
+++ b/internal/util.h
@@ -1,16 +1,16 @@
-#ifndef INTERNAL_UTIL_H /* -*- C -*- */
-#define INTERNAL_UTIL_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header corresponding util.c.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header corresponding util.c.
* @warning DO NOT ADD RANDOM GARBAGE HERE THIS FILE IS FOR util.c
*/
-#include "ruby/config.h"
+#ifndef INTERNAL_UTIL_H /* -*- C -*- */
+#define INTERNAL_UTIL_H
+#include "ruby/3/config.h"
#include <stddef.h> /* for size_t */
#ifdef HAVE_SYS_TYPES_H
diff --git a/internal/variable.h b/internal/variable.h
index 941da2ae08..fb0b4a47e8 100644
--- a/internal/variable.h
+++ b/internal/variable.h
@@ -1,18 +1,18 @@
-#ifndef INTERNAL_VARIABLE_H /* -*- C -*- */
-#define INTERNAL_VARIABLE_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for variables.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for variables.
*/
-#include "ruby/config.h"
+#ifndef INTERNAL_VARIABLE_H
+#define INTERNAL_VARIABLE_H
+#include "ruby/3/config.h"
#include <stddef.h> /* for size_t */
#include "constant.h" /* for rb_const_entry_t */
-#include "internal/stdbool.h" /* for bool */
+#include "ruby/3/stdbool.h" /* for bool */
#include "ruby/ruby.h" /* for VALUE */
/* global variable */
diff --git a/internal/vm.h b/internal/vm.h
index 26dde33975..85fa82332b 100644
--- a/internal/vm.h
+++ b/internal/vm.h
@@ -1,17 +1,17 @@
-#ifndef INTERNAL_VM_H /* -*- C -*- */
-#define INTERNAL_VM_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header for RubyVM.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header for RubyVM.
*/
+#ifndef INTERNAL_VM_H
+#define INTERNAL_VM_H
+#include "ruby/3/stdbool.h" /* for bool */
#include "internal/serial.h" /* for rb_serial_t */
#include "internal/static_assert.h" /* for STATIC_ASSERT */
-#include "internal/stdbool.h" /* for bool */
#include "ruby/ruby.h" /* for ID */
#include "ruby/st.h" /* for st_table */
diff --git a/internal/warnings.h b/internal/warnings.h
index 82b3ac59c7..a1705a6867 100644
--- a/internal/warnings.h
+++ b/internal/warnings.h
@@ -1,49 +1,17 @@
-#ifndef INTERNAL_WARNINGS_H /* -*- C -*- */
-#define INTERNAL_WARNINGS_H
-/**
+/** \noop-*-C-*-vi:ft=c
* @file
- * @brief Internal header to suppress / mandate warnings.
- * @author \@shyouhei
+ * @author Ruby developers <ruby-core@ruby-lang.org>
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
+ * @brief Internal header to suppres / mandate warnings.
*/
-#include "internal/compilers.h" /* for MSC_VERSION_SINCE */
-
-#if MSC_VERSION_SINCE(1200)
-# /* Not sure exactly when but it seems VC++ 6.0 is a version with it.*/
-# define COMPILER_WARNING_PUSH __pragma(warning(push))
-# define COMPILER_WARNING_POP __pragma(warning(pop))
-# define COMPILER_WARNING_ERROR(flag) __pragma(warning(error: flag))
-# define COMPILER_WARNING_IGNORED(flag) __pragma(warning(disable: flag))
-
-#elif defined(__clang__)
-# /* Not sure exactly when but it seems LLVM 2.6.0 is a version with it. */
-# define COMPILER_WARNING_PRAGMA0(x) _Pragma(# x)
-# define COMPILER_WARNING_PRAGMA1(x) COMPILER_WARNING_PRAGMA0(clang diagnostic x)
-# define COMPILER_WARNING_PRAGMA2(x, y) COMPILER_WARNING_PRAGMA1(x # y)
-# define COMPILER_WARNING_PUSH COMPILER_WARNING_PRAGMA1(push)
-# define COMPILER_WARNING_POP COMPILER_WARNING_PRAGMA1(pop)
-# define COMPILER_WARNING_ERROR(flag) COMPILER_WARNING_PRAGMA2(error, flag)
-# define COMPILER_WARNING_IGNORED(flag) COMPILER_WARNING_PRAGMA2(ignored, flag)
-
-#elif GCC_VERSION_SINCE(4, 6, 0)
-# /* https://gcc.gnu.org/onlinedocs/gcc-4.6.0/gcc/Diagnostic-Pragmas.html */
-# define COMPILER_WARNING_PRAGMA0(x) _Pragma(# x)
-# define COMPILER_WARNING_PRAGMA1(x) COMPILER_WARNING_PRAGMA0(GCC diagnostic x)
-# define COMPILER_WARNING_PRAGMA2(x, y) COMPILER_WARNING_PRAGMA1(x # y)
-# define COMPILER_WARNING_PUSH COMPILER_WARNING_PRAGMA1(push)
-# define COMPILER_WARNING_POP COMPILER_WARNING_PRAGMA1(pop)
-# define COMPILER_WARNING_ERROR(flag) COMPILER_WARNING_PRAGMA2(error, flag)
-# define COMPILER_WARNING_IGNORED(flag) COMPILER_WARNING_PRAGMA2(ignored, flag)
-
-#else
-# /* :FIXME: improve here, for instace icc seems to have something? */
-# define COMPILER_WARNING_PUSH /* void */
-# define COMPILER_WARNING_POP /* void */
-# define COMPILER_WARNING_ERROR(flag) /* void */
-# define COMPILER_WARNING_IGNORED(flag) /* void */
-
-#endif /* _MSC_VER */
+#ifndef INTERNAL_WARNINGS_H
+#define INTERNAL_WARNINGS_H
+#include "ruby/3/warning_push.h"
+#define COMPILER_WARNING_PUSH RUBY3_WARNING_PUSH()
+#define COMPILER_WARNING_POP RUBY3_WARNING_POP()
+#define COMPILER_WARNING_ERROR(flag) RUBY3_WARNING_ERROR(flag)
+#define COMPILER_WARNING_IGNORED(flag) RUBY3_WARNING_IGNORED(flag)
#endif /* INTERNAL_WARNINGS_H */