diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-08-08 10:39:26 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-08-08 10:39:26 +0900 |
| commit | c849b894edbf5bb170721e836bbef514fb74d074 (patch) | |
| tree | 118376f23da63a81d9d141e2a0352ea37c1eb450 /src/string.c | |
| parent | d8e060d2d3391b734f40b812651a171762de1c3b (diff) | |
| download | mruby-c849b894edbf5bb170721e836bbef514fb74d074.tar.gz mruby-c849b894edbf5bb170721e836bbef514fb74d074.zip | |
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.
Diffstat (limited to 'src/string.c')
| -rw-r--r-- | src/string.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c index e8f81c0ae..78c41c5f3 100644 --- a/src/string.c +++ b/src/string.c @@ -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); |
