Make mrb_static_assert() a variable argument

`mrb_static_assert()` extends the macro function to take one or two arguments.
If the argument is other than that, an error will occur.

References:
- static_assert のメッセージ省略を許可 - cpprefjp C++日本語リファレンス
  https://cpprefjp.github.io/lang/cpp17/extending_static_assert.html
- c - Overloading Macro on Number of Arguments - Stack Overflow
  https://stackoverflow.com/a/11763277
This commit is contained in:
dearblue
2021-10-24 23:11:52 +09:00
parent 7850549a5e
commit b774832ee1
7 changed files with 31 additions and 13 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ union mrb_value_ {
mrb_value value;
};
mrb_static_assert1(sizeof(mrb_value) == sizeof(union mrb_value_));
mrb_static_assert(sizeof(mrb_value) == sizeof(union mrb_value_));
static inline union mrb_value_
mrb_val_union(mrb_value v)
+1 -1
View File
@@ -130,7 +130,7 @@ union mrb_value_ {
mrb_value value;
};
mrb_static_assert1(sizeof(mrb_value) == sizeof(union mrb_value_));
mrb_static_assert(sizeof(mrb_value) == sizeof(union mrb_value_));
static inline union mrb_value_
mrb_val_union(mrb_value v)