ruby-changes:59508
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Fri, 27 Dec 2019 05:03:43 +0900 (JST)
Subject: [ruby-changes:59508] bf53d6c7d1 (master): other minior internal header tweaks
https://git.ruby-lang.org/ruby.git/commit/?id=bf53d6c7d1 From bf53d6c7d19f877c821901b3288d7f80955ffbb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Tue, 3 Dec 2019 14:47:38 +0900 Subject: other minior internal header tweaks These headers need no rewrite. Just add some minor tweaks, like addition of #include lines. Mainly cosmetic. TIMET_MAX_PLUS_ONE was deleted because the macro was used from only one place (directly write expression there). diff --git a/internal/compar.h b/internal/compar.h index 36c5e9c..6a689ed 100644 --- a/internal/compar.h +++ b/internal/compar.h @@ -9,6 +9,8 @@ https://github.com/ruby/ruby/blob/trunk/internal/compar.h#L9 * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. */ +#include "ruby/ruby.h" /* for RUBY_INTEGER_UNIFICATION */ +#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/complex.h b/internal/complex.h index 7a363fc..0a8ecfb 100644 --- a/internal/complex.h +++ b/internal/complex.h @@ -9,6 +9,7 @@ https://github.com/ruby/ruby/blob/trunk/internal/complex.h#L9 * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. */ +#include "ruby/ruby.h" /* for struct RBasic */ struct RComplex { struct RBasic basic; @@ -19,8 +20,8 @@ struct RComplex { https://github.com/ruby/ruby/blob/trunk/internal/complex.h#L20 #define RCOMPLEX(obj) (R_CAST(RComplex)(obj)) /* shortcut macro for internal only */ -#define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r)) -#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i)) +#define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &RCOMPLEX(cmp)->real, (r)) +#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &RCOMPLEX(cmp)->imag, (i)) /* complex.c */ VALUE rb_dbl_complex_new_polar_pi(double abs, double ang); diff --git a/internal/cont.h b/internal/cont.h index 066a282..5aaf095 100644 --- a/internal/cont.h +++ b/internal/cont.h @@ -9,8 +9,10 @@ https://github.com/ruby/ruby/blob/trunk/internal/cont.h#L9 * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. */ +#include "ruby/ruby.h" /* for VALUE */ + +struct rb_thread_struct; /* in vm_core.h */ -struct rb_thread_struct; /* cont.c */ VALUE rb_obj_is_fiber(VALUE); void rb_fiber_reset_root_local_storage(struct rb_thread_struct *); diff --git a/internal/debug.h b/internal/debug.h index 8fa75fd..2769910 100644 --- a/internal/debug.h +++ b/internal/debug.h @@ -9,11 +9,19 @@ https://github.com/ruby/ruby/blob/trunk/internal/debug.h#L9 * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. */ +#include "ruby/config.h" +#include <stdio.h> /* for fprintf */ +#include "ruby/ruby.h" /* for VALUE */ /* MRI debug support */ + +/* gc.c */ void rb_obj_info_dump(VALUE obj); void rb_obj_info_dump_loc(VALUE obj, const char *file, int line, const char *func); + +/* debug.c */ void ruby_debug_breakpoint(void); +PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2); // show obj data structure without any side-effect #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, __func__) @@ -28,7 +36,4 @@ void ruby_debug_breakpoint(void); https://github.com/ruby/ruby/blob/trunk/internal/debug.h#L36 // but breakpoint is set in run.gdb, so `make gdb` can stop here. #define bp() ruby_debug_breakpoint() -/* debug.c */ -PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2); - #endif /* INTERNAL_DEBUG_H */ diff --git a/internal/dir.h b/internal/dir.h index 9162d41..07312f3 100644 --- a/internal/dir.h +++ b/internal/dir.h @@ -9,6 +9,7 @@ https://github.com/ruby/ruby/blob/trunk/internal/dir.h#L9 * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. */ +#include "ruby/ruby.h" /* for VALUE */ /* dir.c */ VALUE rb_dir_getwd_ospath(void); diff --git a/internal/enc.h b/internal/enc.h index afd8642..8c28c69 100644 --- a/internal/enc.h +++ b/internal/enc.h @@ -9,16 +9,12 @@ https://github.com/ruby/ruby/blob/trunk/internal/enc.h#L9 * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. */ - +#include "ruby/encoding.h" /* for rb_encoding */ /* us_ascii.c */ -#ifdef RUBY_ENCODING_H extern rb_encoding OnigEncodingUS_ASCII; -#endif /* utf_8.c */ -#ifdef RUBY_ENCODING_H extern rb_encoding OnigEncodingUTF_8; -#endif #endif /* INTERNAL_ENC_H */ diff --git a/internal/encoding.h b/internal/encoding.h index 79fbada..1489065 100644 --- a/internal/encoding.h +++ b/internal/encoding.h @@ -9,13 +9,13 @@ https://github.com/ruby/ruby/blob/trunk/internal/encoding.h#L9 * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. */ +#include "ruby/ruby.h" /* for ID */ +#include "ruby/encoding.h" /* for rb_encoding */ /* encoding.c */ ID rb_id_encoding(void); -#ifdef RUBY_ENCODING_H rb_encoding *rb_enc_get_from_index(int index); rb_encoding *rb_enc_check_str(VALUE str1, VALUE str2); -#endif int rb_encdb_replicate(const char *alias, const char *orig); int rb_encdb_alias(const char *alias, const char *orig); int rb_encdb_dummy(const char *name); diff --git a/internal/enum.h b/internal/enum.h index e4e710b..70eec55 100644 --- a/internal/enum.h +++ b/internal/enum.h @@ -9,6 +9,7 @@ https://github.com/ruby/ruby/blob/trunk/internal/enum.h#L9 * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. */ +#include "ruby/ruby.h" /* for VALUE */ /* enum.c */ extern VALUE rb_cArithSeq; diff --git a/internal/enumerator.h b/internal/enumerator.h index 5f0f633..e4575f2 100644 --- a/internal/enumerator.h +++ b/internal/enumerator.h @@ -9,6 +9,8 @@ https://github.com/ruby/ruby/blob/trunk/internal/enumerator.h#L9 * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. */ +#include "ruby/ruby.h" /* for VALUE */ +#include "ruby/intern.h" /* for rb_enumerator_size_func */ RUBY_SYMBOL_EXPORT_BEGIN /* enumerator.c (export) */ diff --git a/internal/eval.h b/internal/eval.h index 5fc3b38..86729a8 100644 --- a/internal/eval.h +++ b/internal/eval.h @@ -11,13 +11,16 @@ https://github.com/ruby/ruby/blob/trunk/internal/eval.h#L11 * @note There also is eval_intern.h, which is evaluator's internal * header (related to this file, but not the same role). */ +#include "ruby/ruby.h" /* for ID */ + +#define id_signo ruby_static_id_signo +#define id_status ruby_static_id_status /* eval.c */ +extern ID ruby_static_id_signo; +extern ID ruby_static_id_status; VALUE rb_refinement_module_get_refined_class(VALUE module); -extern ID ruby_static_id_signo, ruby_static_id_status; void rb_class_modify_check(VALUE); -#define id_signo ruby_static_id_signo -#define id_status ruby_static_id_status NORETURN(VALUE rb_f_raise(int argc, VALUE *argv)); /* eval_error.c */ diff --git a/internal/file.h b/internal/file.h index 0bbf50f..ac65dda 100644 --- a/internal/file.h +++ b/internal/file.h @@ -9,15 +9,15 @@ https://github.com/ruby/ruby/blob/trunk/internal/file.h#L9 * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. */ +#include "ruby/ruby.h" /* for VALUE */ +#include "ruby/encoding.h" /* for rb_encodinng */ /* file.c */ extern const char ruby_null_device[]; VALUE rb_home_dir_of(VALUE user, VALUE result); VALUE rb_default_home_dir(VALUE result); VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict); -#ifdef RUBY_ENCODING_H VALUE rb_check_realpath(VALUE basedir, VALUE path, rb_encoding *origenc); -#endif void rb_file_const(const char*, VALUE); int rb_file_load_ok(const char *); VALUE rb_file_expand_path_fast(VALUE, VALUE); @@ -28,7 +28,7 @@ int ruby_is_fd_loadable(int fd); https://github.com/ruby/ruby/blob/trunk/internal/file.h#L28 RUBY_SYMBOL_EXPORT_BEGIN /* file.c (export) */ -#if defined HAVE_READLINK && defined RUBY_ENCODING_H +#ifdef HAVE_READLINK VALUE rb_readlink(VALUE path, rb_encoding *enc); #endif #ifdef __APPLE__ diff --git a/internal/io.h b/internal/io.h index 00bca80..e04dbcb 100644 --- a/internal/io.h +++ b/internal/io.h @@ -9,14 +9,14 @@ https://github.com/ruby/ruby/blob/trunk/internal/io.h#L9 * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. */ +#include "ruby/ruby.h" /* for VALUE */ +#include "ruby/io.h" /* for rb_io_t */ /* io.c */ void ruby_set_inplace_mode(const char *); void rb_stdio_set_default_encoding(void); VALUE rb_io_flush_raw(VALUE, int); -#ifdef RUBY_IO_H size_t rb_io_memsize(const rb_io_t *); -#endif int rb_stderr_tty_p(void); void rb_io_fptr_finalize_internal(void *ptr); #define rb_io_fptr_finalize rb_io_fptr_finalize_internal diff --git a/internal/load.h b/internal/load.h index f4bf42c..17eb255 100644 --- a/internal/load.h +++ b/internal/load.h @@ -9,6 +9,7 @@ https://github.com/ruby/ruby/blob/trunk/internal/load.h#L9 * modify this file, provided that the conditions mentioned in the * file COPY (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/