1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2016-02-09 08:32:20 +00:00
parent 80e9ca6013
commit 67d1018982

10
ruby.c
View file

@ -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