summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-25 09:56:37 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-25 09:56:37 +0000
commit391925c78f8ba04f0da6214985a1c6642fe9fc5e (patch)
treeeccc53978ae7fd5a5caf3644a835a92b0e165485 /template
parent3b239725a07d4fc550c437ead6a0a933d74475c4 (diff)
merges r20977 and r20978 from trunk into ruby_1_9_1.
* template/id.h.tmpl, id.h (ruby_method_ids): not depend on if token are defined as macros. [ruby-dev:37553] -- * template/id.h.tmpl, id.h (ruby_method_ids_check): enclosed in a struct. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'template')
-rw-r--r--template/id.h.tmpl20
1 files changed, 15 insertions, 5 deletions
diff --git a/template/id.h.tmpl b/template/id.h.tmpl
index 643c711861..ab418c9200 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,14 @@ enum ruby_method_ids {
TOKEN2ID(Initialize)
};
+#ifdef tLAST_TOKEN
+struct ruby_method_ids_check {
+#define ruby_method_id_check_for(name, value) \
+ int checking_for_##name[name == value ? 1 : -1]
+% tokens.map do |token, value|
+ruby_method_id_check_for(<%=token%>, <%=value%>);
+% end
+};
+#endif
+
#endif /* RUBY_ID_H */