Stringify non C identifier symbols to stop macro errors by old gcc.

parent 2c1d209f
...@@ -181,24 +181,24 @@ file presym_inc => presym_file do ...@@ -181,24 +181,24 @@ file presym_inc => presym_file do
if /\A\w+\Z/ =~ sym if /\A\w+\Z/ =~ sym
f.print "MRB_PRESYM_CSYM(#{sym}, #{i+1})\n" f.print "MRB_PRESYM_CSYM(#{sym}, #{i+1})\n"
elsif op_table.key?(sym) elsif op_table.key?(sym)
f.print "MRB_PRESYM_QSYM(#{sym}, #{op_table[sym]}, #{i+1})\n" f.print "MRB_PRESYM_QSYM(\"#{sym}\", #{op_table[sym]}, #{i+1})\n"
elsif /\?\Z/ =~ sym elsif /\?\Z/ =~ sym
s = sym.dup; s[-1] = "_p" s = sym.dup; s[-1] = "_p"
f.print "MRB_PRESYM_QSYM(#{sym}, #{s}, #{i+1})\n" f.print "MRB_PRESYM_QSYM(\"#{sym}\", #{s}, #{i+1})\n"
elsif /\!\Z/ =~ sym elsif /\!\Z/ =~ sym
s = sym.dup; s[-1] = "_b" s = sym.dup; s[-1] = "_b"
f.print "MRB_PRESYM_QSYM(#{sym}, #{s}, #{i+1})\n" f.print "MRB_PRESYM_QSYM(\"#{sym}\", #{s}, #{i+1})\n"
elsif /\=\Z/ =~ sym elsif /\=\Z/ =~ sym
s = sym.dup; s[-1] = "_e" s = sym.dup; s[-1] = "_e"
f.print "MRB_PRESYM_QSYM(#{sym}, #{s}, #{i+1})\n" f.print "MRB_PRESYM_QSYM(\"#{sym}\", #{s}, #{i+1})\n"
elsif /\A@/ =~ sym elsif /\A@/ =~ sym
s = sym.dup; s[0] = "a_" s = sym.dup; s[0] = "a_"
f.print "MRB_PRESYM_QSYM(#{sym}, #{s}, #{i+1})\n" f.print "MRB_PRESYM_QSYM(\"#{sym}\", #{s}, #{i+1})\n"
elsif /\A$/ =~ sym elsif /\A$/ =~ sym
s = sym.dup; s[0] = "d_" s = sym.dup; s[0] = "d_"
f.print "MRB_PRESYM_QSYM(#{sym}, #{s}, #{i+1})\n" f.print "MRB_PRESYM_QSYM(\"#{sym}\", #{s}, #{i+1})\n"
else else
f.print "MRB_PRESYM_SYM(#{sym}, #{i+1})\n" f.print "MRB_PRESYM_SYM(\"#{sym}\", #{i+1})\n"
end end
end end
f.print "#define MRB_PRESYM_MAX #{presyms.size}" f.print "#define MRB_PRESYM_MAX #{presyms.size}"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#undef MRB_PRESYM_MAX #undef MRB_PRESYM_MAX
#define MRB_PRESYM_CSYM(sym, num) MRB_PRESYM__##sym = (num<<1), #define MRB_PRESYM_CSYM(sym, num) MRB_PRESYM__##sym = (num<<1),
#define MRB_PRESYM_QSYM(src, sym, num) MRB_PRESYM_q_##sym = (num<<1), #define MRB_PRESYM_QSYM(str, sym, num) MRB_PRESYM_q_##sym = (num<<1),
#define MRB_PRESYM_SYM(sym, num) #define MRB_PRESYM_SYM(sym, num)
enum mruby_presym { enum mruby_presym {
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#undef MRB_PRESYM_QSYM #undef MRB_PRESYM_QSYM
#undef MRB_PRESYM_SYM #undef MRB_PRESYM_SYM
#define MRB_PRESYM_CSYM(sym, num) #sym, #define MRB_PRESYM_CSYM(sym, num) #sym,
#define MRB_PRESYM_QSYM(sym, name, num) #sym, #define MRB_PRESYM_QSYM(str, name, num) str,
#define MRB_PRESYM_SYM(sym, num) #sym, #define MRB_PRESYM_SYM(str, num) str,
static const char *presym_table[] = { static const char *presym_table[] = {
#include <../build/presym.inc> #include <../build/presym.inc>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment