* 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.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2015-05-31 20:44:56 +00:00
Родитель 45458752d3
Коммит 1611735b29
4 изменённых файлов: 35 добавлений и 10 удалений

Просмотреть файл

@ -1,3 +1,12 @@
Mon Jun 1 05:42:00 2015 Koichi Sasada <ko1@atdot.net>
* 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@zzak.io>
* ext/date/date_core.c: [DOC] Add comparison of Time and DateTime

Просмотреть файл

@ -199,10 +199,6 @@ enum ruby_tag_type {
#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)
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);

2
load.c
Просмотреть файл

@ -935,7 +935,7 @@ load_failed(VALUE fname)
static VALUE
load_ext(VALUE path)
{
SCOPE_SET(NOEX_PUBLIC);
rb_frame_visibility_set(NOEX_PUBLIC);
return (VALUE)dln_load(RSTRING_PTR(path));
}

Просмотреть файл

@ -908,6 +908,24 @@ rb_method_boundp(VALUE klass, ID id, int ex)
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, int write, int ex)
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
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, VALUE module)
}
if (argc == 0) {
SCOPE_SET(NOEX_MODFUNC);
rb_frame_visibility_set(NOEX_MODFUNC);
return module;
}