summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/compar.h2
-rw-r--r--internal/complex.h5
-rw-r--r--internal/cont.h4
-rw-r--r--internal/debug.h11
-rw-r--r--internal/dir.h1
-rw-r--r--internal/enc.h6
-rw-r--r--internal/encoding.h4
-rw-r--r--internal/enum.h1
-rw-r--r--internal/enumerator.h2
-rw-r--r--internal/eval.h9
-rw-r--r--internal/file.h6
-rw-r--r--internal/io.h4
-rw-r--r--internal/load.h1
-rw-r--r--internal/math.h1
-rw-r--r--internal/missing.h1
-rw-r--r--internal/mjit.h2
-rw-r--r--internal/parse.h11
-rw-r--r--internal/random.h1
-rw-r--r--internal/rational.h6
-rw-r--r--internal/re.h4
-rw-r--r--internal/serial.h2
-rw-r--r--internal/time.h6
-rw-r--r--internal/transcode.h6
-rw-r--r--internal/util.h6
-rw-r--r--thread.c2
25 files changed, 74 insertions, 30 deletions
diff --git a/internal/compar.h b/internal/compar.h
index 36c5e9c7825..6a689ed11d1 100644
--- a/internal/compar.h
+++ b/internal/compar.h
@@ -9,6 +9,8 @@
* 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 7a363fc0e51..0a8ecfb0d96 100644
--- a/internal/complex.h
+++ b/internal/complex.h
@@ -9,6 +9,7 @@
* 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 {
#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 066a28238c0..5aaf0951425 100644
--- a/internal/cont.h
+++ b/internal/cont.h
@@ -9,8 +9,10 @@
* 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 8fa75fd8c64..276991027c8 100644
--- a/internal/debug.h
+++ b/internal/debug.h
@@ -9,11 +9,19 @@
* 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);
// 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 9162d41d7aa..07312f327e3 100644
--- a/internal/dir.h
+++ b/internal/dir.h
@@ -9,6 +9,7 @@
* 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 afd86426278..8c28c693570 100644
--- a/internal/enc.h
+++ b/internal/enc.h
@@ -9,16 +9,12 @@
* 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 79fbadaf50d..1489065d3a7 100644
--- a/internal/encoding.h
+++ b/internal/encoding.h
@@ -9,13 +9,13 @@
* 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 e4e710bad09..70eec55c7f0 100644
--- a/internal/enum.h
+++ b/internal/enum.h
@@ -9,6 +9,7 @@
* 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 5f0f6333b60..e4575f2c49e 100644
--- a/internal/enumerator.h
+++ b/internal/enumerator.h
@@ -9,6 +9,8 @@
* 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 5fc3b38e900..86729a8ff0d 100644
--- a/internal/eval.h
+++ b/internal/eval.h
@@ -11,13 +11,16 @@
* @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 0bbf50f296b..ac65ddad3cf 100644
--- a/internal/file.h
+++ b/internal/file.h
@@ -9,15 +9,15 @@
* 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);
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 00bca80fef1..e04dbcb67cf 100644
--- a/internal/io.h
+++ b/internal/io.h
@@ -9,14 +9,14 @@
* 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 f4bf42cd28b..17eb2552bfb 100644
--- a/internal/load.h
+++ b/internal/load.h
@@ -9,6 +9,7 @@
* 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 */
/* load.c */
VALUE rb_get_expanded_load_path(void);
diff --git a/internal/math.h b/internal/math.h
index 51d398f61ed..ec46f47f48b 100644
--- a/internal/math.h
+++ b/internal/math.h
@@ -9,6 +9,7 @@
* 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 */
/* math.c */
VALUE rb_math_atan2(VALUE, VALUE);
diff --git a/internal/missing.h b/internal/missing.h
index c27999e3177..bb62495ff74 100644
--- a/internal/missing.h
+++ b/internal/missing.h
@@ -9,6 +9,7 @@
* 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_SETPROCTITLE */
/* missing/setproctitle.c */
#ifndef HAVE_SETPROCTITLE
diff --git a/internal/mjit.h b/internal/mjit.h
index 71d25e52ae3..84cc611197c 100644
--- a/internal/mjit.h
+++ b/internal/mjit.h
@@ -9,6 +9,8 @@
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
*/
+#include "internal/stdbool.h" /* for bool */
+#include "ruby/ruby.h" /* for VALUE */
/* mjit.c */
diff --git a/internal/parse.h b/internal/parse.h
index 01325579513..bcde0fea7ae 100644
--- a/internal/parse.h
+++ b/internal/parse.h
@@ -9,15 +9,20 @@
* 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 */
-/* parse.y */
#ifndef USE_SYMBOL_GC
-#define USE_SYMBOL_GC 1
+# define USE_SYMBOL_GC 1
#endif
+
+struct rb_iseq_struct; /* in vm_core.h */
+
+/* parse.y */
VALUE rb_parser_set_yydebug(VALUE, VALUE);
+void *rb_parser_load_file(VALUE parser, VALUE name);
+
RUBY_SYMBOL_EXPORT_BEGIN
VALUE rb_parser_set_context(VALUE, const struct rb_iseq_struct *, int);
RUBY_SYMBOL_EXPORT_END
-void *rb_parser_load_file(VALUE parser, VALUE name);
#endif /* INTERNAL_PARSE_H */
diff --git a/internal/random.h b/internal/random.h
index 6498769c862..87fcc48988c 100644
--- a/internal/random.h
+++ b/internal/random.h
@@ -9,6 +9,7 @@
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
*/
+#include <stddef.h> /* for size_t */
/* random.c */
int ruby_fill_random_bytes(void *, size_t, int);
diff --git a/internal/rational.h b/internal/rational.h
index 993d0569277..c783c5162b6 100644
--- a/internal/rational.h
+++ b/internal/rational.h
@@ -9,6 +9,8 @@
* 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_LIBGMP */
+#include "ruby/ruby.h" /* for struct RBasic */
struct RRational {
struct RBasic basic;
@@ -17,8 +19,8 @@ struct RRational {
};
#define RRATIONAL(obj) (R_CAST(RRational)(obj))
-#define RRATIONAL_SET_NUM(rat, n) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n))
-#define RRATIONAL_SET_DEN(rat, d) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d))
+#define RRATIONAL_SET_NUM(rat, n) RB_OBJ_WRITE((rat), &RRATIONAL(rat)->num, (n))
+#define RRATIONAL_SET_DEN(rat, d) RB_OBJ_WRITE((rat), &RRATIONAL(rat)->den, (d))
/* rational.c */
VALUE rb_rational_canonicalize(VALUE x);
diff --git a/internal/re.h b/internal/re.h
index 76760306840..9cf84393457 100644
--- a/internal/re.h
+++ b/internal/re.h
@@ -9,6 +9,8 @@
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
*/
+#include "internal/stdbool.h" /* for bool */
+#include "ruby/ruby.h" /* for VALUE */
/* re.c */
VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline);
@@ -20,6 +22,8 @@ void rb_backref_set_string(VALUE string, long pos, long len);
void rb_match_unbusy(VALUE);
int rb_match_count(VALUE match);
int rb_match_nth_defined(int nth, VALUE match);
+MJIT_SYMBOL_EXPORT_BEGIN
VALUE rb_reg_new_ary(VALUE ary, int options);
+MJIT_SYMBOL_EXPORT_END
#endif /* INTERNAL_RE_H */
diff --git a/internal/serial.h b/internal/serial.h
index 118848d0898..f97a8dc9f39 100644
--- a/internal/serial.h
+++ b/internal/serial.h
@@ -9,6 +9,8 @@
* 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_LONG_LONG */
+#include "ruby/defines.h" /* for LONG_LONG */
#ifndef HAVE_LONG_LONG
# error need C99+
diff --git a/internal/time.h b/internal/time.h
index b20f24e1cfc..ef3d64e967b 100644
--- a/internal/time.h
+++ b/internal/time.h
@@ -9,6 +9,9 @@
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
*/
+#include "ruby/config.h" /* for SIGNEDNESS_OF_TIME_T */
+#include "internal/bits.h" /* for SIGNED_INTEGER_MAX */
+#include "ruby/ruby.h" /* for VALUE */
#if SIGNEDNESS_OF_TIME_T < 0 /* signed */
# define TIMET_MAX SIGNED_INTEGER_MAX(time_t)
@@ -17,7 +20,8 @@
# define TIMET_MAX UNSIGNED_INTEGER_MAX(time_t)
# define TIMET_MIN ((time_t)0)
#endif
-#define TIMET_MAX_PLUS_ONE (2*(double)(TIMET_MAX/2+1))
+
+struct timeval; /* <- in <sys/time.h> or <winsock2.h> */
/* time.c */
struct timeval rb_time_timeval(VALUE);
diff --git a/internal/transcode.h b/internal/transcode.h
index 798c9265c2a..8dfd1a68add 100644
--- a/internal/transcode.h
+++ b/internal/transcode.h
@@ -9,11 +9,13 @@
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
*/
+#include "ruby/config.h"
+#include <stddef.h> /* for size_t */
+#include "ruby/ruby.h" /* for VALUE */
+#include "ruby/encoding.h" /* for rb_econv_t */
/* transcode.c */
extern VALUE rb_cEncodingConverter;
-#ifdef RUBY_ENCODING_H
size_t rb_econv_memsize(rb_econv_t *);
-#endif
#endif /* INTERNAL_TRANSCODE_H */
diff --git a/internal/util.h b/internal/util.h
index c1ba2a4323c..528bee070e1 100644
--- a/internal/util.h
+++ b/internal/util.h
@@ -10,6 +10,12 @@
* file COPYING are met. Consult the file for details.
* @warning DO NOT ADD RANDOM GARBAGE HERE THIS FILE IS FOR util.c
*/
+#include "ruby/config.h"
+#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) */
/* util.c */
char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve);
diff --git a/thread.c b/thread.c
index 17bc1e75aec..39114db83d1 100644
--- a/thread.c
+++ b/thread.c
@@ -1196,7 +1196,7 @@ static rb_hrtime_t *
double2hrtime(rb_hrtime_t *hrt, double d)
{
/* assume timespec.tv_sec has same signedness as time_t */
- const double TIMESPEC_SEC_MAX_PLUS_ONE = TIMET_MAX_PLUS_ONE;
+ const double TIMESPEC_SEC_MAX_PLUS_ONE = 2.0 * (TIMESPEC_SEC_MAX / 2 + 1.0);
if (TIMESPEC_SEC_MAX_PLUS_ONE <= d) {
return NULL;