Skip to content

Commit

Permalink
Remove not used universal parser macros and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk committed Feb 21, 2024
1 parent d0786cd commit 91cb303
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 55 deletions.
2 changes: 0 additions & 2 deletions parse.y
Expand Up @@ -38,8 +38,6 @@
#include "universal_parser.c"

#ifdef RIPPER
#undef T_NODE
#define T_NODE 0x1b
#define STATIC_ID2SYM p->config->static_id2sym
#define rb_str_coderange_scan_restartable p->config->str_coderange_scan_restartable
#endif
Expand Down
22 changes: 0 additions & 22 deletions ruby_parser.c
Expand Up @@ -401,12 +401,6 @@ rb_errno_ptr2(void)
return rb_errno_ptr();
}

static int
type_p(VALUE obj, int t)
{
return (int)RB_TYPE_P(obj, t);
}

static int
fixnum_p(VALUE obj)
{
Expand Down Expand Up @@ -449,18 +443,6 @@ ruby_vm_frozen_core(void)
return rb_mRubyVMFrozenCore;
}

static int
special_const_p(VALUE obj)
{
return (int)RB_SPECIAL_CONST_P(obj);
}

static int
builtin_type(VALUE obj)
{
return (int)RB_BUILTIN_TYPE(obj);
}

static rb_ast_t *
ast_new(VALUE nb)
{
Expand Down Expand Up @@ -506,7 +488,6 @@ static const rb_parser_config_t rb_global_parser_config = {

.obj_freeze = rb_obj_freeze,
.obj_hide = rb_obj_hide,
.type_p = type_p,
.obj_freeze_raw = OBJ_FREEZE_RAW,

.fixnum_p = fixnum_p,
Expand Down Expand Up @@ -638,7 +619,6 @@ static const rb_parser_config_t rb_global_parser_config = {
.sized_realloc_n = ruby_sized_realloc_n,
.obj_write = obj_write,
.obj_written = obj_written,
.gc_register_mark_object = rb_gc_register_mark_object,
.gc_guard = gc_guard,
.gc_mark = rb_gc_mark,
.gc_mark_and_move = rb_gc_mark_and_move,
Expand Down Expand Up @@ -673,8 +653,6 @@ static const rb_parser_config_t rb_global_parser_config = {
.eArgError = arg_error,
.mRubyVMFrozenCore = ruby_vm_frozen_core,
.long2int = rb_long2int,
.special_const_p = special_const_p,
.builtin_type = builtin_type,

.node_case_when_optimizable_literal = rb_node_case_when_optimizable_literal,

Expand Down
4 changes: 0 additions & 4 deletions rubyparser.h
Expand Up @@ -1221,7 +1221,6 @@ typedef struct rb_parser_config_struct {
/* Object */
VALUE (*obj_freeze)(VALUE obj);
VALUE (*obj_hide)(VALUE obj);
int (*type_p)(VALUE, int);
void (*obj_freeze_raw)(VALUE obj);

int (*fixnum_p)(VALUE);
Expand Down Expand Up @@ -1373,7 +1372,6 @@ typedef struct rb_parser_config_struct {
void *(*sized_realloc_n)(void *ptr, size_t new_count, size_t element_size, size_t old_count);
VALUE (*obj_write)(VALUE, VALUE *, VALUE);
VALUE (*obj_written)(VALUE, VALUE, VALUE);
void (*gc_register_mark_object)(VALUE object);
void (*gc_guard)(VALUE);
void (*gc_mark)(VALUE);
void (*gc_mark_and_move)(VALUE *ptr);
Expand Down Expand Up @@ -1413,8 +1411,6 @@ typedef struct rb_parser_config_struct {
VALUE (*eArgError)(void);
VALUE (*mRubyVMFrozenCore)(void);
int (*long2int)(long);
int (*special_const_p)(VALUE);
int (*builtin_type)(VALUE);

VALUE (*node_case_when_optimizable_literal)(const NODE *const node);

Expand Down
27 changes: 0 additions & 27 deletions universal_parser.c
Expand Up @@ -30,13 +30,6 @@
#define RSTRING_GETMEM(str, ptrvar, lenvar) \
((ptrvar) = RSTRING_PTR(str), \
(lenvar) = RSTRING_LEN(str))
#if defined(USE_FLONUM)
# /* Take that. */
#elif SIZEOF_VALUE >= SIZEOF_DOUBLE
# define USE_FLONUM 1
#else
# define USE_FLONUM 0
#endif

/* parser_st */
#define st_table parser_st_table
Expand Down Expand Up @@ -64,19 +57,6 @@

#define rb_encoding void

#undef T_FLOAT
#define T_FLOAT 0x04
#undef T_REGEXP
#define T_REGEXP 0x06
#undef T_HASH
#define T_HASH 0x08
#undef T_BIGNUM
#define T_BIGNUM 0x0a
#undef T_COMPLEX
#define T_COMPLEX 0x0e
#undef T_RATIONAL
#define T_RATIONAL 0x0f

#ifndef INTERNAL_IMEMO_H
struct rb_imemo_tmpbuf_struct {
VALUE flags;
Expand Down Expand Up @@ -118,8 +98,6 @@ struct rb_imemo_tmpbuf_struct {

#define rb_obj_freeze p->config->obj_freeze
#define rb_obj_hide p->config->obj_hide
#undef RB_TYPE_P
#define RB_TYPE_P p->config->type_p
#undef OBJ_FREEZE_RAW
#define OBJ_FREEZE_RAW p->config->obj_freeze_raw

Expand Down Expand Up @@ -271,7 +249,6 @@ struct rb_imemo_tmpbuf_struct {
#define RB_OBJ_WRITE(old, slot, young) p->config->obj_write((VALUE)(old), (VALUE *)(slot), (VALUE)(young))
#undef RB_OBJ_WRITTEN
#define RB_OBJ_WRITTEN(old, oldv, young) p->config->obj_written((VALUE)(old), (VALUE)(oldv), (VALUE)(young))
#define rb_gc_register_mark_object p->config->gc_register_mark_object
#undef RB_GC_GUARD
#define RB_GC_GUARD p->config->gc_guard
#define rb_gc_mark p->config->gc_mark
Expand Down Expand Up @@ -316,10 +293,6 @@ struct rb_imemo_tmpbuf_struct {
#define rb_mRubyVMFrozenCore p->config->mRubyVMFrozenCore()
#undef rb_long2int
#define rb_long2int p->config->long2int
#undef SPECIAL_CONST_P
#define SPECIAL_CONST_P p->config->special_const_p
#undef BUILTIN_TYPE
#define BUILTIN_TYPE p->config->builtin_type

#define rb_node_case_when_optimizable_literal p->config->node_case_when_optimizable_literal

Expand Down

0 comments on commit 91cb303

Please sign in to comment.