summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-09 08:32:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-09 08:32:20 +0000
commit67d10189823b4f28412dcb99c49d4f2e22046518 (patch)
treeb0566fa33eb9f5636270fb3a16df878eb0e78825 /ruby.c
parent80e9ca6013fcb111668d95953d13be8b20689a62 (diff)
ruby.c: available list from enum
* ruby.c (feature_option, debug_option, dump_option): build available list in warning messages from enum lists. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ruby.c b/ruby.c
index 26c204c..af785ec 100644
--- a/ruby.c
+++ b/ruby.c
@@ -762,9 +762,12 @@ name_match_p(const char *name, const char *str, size_t len)
return; \
}
+#define LITERAL_NAME_ELEMENT(name) #name", "
+
static void
feature_option(const char *str, int len, void *arg, const unsigned int enable)
{
+ static const char list[] = EACH_FEATURES(LITERAL_NAME_ELEMENT);
unsigned int *argp = arg;
unsigned int mask = ~0U;
#if AMBIGUOUS_FEATURE_NAMES
@@ -799,7 +802,7 @@ feature_option(const char *str, int len, void *arg, const unsigned int enable)
#endif
rb_warn("unknown argument for --%s: `%.*s'",
enable ? "enable" : "disable", len, str);
- rb_warn("features are [gems, did-you-mean, rubyopt, frozen-string-literal].");
+ rb_warn("features are [%.*s].", (int)strlen(list) - 2, list);
}
static void
@@ -817,18 +820,21 @@ disable_option(const char *str, int len, void *arg)
static void
debug_option(const char *str, int len, void *arg)
{
+ static const char list[] = EACH_DEBUG_FEATURES(LITERAL_NAME_ELEMENT);
#define SET_WHEN_DEBUG(bit) SET_WHEN(#bit, DEBUG_BIT(bit), str, len)
EACH_DEBUG_FEATURES(SET_WHEN_DEBUG);
rb_warn("unknown argument for --debug: `%.*s'", len, str);
+ rb_warn("debug features are [%.*s].", (int)strlen(list) - 2, list);
}
static void
dump_option(const char *str, int len, void *arg)
{
+ static const char list[] = EACH_DEBUG_FEATURES(LITERAL_NAME_ELEMENT);
#define SET_WHEN_DUMP(bit) SET_WHEN(#bit, DUMP_BIT(bit), str, len)
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].");
+ rb_warn("but only [%.*s].", (int)strlen(list) - 2, list);
}
static void