summaryrefslogtreecommitdiff
path: root/template/id.h.tmpl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-24 20:05:12 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-24 20:05:12 (GMT)
commit934525776f60171fff0c5453e795de051fc0ab15 (patch)
treee8deb8c8c1b4557857334d2df8293ce3e51d8a71 /template/id.h.tmpl
parent011fc2649d99a87b06e2e31e13a74e450470d643 (diff)
* template/id.h.tmpl, id.h (ruby_method_ids): not depend on if
token are defined as macros. [ruby-dev:37553] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'template/id.h.tmpl')
-rw-r--r--template/id.h.tmpl18
1 files changed, 13 insertions, 5 deletions
diff --git a/template/id.h.tmpl b/template/id.h.tmpl
index c16137c..22fe9ef 100644
--- a/template/id.h.tmpl
+++ b/template/id.h.tmpl
@@ -53,15 +53,15 @@ end
#define symIFUNC ID2SYM(idIFUNC)
#define symCFUNC ID2SYM(idCFUNC)
+#if !defined tLAST_TOKEN && defined YYTOKENTYPE
+#define tLAST_TOKEN tLAST_TOKEN
+#endif
+
enum ruby_method_ids {
-#if !defined tLAST_TOKEN && !defined YYTOKENTYPE
+#ifndef tLAST_TOKEN
% tokens.each do |token, value|
<%=token%> = <%=value%>,
% end
-% tokens.map do |token, value|
-#elif <%=token%> != <%=value%>
-#error <%=token%> differs
-% end
#endif
idPLUS = '+',
idMINUS = '-',
@@ -114,4 +114,12 @@ enum ruby_method_ids {
TOKEN2ID(Initialize)
};
+#ifdef tLAST_TOKEN
+#define ruby_method_id_check_for(name, value) \
+ typedef int ruby_method_id_check_for_##name[name == value ? 1 : -1]
+% tokens.map do |token, value|
+ruby_method_id_check_for(<%=token%>, <%=value%>);
+% end
+#endif
+
#endif /* RUBY_ID_H */