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

ruby-changes:41959

From: nobu <ko1@a...>
Date: Wed, 9 Mar 2016 00:21:26 +0900 (JST)
Subject: [ruby-changes:41959] nobu:r54033 (trunk): ruby.c: extra comma

nobu	2016-03-09 00:21:22 +0900 (Wed, 09 Mar 2016)

  New Revision: 54033

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

  Log:
    ruby.c: extra comma
    
    * ruby.c (feature_option, debug_option, dump_option): remove an
      extra comma from option lists.

  Modified files:
    trunk/ruby.c
Index: ruby.c
===================================================================
--- ruby.c	(revision 54032)
+++ ruby.c	(revision 54033)
@@ -63,45 +63,57 @@ char *getenv(); https://github.com/ruby/ruby/blob/trunk/ruby.c#L63
 #define DEFAULT_RUBYGEMS_ENABLED "enabled"
 #endif
 
+#define COMMA ,
 #define FEATURE_BIT(bit) (1U << feature_##bit)
-#define EACH_FEATURES(X) \
+#define EACH_FEATURES(X, SEP) \
     X(gems) \
+    SEP \
     X(did_you_mean) \
+    SEP \
     X(rubyopt) \
+    SEP \
     X(frozen_string_literal) \
     /* END OF FEATURES */
-#define EACH_DEBUG_FEATURES(X) \
+#define EACH_DEBUG_FEATURES(X, SEP) \
     X(frozen_string_literal) \
     /* END OF DEBUG FEATURES */
 #define AMBIGUOUS_FEATURE_NAMES 0 /* no ambiguous feature names now */
-#define DEFINE_FEATURE(bit) feature_##bit,
-#define DEFINE_DEBUG_FEATURE(bit) feature_debug_##bit,
+#define DEFINE_FEATURE(bit) feature_##bit
+#define DEFINE_DEBUG_FEATURE(bit) feature_debug_##bit
 enum feature_flag_bits {
-    EACH_FEATURES(DEFINE_FEATURE)
+    EACH_FEATURES(DEFINE_FEATURE, COMMA),
     feature_debug_flag_first,
     feature_debug_flag_begin = feature_debug_flag_first - 1,
-    EACH_DEBUG_FEATURES(DEFINE_DEBUG_FEATURE)
+    EACH_DEBUG_FEATURES(DEFINE_DEBUG_FEATURE, COMMA),
     feature_flag_count
 };
 
 #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) \
+#define DEFINE_DUMP(bit) dump_##bit
+#define EACH_DUMPS(X, SEP) \
     X(version) \
+    SEP \
     X(copyright) \
+    SEP \
     X(usage) \
+    SEP \
     X(help) \
+    SEP \
     X(yydebug) \
+    SEP \
     X(syntax) \
+    SEP \
     X(parsetree) \
+    SEP \
     X(parsetree_with_comment) \
+    SEP \
     X(insns) \
     /* END OF DUMPS */
 enum dump_flag_bits {
     dump_version_v,
-    EACH_DUMPS(DEFINE_DUMP)
+    EACH_DUMPS(DEFINE_DUMP, COMMA),
     dump_flag_count
 };
 
@@ -761,12 +773,12 @@ name_match_p(const char *name, const cha https://github.com/ruby/ruby/blob/trunk/ruby.c#L773
 	return;				\
     }
 
-#define LITERAL_NAME_ELEMENT(name) #name", "
+#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);
+    static const char list[] = EACH_FEATURES(LITERAL_NAME_ELEMENT, ", ");
     unsigned int *argp = arg;
     unsigned int mask = ~0U;
 #if AMBIGUOUS_FEATURE_NAMES
@@ -778,7 +790,7 @@ feature_option(const char *str, int len, https://github.com/ruby/ruby/blob/trunk/ruby.c#L790
 #define SET_FEATURE(bit) \
     if (NAME_MATCH_P(#bit, str, len)) {mask = FEATURE_BIT(bit); goto found;}
 #endif
-    EACH_FEATURES(SET_FEATURE);
+    EACH_FEATURES(SET_FEATURE, ;);
     if (NAME_MATCH_P("all", str, len)) {
       found:
 	*argp = (*argp & ~mask) | (mask & enable);
@@ -793,7 +805,7 @@ feature_option(const char *str, int len, https://github.com/ruby/ruby/blob/trunk/ruby.c#L805
 	    rb_str_cat_cstr(mesg, #bit); \
 	    if (--matched) rb_str_cat_cstr(mesg, ", "); \
 	}
-	EACH_FEATURES(ADD_FEATURE_NAME);
+	EACH_FEATURES(ADD_FEATURE_NAME, ;);
 	rb_str_cat_cstr(mesg, ")");
 	rb_exc_raise(rb_exc_new_str(rb_eRuntimeError, mesg));
 #undef ADD_FEATURE_NAME
@@ -801,7 +813,7 @@ feature_option(const char *str, int len, https://github.com/ruby/ruby/blob/trunk/ruby.c#L813
 #endif
     rb_warn("unknown argument for --%s: `%.*s'",
 	    enable ? "enable" : "disable", len, str);
-    rb_warn("features are [%.*s].", (int)strlen(list) - 2, list);
+    rb_warn("features are [%.*s].", (int)strlen(list), list);
 }
 
 static void
@@ -819,21 +831,21 @@ disable_option(const char *str, int len, https://github.com/ruby/ruby/blob/trunk/ruby.c#L831
 static void
 debug_option(const char *str, int len, void *arg)
 {
-    static const char list[] = EACH_DEBUG_FEATURES(LITERAL_NAME_ELEMENT);
+    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);
+    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);
+    rb_warn("debug features are [%.*s].", (int)strlen(list), list);
 }
 
 static void
 dump_option(const char *str, int len, void *arg)
 {
-    static const char list[] = EACH_DUMPS(LITERAL_NAME_ELEMENT);
+    static const char list[] = EACH_DUMPS(LITERAL_NAME_ELEMENT, ", ");
 #define SET_WHEN_DUMP(bit) SET_WHEN(#bit, DUMP_BIT(bit), str, len)
-    EACH_DUMPS(SET_WHEN_DUMP);
+    EACH_DUMPS(SET_WHEN_DUMP, ;);
     rb_warn("don't know how to dump `%.*s',", len, str);
-    rb_warn("but only [%.*s].", (int)strlen(list) - 2, list);
+    rb_warn("but only [%.*s].", (int)strlen(list), list);
 }
 
 static void

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

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