1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Suppress -Wswitch warnings

This commit is contained in:
Nobuyoshi Nakada 2020-04-08 15:13:37 +09:00
parent 3b1029f894
commit e474c189da
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
13 changed files with 42 additions and 0 deletions

View file

@ -1712,6 +1712,8 @@ singleton_class_of(VALUE obj)
case T_STRING:
if (FL_TEST_RAW(obj, RSTRING_FSTR)) goto no_singleton;
break;
default:
break;
}
}

View file

@ -8677,6 +8677,8 @@ opobj_inspect(VALUE obj)
case T_ARRAY:
obj = rb_ary_dup(obj);
break;
default:
break;
}
}
return rb_inspect(obj);

2
eval.c
View file

@ -468,6 +468,8 @@ rb_class_modify_check(VALUE klass)
case T_CLASS:
desc = "Class";
break;
default:
break;
}
}
}

View file

@ -135,6 +135,7 @@ obj_type(VALUE obj)
CASE_TYPE(NODE);
CASE_TYPE(ZOMBIE);
#undef CASE_TYPE
default: break;
}
return "UNKNOWN";
}
@ -315,6 +316,9 @@ dump_object(VALUE obj, struct dump_config *dc)
case T_ZOMBIE:
dump_append(dc, "}\n");
return;
default:
break;
}
rb_objspace_reachable_objects_from(obj, reachable_object_i, dc);

12
gc.c
View file

@ -2594,6 +2594,8 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
case T_FALSE:
rb_bug("obj_free() called for broken object");
break;
default:
break;
}
if (FL_TEST(obj, FL_EXIVAR)) {
@ -3564,6 +3566,8 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
make_io_zombie(objspace, vp);
}
break;
default:
break;
}
if (poisoned) {
GC_ASSERT(BUILTIN_TYPE(vp) == T_NONE);
@ -3634,6 +3638,8 @@ is_live_object(rb_objspace_t *objspace, VALUE ptr)
case T_NONE:
case T_ZOMBIE:
return FALSE;
default:
break;
}
if (!is_garbage_object(objspace, ptr)) {
@ -4588,6 +4594,9 @@ push_mark_stack(mark_stack_t *stack, VALUE data)
case T_NODE:
UNEXPECTED_NODE(push_mark_stack);
break;
default:
break;
}
if (stack->index == stack->limit) {
@ -5397,6 +5406,9 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj)
case T_IMEMO:
gc_mark_imemo(objspace, obj);
return;
default:
break;
}
gc_mark(objspace, any->as.basic.klass);

2
iseq.c
View file

@ -68,6 +68,8 @@ obj_resurrect(VALUE obj)
case T_HASH:
obj = rb_hash_resurrect(obj);
break;
default:
break;
}
}
return obj;

View file

@ -4147,6 +4147,8 @@ rb_num_pow(VALUE x, VALUE y)
return rb_complex_pow(x, y);
case T_RATIONAL:
return rb_rational_pow(x, y);
default:
break;
}
return Qnil;
}

View file

@ -3917,6 +3917,8 @@ rb_num_to_dbl(VALUE val)
if (basic_to_f_p(rb_cRational))
return rat2dbl_without_to_f(val);
break;
default:
break;
}
}
val = numeric_to_float(val);
@ -3954,6 +3956,8 @@ rb_num2dbl(VALUE val)
return rat2dbl_without_to_f(val);
case T_STRING:
rb_raise(rb_eTypeError, "no implicit conversion to float from string");
default:
break;
}
}
val = rb_convert_type_with_id(val, T_FLOAT, "Float", id_to_f);
@ -4132,6 +4136,8 @@ rb_obj_dig(int argc, VALUE *argv, VALUE obj, VALUE notfound)
continue;
}
break;
default:
break;
}
}
return rb_check_funcall_with_hook_kw(obj, id_dig, argc, argv,

3
proc.c
View file

@ -1827,6 +1827,9 @@ rb_method_name_error(VALUE klass, VALUE str)
case T_CLASS:
c = obj;
s = MSG("");
break;
default:
break;
}
goto normal_class;
}

View file

@ -2390,6 +2390,8 @@ check_hash(VALUE obj)
case T_STRING:
case T_ARRAY:
return Qnil;
default:
break;
}
return rb_check_hash_type(obj);
}

View file

@ -318,6 +318,8 @@ linear_object_p(VALUE obj)
case T_FLOAT:
case T_BIGNUM:
return TRUE;
default:
break;
}
if (rb_obj_is_kind_of(obj, rb_cNumeric)) return TRUE;
if (rb_obj_is_kind_of(obj, rb_cTime)) return TRUE;

View file

@ -72,6 +72,7 @@ rb_namespace_p(VALUE obj)
if (RB_SPECIAL_CONST_P(obj)) return false;
switch (RB_BUILTIN_TYPE(obj)) {
case T_MODULE: case T_CLASS: return true;
default: break;
}
return false;
}

View file

@ -524,6 +524,8 @@ filter_defined_class(VALUE klass)
return 0;
case T_ICLASS:
break;
default:
break;
}
rb_bug("filter_defined_class: %s", rb_obj_info(klass));
}