ruby-changes:38622
From: ko1 <ko1@a...>
Date: Mon, 1 Jun 2015 05:45:17 +0900 (JST)
Subject: [ruby-changes:38622] ko1:r50703 (trunk): * eval_intern.h, vm_method.c: move macros to functions.
ko1 2015-06-01 05:44:56 +0900 (Mon, 01 Jun 2015) New Revision: 50703 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50703 Log: * eval_intern.h, vm_method.c: move macros to functions. * SCOPE_TEST(f) -> rb_frame_visibility_test(flag). * SCOPE_CHECK(f) -> rb_frame_visibility_check(flag). * SCOPE_SET(f) -> rb_frame_visibility_set(flag). * load.c (load_ext): use it. Modified files: trunk/ChangeLog trunk/eval_intern.h trunk/load.c trunk/vm_method.c Index: eval_intern.h =================================================================== --- eval_intern.h (revision 50702) +++ eval_intern.h (revision 50703) @@ -199,10 +199,6 @@ enum ruby_tag_type { https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L199 #define TAG_FATAL RUBY_TAG_FATAL #define TAG_MASK RUBY_TAG_MASK -#define SCOPE_TEST(f) (CREF_VISI(rb_vm_cref()) & (f)) -#define SCOPE_CHECK(f) (CREF_VISI(rb_vm_cref()) == (f)) -#define SCOPE_SET(f) (CREF_VISI_SET(rb_vm_cref(), (f))) - /* CREF operators */ #define NODE_FL_CREF_PUSHED_BY_EVAL_ (((VALUE)1)<<15) @@ -286,6 +282,8 @@ CREF_OMOD_SHARED_UNSET(rb_cref_t *cref) https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L282 cref->flags &= ~NODE_FL_CREF_OMOD_SHARED_; } +void rb_frame_visibility_set(rb_method_flag_t); + void rb_thread_cleanup(void); void rb_thread_wait_other_threads(void); Index: ChangeLog =================================================================== --- ChangeLog (revision 50702) +++ ChangeLog (revision 50703) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Jun 1 05:42:00 2015 Koichi Sasada <ko1@a...> + + * eval_intern.h, vm_method.c: move macros to functions. + * SCOPE_TEST(f) -> rb_frame_visibility_test(flag). + * SCOPE_CHECK(f) -> rb_frame_visibility_check(flag). + * SCOPE_SET(f) -> rb_frame_visibility_set(flag). + + * load.c (load_ext): use it. + Mon Jun 1 04:47:37 2015 Zachary Scott <e@z...> * ext/date/date_core.c: [DOC] Add comparison of Time and DateTime Index: load.c =================================================================== --- load.c (revision 50702) +++ load.c (revision 50703) @@ -935,7 +935,7 @@ load_failed(VALUE fname) https://github.com/ruby/ruby/blob/trunk/load.c#L935 static VALUE load_ext(VALUE path) { - SCOPE_SET(NOEX_PUBLIC); + rb_frame_visibility_set(NOEX_PUBLIC); return (VALUE)dln_load(RSTRING_PTR(path)); } Index: vm_method.c =================================================================== --- vm_method.c (revision 50702) +++ vm_method.c (revision 50703) @@ -908,6 +908,24 @@ rb_method_boundp(VALUE klass, ID id, int https://github.com/ruby/ruby/blob/trunk/vm_method.c#L908 extern ID rb_check_attr_id(ID id); +static int +rb_frame_visibility_test(rb_method_flag_t flag) +{ + return CREF_VISI(rb_vm_cref()) & flag; +} + +static int +rb_frame_visibility_check(rb_method_flag_t flag) +{ + return CREF_VISI(rb_vm_cref()) == flag; +} + +void +rb_frame_visibility_set(rb_method_flag_t flag) +{ + CREF_VISI_SET(rb_vm_cref(), flag); +} + void rb_attr(VALUE klass, ID id, int read, int write, int ex) { @@ -919,13 +937,13 @@ rb_attr(VALUE klass, ID id, int read, in https://github.com/ruby/ruby/blob/trunk/vm_method.c#L937 noex = NOEX_PUBLIC; } else { - if (SCOPE_TEST(NOEX_PRIVATE)) { + if (rb_frame_visibility_test(NOEX_PRIVATE)) { noex = NOEX_PRIVATE; - if (SCOPE_CHECK(NOEX_MODFUNC)) { + if (rb_frame_visibility_check(NOEX_MODFUNC)) { rb_warning("attribute accessor as module_function"); } } - else if (SCOPE_TEST(NOEX_PROTECTED)) { + else if (rb_frame_visibility_test(NOEX_PROTECTED)) { noex = NOEX_PROTECTED; } else { @@ -1437,7 +1455,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1455 set_visibility(int argc, const VALUE *argv, VALUE module, rb_method_flag_t ex) { if (argc == 0) { - SCOPE_SET(ex); + rb_frame_visibility_set(ex); } else { set_method_visibility(module, argc, argv, ex); @@ -1638,7 +1656,7 @@ rb_mod_modfunc(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1656 } if (argc == 0) { - SCOPE_SET(NOEX_MODFUNC); + rb_frame_visibility_set(NOEX_MODFUNC); return module; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/