From 7da3ea811e71bcf2445fe63608b15645ef205240 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 18 Jun 2011 03:49:33 +0000 Subject: * method.h, internal.h iseq.h: declare internal functions. * compile.c, eval.c, iseq.c, object.c, parse.y, proc.c, process.c, thread.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c: don't declare internal functions. Note that rb_method_entry_eq() is defined in vm_method.c but there was a declaration in proc.c with different const-ness. Now it is declared in method.h with same const-ness to the definition. * object.c (rb_mod_module_exec): don't declare functions declared in include/ruby/intern.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 16 ++++++++++++++++ compile.c | 1 - eval.c | 8 ++------ internal.h | 18 ++++++++++++++++++ iseq.c | 1 - iseq.h | 1 + method.h | 1 + object.c | 5 ----- parse.y | 1 - proc.c | 1 - process.c | 2 -- thread.c | 1 - vm.c | 1 - vm_eval.c | 1 - vm_insnhelper.c | 1 - vm_method.c | 3 +-- 16 files changed, 39 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec6cd5f7ee..639b06ab82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Sat Jun 18 12:42:17 2011 Tanaka Akira + + * method.h, internal.h iseq.h: declare internal functions. + + * compile.c, eval.c, iseq.c, object.c, parse.y, proc.c, process.c, + thread.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c: don't + declare internal functions. + + Note that rb_method_entry_eq() is defined in vm_method.c but + there was a declaration in proc.c with different const-ness. + Now it is declared in method.h with same const-ness to the + definition. + + * object.c (rb_mod_module_exec): don't declare functions declared in + include/ruby/intern.h. + Sat Jun 18 12:05:08 2011 Nobuyoshi Nakada * include/ruby/backward/classext.h: for evil gems. fixed #4803 diff --git a/compile.c b/compile.c index 6864d8987e..01c99b66e4 100644 --- a/compile.c +++ b/compile.c @@ -537,7 +537,6 @@ int rb_iseq_translate_threaded_code(rb_iseq_t *iseq) { #if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE - extern const void **rb_vm_get_insns_address_table(void); const void * const *table = rb_vm_get_insns_address_table(); unsigned long i; diff --git a/eval.c b/eval.c index ba73fdefb8..21eb02e7a9 100644 --- a/eval.c +++ b/eval.c @@ -1196,12 +1196,8 @@ Init_eval(void) rb_undef_method(rb_cClass, "module_function"); - { - extern void Init_vm_eval(void); - extern void Init_eval_method(void); - Init_vm_eval(); - Init_eval_method(); - } + Init_vm_eval(); + Init_eval_method(); rb_define_singleton_method(rb_cModule, "nesting", rb_mod_nesting, 0); rb_define_singleton_method(rb_cModule, "constants", rb_mod_s_constants, -1); diff --git a/internal.h b/internal.h index 2cc3b529df..21f031f5ae 100644 --- a/internal.h +++ b/internal.h @@ -48,6 +48,8 @@ VALUE rb_obj_methods(int argc, VALUE *argv, VALUE obj); VALUE rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj); VALUE rb_obj_private_methods(int argc, VALUE *argv, VALUE obj); VALUE rb_obj_public_methods(int argc, VALUE *argv, VALUE obj); +int rb_obj_basic_to_s_p(VALUE); +extern void Init_class_hierarchy(void); /* compile.c */ int rb_dvar_defined(ID); @@ -75,6 +77,13 @@ VALUE rb_check_backtrace(VALUE); /* eval.c */ ID rb_frame_callee(void); +/* eval_error.c */ +void ruby_error_print(void); +VALUE rb_get_backtrace(VALUE info); + +/* eval_jump.c */ +void rb_call_end_proc(VALUE data); + /* file.c */ VALUE rb_home_dir(const char *user, VALUE result); VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict); @@ -114,6 +123,9 @@ VALUE rb_rational_reciprocal(VALUE x); int rb_num_to_uint(VALUE val, unsigned int *ret); int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl); +/* object.c */ +VALUE rb_obj_equal(VALUE obj1, VALUE obj2); + /* parse.y */ VALUE rb_parser_get_yydebug(VALUE); VALUE rb_parser_set_yydebug(VALUE, VALUE); @@ -149,6 +161,7 @@ void rb_thread_execute_interrupts(VALUE th); void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1); void rb_clear_trace_func(void); VALUE rb_thread_backtrace(VALUE thval); +VALUE rb_get_coverages(void); /* thread_pthread.c, thread_win32.c */ void Init_native_thread(void); @@ -166,12 +179,17 @@ void rb_thread_recycle_stack_release(VALUE *); void rb_vm_change_state(void); void rb_vm_inc_const_missing_count(void); void rb_thread_mark(void *th); +const void **rb_vm_get_insns_address_table(void); /* vm_dump.c */ void rb_vm_bugreport(void); /* vm_eval.c */ VALUE rb_funcall_passing_block(VALUE recv, ID mid, int argc, const VALUE *argv); +void Init_vm_eval(void); + +/* vm_method.c */ +void Init_eval_method(void); /* miniprelude.c, prelude.c */ void Init_prelude(void); diff --git a/iseq.c b/iseq.c index d1d8b4124a..c0cf98357f 100644 --- a/iseq.c +++ b/iseq.c @@ -271,7 +271,6 @@ prepare_iseq_build(rb_iseq_t *iseq, iseq->coverage = Qfalse; if (!GET_THREAD()->parse_in_eval) { - extern VALUE rb_get_coverages(void); VALUE coverages = rb_get_coverages(); if (RTEST(coverages)) { iseq->coverage = rb_hash_lookup(coverages, filename); diff --git a/iseq.h b/iseq.h index ebdee1101f..beeacbb236 100644 --- a/iseq.h +++ b/iseq.h @@ -29,6 +29,7 @@ struct st_table *ruby_insn_make_insn_table(void); /* proc.c */ rb_iseq_t *rb_method_get_iseq(VALUE body); +rb_iseq_t *rb_proc_get_iseq(VALUE proc, int *is_proc); struct rb_compile_option_struct { int inline_const_cache; diff --git a/method.h b/method.h index 339f6e452c..da667505f4 100644 --- a/method.h +++ b/method.h @@ -95,6 +95,7 @@ rb_method_entry_t *rb_method_entry_get_without_cache(VALUE klass, ID id); rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex); int rb_method_entry_arity(const rb_method_entry_t *me); +int rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2); void rb_mark_method_entry(const rb_method_entry_t *me); void rb_free_method_entry(rb_method_entry_t *me); diff --git a/object.c b/object.c index e6de509d47..8f2450db7a 100644 --- a/object.c +++ b/object.c @@ -426,8 +426,6 @@ inspect_obj(VALUE obj, VALUE str, int recur) static VALUE rb_obj_inspect(VALUE obj) { - extern int rb_obj_basic_to_s_p(VALUE); - if (TYPE(obj) == T_OBJECT && rb_obj_basic_to_s_p(obj)) { int has_ivar = 0; VALUE *ptr = ROBJECT_IVPTR(obj); @@ -1499,8 +1497,6 @@ rb_class_s_alloc(VALUE klass) static VALUE rb_mod_initialize(VALUE module) { - extern VALUE rb_mod_module_exec(int argc, VALUE *argv, VALUE mod); - if (rb_block_given_p()) { rb_mod_module_exec(1, &module, module); } @@ -2579,7 +2575,6 @@ rb_f_array(VALUE obj, VALUE arg) void Init_Object(void) { - extern void Init_class_hierarchy(void); int i; Init_class_hierarchy(); diff --git a/parse.y b/parse.y index f253922306..57ccfc02d6 100644 --- a/parse.y +++ b/parse.y @@ -5111,7 +5111,6 @@ debug_lines(const char *f) static VALUE coverage(const char *f, int n) { - extern VALUE rb_get_coverages(void); VALUE coverages = rb_get_coverages(); if (RTEST(coverages) && RBASIC(coverages)->klass == 0) { VALUE fname = rb_str_new2(f); diff --git a/proc.c b/proc.c index b4afe648b6..ebcd794e80 100644 --- a/proc.c +++ b/proc.c @@ -1022,7 +1022,6 @@ static VALUE method_eq(VALUE method, VALUE other) { struct METHOD *m1, *m2; - extern int rb_method_entry_eq(rb_method_entry_t *m1, rb_method_entry_t *m2); if (!rb_obj_is_method(other)) return Qfalse; diff --git a/process.c b/process.c index 7fdf31b012..16ac91cb72 100644 --- a/process.c +++ b/process.c @@ -2919,8 +2919,6 @@ rb_f_exit(int argc, VALUE *argv) VALUE rb_f_abort(int argc, VALUE *argv) { - extern void ruby_error_print(void); - rb_secure(4); if (argc == 0) { if (!NIL_P(GET_THREAD()->errinfo)) { diff --git a/thread.c b/thread.c index 18a1cbfbee..1825d8d825 100644 --- a/thread.c +++ b/thread.c @@ -3025,7 +3025,6 @@ clear_coverage_i(st_data_t key, st_data_t val, st_data_t dummy) static void clear_coverage(void) { - extern VALUE rb_get_coverages(void); VALUE coverages = rb_get_coverages(); if (RTEST(coverages)) { st_foreach(RHASH_TBL(coverages), clear_coverage_i, 0); diff --git a/vm.c b/vm.c index f2b6b7f5d3..7c31505028 100644 --- a/vm.c +++ b/vm.c @@ -1967,7 +1967,6 @@ m_core_set_postexe(VALUE self, VALUE iseqval) rb_thread_t *th = GET_THREAD(); rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp); VALUE proc; - extern void rb_call_end_proc(VALUE data); GetISeqPtr(iseqval, blockiseq); diff --git a/vm_eval.c b/vm_eval.c index 54debd7fec..7df7f5f47b 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -1038,7 +1038,6 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char VALUE errinfo = th->errinfo; if (strcmp(file, "(eval)") == 0) { VALUE mesg, errat, bt2; - extern VALUE rb_get_backtrace(VALUE info); ID id_mesg; CONST_ID(id_mesg, "mesg"); diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 6e45574b17..376c6aa15a 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1699,7 +1699,6 @@ opt_eq_func(VALUE recv, VALUE obj, IC ic) { const rb_method_entry_t *me = vm_method_search(idEq, CLASS_OF(recv), ic); - extern VALUE rb_obj_equal(VALUE obj1, VALUE obj2); if (check_cfunc(me, rb_obj_equal)) { return recv == obj ? Qtrue : Qfalse; diff --git a/vm_method.c b/vm_method.c index 83026d8f33..a28bd8edb0 100644 --- a/vm_method.c +++ b/vm_method.c @@ -1,5 +1,5 @@ /* - * This file is included by vm.h + * This file is included by vm.c */ #define CACHE_SIZE 0x800 @@ -188,7 +188,6 @@ rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type, old_def->alias_count == 0 && old_def->type != VM_METHOD_TYPE_UNDEF && old_def->type != VM_METHOD_TYPE_ZSUPER) { - extern rb_iseq_t *rb_proc_get_iseq(VALUE proc, int *is_proc); rb_iseq_t *iseq = 0; rb_warning("method redefined; discarding old %s", rb_id2name(mid)); -- cgit v1.2.3