[前][次][番号順一覧][スレッド一覧]

ruby-changes:41719

From: nobu <ko1@a...>
Date: Tue, 9 Feb 2016 17:32:11 +0900 (JST)
Subject: [ruby-changes:41719] nobu:r53793 (trunk): ruby.c: available list from enum

nobu	2016-02-09 17:32:20 +0900 (Tue, 09 Feb 2016)

  New Revision: 53793

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53793

  Log:
    ruby.c: available list from enum
    
    * ruby.c (feature_option, debug_option, dump_option): build
      available list in warning messages from enum lists.

  Modified files:
    trunk/ruby.c
Index: ruby.c
===================================================================
--- ruby.c	(revision 53792)
+++ ruby.c	(revision 53793)
@@ -762,9 +762,12 @@ name_match_p(const char *name, const cha https://github.com/ruby/ruby/blob/trunk/ruby.c#L762
 	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, https://github.com/ruby/ruby/blob/trunk/ruby.c#L802
 #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, https://github.com/ruby/ruby/blob/trunk/ruby.c#L820
 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]