aboutsummaryrefslogtreecommitdiffstats
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-09 08:24:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-09 08:24:37 +0000
commitb42b64816d534cac684e868c61c6863d6b84f95d (patch)
tree1e4df3cdb0506eefe5462b4441648edacc9ac675 /ruby.c
parentf45758d7a622e7a48fb4ab58b45d9a03eb02d502 (diff)
downloadruby-b42b64816d534cac684e868c61c6863d6b84f95d.tar.gz
ruby.c: EACH_DUMPS
* ruby.c (EACH_DUMPS): define the list of dumping feature names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/ruby.c b/ruby.c
index 21061d3b0a..26c204cd16 100644
--- a/ruby.c
+++ b/ruby.c
@@ -87,17 +87,21 @@ enum feature_flag_bits {
#define DEBUG_BIT(bit) (1U << feature_debug_##bit)
#define DUMP_BIT(bit) (1U << dump_##bit)
+#define DEFINE_DUMP(bit) dump_##bit,
+#define EACH_DUMPS(X) \
+ X(version) \
+ X(copyright) \
+ X(usage) \
+ X(help) \
+ X(yydebug) \
+ X(syntax) \
+ X(parsetree) \
+ X(parsetree_with_comment) \
+ X(insns) \
+ /* END OF DUMPS */
enum dump_flag_bits {
- dump_version,
dump_version_v,
- dump_copyright,
- dump_usage,
- dump_help,
- dump_yydebug,
- dump_syntax,
- dump_parsetree,
- dump_parsetree_with_comment,
- dump_insns,
+ EACH_DUMPS(DEFINE_DUMP)
dump_flag_count
};
@@ -822,15 +826,7 @@ static void
dump_option(const char *str, int len, void *arg)
{
#define SET_WHEN_DUMP(bit) SET_WHEN(#bit, DUMP_BIT(bit), str, len)
- SET_WHEN_DUMP(version);
- SET_WHEN_DUMP(copyright);
- SET_WHEN_DUMP(usage);
- SET_WHEN_DUMP(help);
- SET_WHEN_DUMP(yydebug);
- SET_WHEN_DUMP(syntax);
- SET_WHEN_DUMP(parsetree);
- SET_WHEN_DUMP(parsetree_with_comment);
- SET_WHEN_DUMP(insns);
+ EACH_DUMPS(SET_WHEN_DUMP);
rb_warn("don't know how to dump `%.*s',", len, str);
rb_warn("but only [version, copyright, usage, yydebug, syntax, parsetree, parsetree_with_comment, insns].");
}