mruby-compiler: replace MRB_SYM_2() with MRB_SYM() macros

The _2 suffix variants accept an mrb_state* parameter that is
always ignored with presym enabled. Replace all uses in codegen.c,
parse.y, and y.tab.c with the standard macros. The _2 macro
definitions are kept in presym headers for backward compatibility.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-02-19 14:14:40 +09:00
parent bd4f380178
commit dcd77f1efd
7 changed files with 86 additions and 82 deletions
+3 -2
View File
@@ -31,8 +31,9 @@
* excluding leading and ending punctuation.
*
* These macros are expanded to compile-time integer constants.
* The `_2` suffix variants (e.g., `MRB_SYM_2`) accept an explicit
* mruby state parameter but currently ignore it.
* The `_2` suffix variants (e.g., `MRB_SYM_2`) are kept for backward
* compatibility only; they accept an explicit `mrb_state*` parameter
* but ignore it. New code should use the standard macros above.
*/
#endif /* MRUBY_PRESYM_H */
+1
View File
@@ -18,6 +18,7 @@
#define MRB_SYM_E(name) MRB_SYM_E__##name
#define MRB_SYM(name) MRB_SYM__##name
/* backward compatibility: _2 variants accept but ignore mrb_state* */
#define MRB_OPSYM_2(mrb, name) MRB_OPSYM__##name
#define MRB_GVSYM_2(mrb, name) MRB_GVSYM__##name
#define MRB_CVSYM_2(mrb, name) MRB_CVSYM__##name
+1
View File
@@ -38,6 +38,7 @@
#define MRB_SYM_E(name) MRB_PRESYM_SCANNING_TAGGED(#name "=")
#define MRB_SYM(name) MRB_PRESYM_SCANNING_TAGGED(#name)
/* backward compatibility: _2 variants accept but ignore mrb_state* */
#define MRB_OPSYM_2(mrb, name) MRB_OPSYM__##name(mrb)
#define MRB_GVSYM_2(mrb, name) MRB_PRESYM_SCANNING_TAGGED("$" #name)
#define MRB_CVSYM_2(mrb, name) MRB_PRESYM_SCANNING_TAGGED("@@" #name)