From 402690c3b60b61dce3a251acb46bfe9a615a25bb Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 20 Feb 2024 17:18:11 -0500 Subject: [PATCH] Fix incomplete switch statement in imemo_memsize The switch statement is not exhaustive, meaning the "unreachable" comment was not correct. This commit fixes it by making the list exhaustive and adding an rb_bug in the default case. --- gc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gc.c b/gc.c index 4a06047e9e..89c474f730 100644 --- a/gc.c +++ b/gc.c @@ -3060,6 +3060,9 @@ imemo_memsize(VALUE obj) case imemo_ast: size += rb_ast_memsize(&RANY(obj)->as.imemo.ast); break; + case imemo_callcache: + case imemo_callinfo: + case imemo_constcache: case imemo_cref: case imemo_svar: case imemo_throw_data: @@ -3068,7 +3071,7 @@ imemo_memsize(VALUE obj) case imemo_parser_strterm: break; default: - /* unreachable */ + rb_bug("unreachable"); break; } return size;