Skip to content

Commit

Permalink
* method.h, internal.h iseq.h: declare internal functions.
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
akr committed Jun 18, 2011
1 parent 19f3866 commit 7da3ea8
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 23 deletions.
16 changes: 16 additions & 0 deletions ChangeLog
@@ -1,3 +1,19 @@
Sat Jun 18 12:42:17 2011 Tanaka Akira <akr@fsij.org>

* 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 <nobu@ruby-lang.org> Sat Jun 18 12:05:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>


* include/ruby/backward/classext.h: for evil gems. fixed #4803 * include/ruby/backward/classext.h: for evil gems. fixed #4803
Expand Down
1 change: 0 additions & 1 deletion compile.c
Expand Up @@ -537,7 +537,6 @@ int
rb_iseq_translate_threaded_code(rb_iseq_t *iseq) rb_iseq_translate_threaded_code(rb_iseq_t *iseq)
{ {
#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE #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(); const void * const *table = rb_vm_get_insns_address_table();
unsigned long i; unsigned long i;


Expand Down
8 changes: 2 additions & 6 deletions eval.c
Expand Up @@ -1196,12 +1196,8 @@ Init_eval(void)


rb_undef_method(rb_cClass, "module_function"); rb_undef_method(rb_cClass, "module_function");


{ Init_vm_eval();
extern void Init_vm_eval(void); Init_eval_method();
extern void Init_eval_method(void);
Init_vm_eval();
Init_eval_method();
}


rb_define_singleton_method(rb_cModule, "nesting", rb_mod_nesting, 0); rb_define_singleton_method(rb_cModule, "nesting", rb_mod_nesting, 0);
rb_define_singleton_method(rb_cModule, "constants", rb_mod_s_constants, -1); rb_define_singleton_method(rb_cModule, "constants", rb_mod_s_constants, -1);
Expand Down
18 changes: 18 additions & 0 deletions internal.h
Expand Up @@ -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_protected_methods(int argc, VALUE *argv, VALUE obj);
VALUE rb_obj_private_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); 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 */ /* compile.c */
int rb_dvar_defined(ID); int rb_dvar_defined(ID);
Expand Down Expand Up @@ -75,6 +77,13 @@ VALUE rb_check_backtrace(VALUE);
/* eval.c */ /* eval.c */
ID rb_frame_callee(void); 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 */ /* file.c */
VALUE rb_home_dir(const char *user, VALUE result); VALUE rb_home_dir(const char *user, VALUE result);
VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict); VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
Expand Down Expand Up @@ -114,6 +123,9 @@ VALUE rb_rational_reciprocal(VALUE x);
int rb_num_to_uint(VALUE val, unsigned int *ret); int rb_num_to_uint(VALUE val, unsigned int *ret);
int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl); int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl);


/* object.c */
VALUE rb_obj_equal(VALUE obj1, VALUE obj2);

/* parse.y */ /* parse.y */
VALUE rb_parser_get_yydebug(VALUE); VALUE rb_parser_get_yydebug(VALUE);
VALUE rb_parser_set_yydebug(VALUE, VALUE); VALUE rb_parser_set_yydebug(VALUE, VALUE);
Expand Down Expand Up @@ -149,6 +161,7 @@ void rb_thread_execute_interrupts(VALUE th);
void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1); void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
void rb_clear_trace_func(void); void rb_clear_trace_func(void);
VALUE rb_thread_backtrace(VALUE thval); VALUE rb_thread_backtrace(VALUE thval);
VALUE rb_get_coverages(void);


/* thread_pthread.c, thread_win32.c */ /* thread_pthread.c, thread_win32.c */
void Init_native_thread(void); void Init_native_thread(void);
Expand All @@ -166,12 +179,17 @@ void rb_thread_recycle_stack_release(VALUE *);
void rb_vm_change_state(void); void rb_vm_change_state(void);
void rb_vm_inc_const_missing_count(void); void rb_vm_inc_const_missing_count(void);
void rb_thread_mark(void *th); void rb_thread_mark(void *th);
const void **rb_vm_get_insns_address_table(void);


/* vm_dump.c */ /* vm_dump.c */
void rb_vm_bugreport(void); void rb_vm_bugreport(void);


