summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-06-05 09:53:48 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-10-12 16:21:04 +0900
commit7ab7cadbbb012d9431928d9cfae09451eab86613 (patch)
tree2122fa4ecedf4a7106d2832e8050c9560280ccdc
parent2c1d209fd5514979d03382efd88189460c1de119 (diff)
downloadmruby-7ab7cadbbb012d9431928d9cfae09451eab86613.tar.gz
mruby-7ab7cadbbb012d9431928d9cfae09451eab86613.zip
Stringify non C identifier symbols to stop macro errors by old gcc.
-rw-r--r--Rakefile14
-rw-r--r--include/mruby/presym.h2
-rw-r--r--src/symbol.c4
3 files changed, 10 insertions, 10 deletions
diff --git a/Rakefile b/Rakefile
index 7b50eeffe..1452d7903 100644
--- a/Rakefile
+++ b/Rakefile
@@ -181,24 +181,24 @@ file presym_inc => presym_file do
if /\A\w+\Z/ =~ sym
f.print "MRB_PRESYM_CSYM(#{sym}, #{i+1})\n"
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
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
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
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
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
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
- f.print "MRB_PRESYM_SYM(#{sym}, #{i+1})\n"
+ f.print "MRB_PRESYM_SYM(\"#{sym}\", #{i+1})\n"
end
end
f.print "#define MRB_PRESYM_MAX #{presyms.size}"
diff --git a/include/mruby/presym.h b/include/mruby/presym.h
index 33e51fe18..3cc12e8fb 100644
--- a/include/mruby/presym.h
+++ b/include/mruby/presym.h
@@ -9,7 +9,7 @@
#undef MRB_PRESYM_MAX
#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)
enum mruby_presym {
diff --git a/src/symbol.c b/src/symbol.c
index 6a72a83c6..9981bad7c 100644
--- a/src/symbol.c
+++ b/src/symbol.c
@@ -17,8 +17,8 @@
#undef MRB_PRESYM_QSYM
#undef MRB_PRESYM_SYM
#define MRB_PRESYM_CSYM(sym, num) #sym,
-#define MRB_PRESYM_QSYM(sym, name, num) #sym,
-#define MRB_PRESYM_SYM(sym, num) #sym,
+#define MRB_PRESYM_QSYM(str, name, num) str,
+#define MRB_PRESYM_SYM(str, num) str,
static const char *presym_table[] = {
#include <../build/presym.inc>