Reintroduce mrb_static_assert; #5051

Note that the home brew version of `mrb_static_assert` only works within
the function body.  This reverts commit 8f99689.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-08-08 10:39:26 +09:00
parent d8e060d2d3
commit c849b894ed
3 changed files with 15 additions and 3 deletions
+3
View File
@@ -1619,6 +1619,9 @@ mrb_init_gc(mrb_state *mrb)
{
struct RClass *gc;
mrb_static_assert(sizeof(RVALUE) <= sizeof(void*) * 6,
"RVALUE size must be within 6 words");
gc = mrb_define_module(mrb, "GC");
mrb_define_class_method(mrb, gc, "start", gc_start, MRB_ARGS_NONE());
+3
View File
@@ -2926,6 +2926,9 @@ mrb_init_string(mrb_state *mrb)
{
struct RClass *s;
mrb_static_assert(RSTRING_EMBED_LEN_MAX < (1 << MRB_STR_EMBED_LEN_BIT),
"pointer size too big for embedded string");
mrb->string_class = s = mrb_define_class(mrb, "String", mrb->object_class); /* 15.2.10 */
MRB_SET_INSTANCE_TT(s, MRB_TT_STRING);