class.c: auto-set MRB_MT_FUNC in MRB_MT_ENTRY macro

Since ROM table entries are always C functions, have the
MRB_MT_ENTRY() macro set MRB_MT_FUNC automatically. This
simplifies entry definitions across all 32 source files.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-02-20 10:37:06 +09:00
parent 0fab703028
commit 8adba34bd9
34 changed files with 727 additions and 729 deletions
+2 -2
View File
@@ -55,9 +55,9 @@ typedef struct mrb_mt_tbl {
#define MRB_MT_PUBLIC 0 /* MRB_METHOD_PUBLIC_FL */
#define MRB_MT_PRIVATE 1 /* MRB_METHOD_PRIVATE_FL */
/* ROM table entry: { {.func=fn}, sym, flags } */
/* ROM table entry: MRB_MT_FUNC is set automatically */
#define MRB_MT_ENTRY(fn, sym, flags) \
{ { .func = (fn) }, (sym), (flags) }
{ { .func = (fn) }, (sym), (flags) | MRB_MT_FUNC }
/* ROM table initializer from const entries array (auto-computes size).
Casts away const because mrb_mt_tbl.ptr is shared with mutable layers;