/* vm_eval.c */ /* vm_eval.c */
VALUE rb_funcall_passing_block(VALUE recv, ID mid, int argc, const VALUE *argv); 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 */ /* miniprelude.c, prelude.c */
void Init_prelude(void); void Init_prelude(void);
Expand Down
1 change: 0 additions & 1 deletion iseq.c
Expand Up @@ -271,7 +271,6 @@ prepare_iseq_build(rb_iseq_t *iseq,


iseq->coverage = Qfalse; iseq->coverage = Qfalse;
if (!GET_THREAD()->parse_in_eval) { if (!GET_THREAD()->parse_in_eval) {
extern VALUE rb_get_coverages(void);
VALUE coverages = rb_get_coverages(); VALUE coverages = rb_get_coverages();
if (RTEST(coverages)) { if (RTEST(coverages)) {
iseq->coverage = rb_hash_lookup(coverages, filename); iseq->coverage = rb_hash_lookup(coverages, filename);
Expand Down
1 change: 1 addition & 0 deletions iseq.h
Expand Up @@ -29,6 +29,7 @@ struct st_table *ruby_insn_make_insn_table(void);


/* proc.c */ /* proc.c */
rb_iseq_t *rb_method_get_iseq(VALUE body); 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 { struct rb_compile_option_struct {
int inline_const_cache; int inline_const_cache;
Expand Down
1 change: 1 addition & 0 deletions method.h
Expand Up @@ -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); 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_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_mark_method_entry(const rb_method_entry_t *me);
void rb_free_method_entry(rb_method_entry_t *me); void rb_free_method_entry(rb_method_entry_t *me);
Expand Down
5 changes: 0 additions & 5 deletions object.c
Expand Up @@ -426,8 +426,6 @@ inspect_obj(VALUE obj, VALUE str, int recur)
static VALUE static VALUE
rb_obj_inspect(VALUE obj) 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)) { if (TYPE(obj) == T_OBJECT && rb_obj_basic_to_s_p(obj)) {
int has_ivar = 0; int has_ivar = 0;
VALUE *ptr = ROBJECT_IVPTR(obj); VALUE *ptr = ROBJECT_IVPTR(obj);
Expand Down Expand Up @@ -1499,8 +1497,6 @@ rb_class_s_alloc(VALUE klass)
static VALUE static VALUE
rb_mod_initialize(VALUE module) rb_mod_initialize(VALUE module)
{ {
extern VALUE rb_mod_module_exec(int argc, VALUE *argv, VALUE mod);

if (rb_block_given_p()) { if (rb_block_given_p()) {
rb_mod_module_exec(1, &module, module); rb_mod_module_exec(1, &module, module);
} }
Expand Down Expand Up @@ -2579,7 +2575,6 @@ rb_f_array(VALUE obj, VALUE arg)
void void
Init_Object(void) Init_Object(void)
{ {
extern void Init_class_hierarchy(void);
int i; int i;


Init_class_hierarchy(); Init_class_hierarchy();
Expand Down
1 change: 0 additions & 1 deletion parse.y
Expand Up @@ -5111,7 +5111,6 @@ debug_lines(const char *f)
static VALUE static VALUE
coverage(const char *f, int n) coverage(const char *f, int n)
{ {
extern VALUE rb_get_coverages(void);
VALUE coverages = rb_get_coverages(); VALUE coverages = rb_get_coverages();
if (RTEST(coverages) && RBASIC(coverages)->klass == 0) { if (RTEST(coverages) && RBASIC(coverages)->klass == 0) {
VALUE fname = rb_str_new2(f); VALUE fname = rb_str_new2(f);
Expand Down
1 change: 0 additions & 1 deletion proc.c
Expand Up @@ -1022,7 +1022,6 @@ static VALUE
method_eq(VALUE method, VALUE other) method_eq(VALUE method, VALUE other)
{ {
struct METHOD *m1, *m2; 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)) if (!rb_obj_is_method(other))
return Qfalse; return Qfalse;
Expand Down
2 changes: 0 additions & 2 deletions process.c
Expand Up @@ -2919,8 +2919,6 @@ rb_f_exit(int argc, VALUE *argv)
VALUE VALUE
rb_f_abort(int argc, VALUE *argv) rb_f_abort(int argc, VALUE *argv)
{ {
extern void ruby_error_print(void);

rb_secure(4); rb_secure(4);
if (argc == 0) { if (argc == 0) {
if (!NIL_P(GET_THREAD()->errinfo)) { if (!NIL_P(GET_THREAD()->errinfo)) {
Expand Down
1 change: 0 additions & 1 deletion thread.c
Expand Up @@ -3025,7 +3025,6 @@ clear_coverage_i(st_data_t key, st_data_t val, st_data_t dummy)
static void static void
clear_coverage(void) clear_coverage(void)
{ {
extern VALUE rb_get_coverages(void);
VALUE coverages = rb_get_coverages(); VALUE coverages = rb_get_coverages();
if (RTEST(coverages)) { if (RTEST(coverages)) {
st_foreach(RHASH_TBL(coverages), clear_coverage_i, 0); st_foreach(RHASH_TBL(coverages), clear_coverage_i, 0);
Expand Down
1 change: 0 additions & 1 deletion vm.c
Expand Up @@ -1967,7 +1967,6 @@ m_core_set_postexe(VALUE self, VALUE iseqval)
rb_thread_t *th = GET_THREAD(); rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp); rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
VALUE proc; VALUE proc;
extern void rb_call_end_proc(VALUE data);


GetISeqPtr(iseqval, blockiseq); GetISeqPtr(iseqval, blockiseq);


Expand Down
1 change: 0 additions & 1 deletion vm_eval.c
Expand Up @@ -1038,7 +1038,6 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
VALUE errinfo = th->errinfo; VALUE errinfo = th->errinfo;
if (strcmp(file, "(eval)") == 0) { if (strcmp(file, "(eval)") == 0) {
VALUE mesg, errat, bt2; VALUE mesg, errat, bt2;
extern VALUE rb_get_backtrace(VALUE info);
ID id_mesg; ID id_mesg;


CONST_ID(id_mesg, "mesg"); CONST_ID(id_mesg, "mesg");
Expand Down
1 change: 0 additions & 1 deletion vm_insnhelper.c
Expand Up @@ -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); 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)) { if (check_cfunc(me, rb_obj_equal)) {
return recv == obj ? Qtrue : Qfalse; return recv == obj ? Qtrue : Qfalse;
Expand Down
3 changes: 1 addition & 2 deletions 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 #define CACHE_SIZE 0x800
Expand Down Expand Up @@ -188,7 +188,6 @@ rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type,
old_def->alias_count == 0 && old_def->alias_count == 0 &&
old_def->type != VM_METHOD_TYPE_UNDEF && old_def->type != VM_METHOD_TYPE_UNDEF &&
old_def->type != VM_METHOD_TYPE_ZSUPER) { 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_iseq_t *iseq = 0;


rb_warning("method redefined; discarding old %s", rb_id2name(mid)); rb_warning("method redefined; discarding old %s", rb_id2name(mid));
Expand Down

0 comments on commit 7da3ea8

Please sign in to comment.