From b6e80c2260fba69c37faabcf96aa3a5f1a78d190 Mon Sep 17 00:00:00 2001 From: mame Date: Sat, 4 Nov 2017 11:37:19 +0000 Subject: [PATCH] Remove RNODE cast from NODE utility functions Now, casting NODE to VALUE is not recommended. This change requires an explicit cast from VALUE to NODE to use the NODE utility functions such as `nd_type`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 2 +- ext/objspace/objspace_dump.c | 4 ---- node.h | 16 ++++++++-------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/compile.c b/compile.c index 7228defdf0..3eb23ea965 100644 --- a/compile.c +++ b/compile.c @@ -4227,7 +4227,7 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn, if (nsplat > 1) { int i; for (i=1; iflags & NODE_TYPEMASK)>>NODE_TYPESHIFT)) +#define nd_type(n) ((int) (((n)->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT)) #define nd_set_type(n,t) \ - RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|((((unsigned long)(t))<flags=(((n)->flags&~NODE_TYPEMASK)|((((unsigned long)(t))<flags)>>NODE_LSHIFT) +#define nd_line(n) (int)(((SIGNED_VALUE)(n)->flags)>>NODE_LSHIFT) #define nd_set_line(n,l) \ - RNODE(n)->flags=((RNODE(n)->flags&~((VALUE)(-1)<nd_location & 0xffff) + (n)->flags=(((n)->flags&~((VALUE)(-1)<nd_location & 0xffff) #define nd_set_column(n, v) \ - RNODE(n)->nd_location = (RNODE(n)->nd_location & ~0xffff) | ((v) > 0xffff ? 0xffff : ((unsigned int)(v)) & 0xffff) + (n)->nd_location = ((n)->nd_location & ~0xffff) | ((v) > 0xffff ? 0xffff : ((unsigned int)(v)) & 0xffff) -#define nd_lineno(n) (int)((RNODE(n)->nd_location >> 16) & 0xffff) +#define nd_lineno(n) (int)(((n)->nd_location >> 16) & 0xffff) #define nd_set_lineno(n, v) \ - RNODE(n)->nd_location = (RNODE(n)->nd_location & ~0xffff0000) | (((v) > 0xffff ? 0xffff : ((unsigned int)(v)) & 0xffff) << 16) + (n)->nd_location = ((n)->nd_location & ~0xffff0000) | (((v) > 0xffff ? 0xffff : ((unsigned int)(v)) & 0xffff) << 16) #define nd_head u1.node #define nd_alen u2.argc