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

ruby-changes:41386

From: shugo <ko1@a...>
Date: Fri, 8 Jan 2016 09:38:26 +0900 (JST)
Subject: [ruby-changes:41386] shugo:r53458 (trunk): * iseq.c (rb_iseq_compile_with_option): move variable initialization

shugo	2016-01-08 09:38:40 +0900 (Fri, 08 Jan 2016)

  New Revision: 53458

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

  Log:
    * iseq.c (rb_iseq_compile_with_option): move variable initialization
      code to avoid maybe-uninitialized warnings by gcc 4.8.

  Modified files:
    trunk/ChangeLog
    trunk/iseq.c
Index: iseq.c
===================================================================
--- iseq.c	(revision 53457)
+++ iseq.c	(revision 53458)
@@ -605,28 +605,22 @@ rb_iseq_compile_with_option(VALUE src, V https://github.com/ruby/ruby/blob/trunk/iseq.c#L605
     rb_iseq_t *iseq = NULL;
     const rb_iseq_t *const parent = base_block ? base_block->iseq : NULL;
     rb_compile_option_t option;
-    VALUE label;
     const enum iseq_type type = parent ? ISEQ_TYPE_EVAL : ISEQ_TYPE_TOP;
-    int ln = NUM2INT(line);
-    NODE *(*parse)(VALUE vparser, VALUE fname, VALUE file, int start) =
-	(RB_TYPE_P(src, T_FILE) ?
-	 rb_parser_compile_file_path :
-	 (StringValue(src), rb_parser_compile_string_path));
 
     StringValueCStr(file);
 
     make_compile_option(&option, opt);
 
-    if (parent) {
-	label = parent->body->location.label;
-    }
-    else {
-	label = rb_fstring_cstr("<compiled>");
-    }
-
     th->base_block = base_block;
     TH_PUSH_TAG(th);
     if ((state = EXEC_TAG()) == 0) {
+	VALUE label = parent ? parent->body->location.label :
+	    rb_fstring_cstr("<compiled>");
+	int ln = NUM2INT(line);
+	NODE *(*parse)(VALUE vparser, VALUE fname, VALUE file, int start) =
+	    (RB_TYPE_P(src, T_FILE) ?
+	     rb_parser_compile_file_path :
+	     (StringValue(src), rb_parser_compile_string_path));
 	NODE *node = (*parse)(rb_parser_new(), file, src, ln);
 	if (node) { /* TODO: check err */
 	    iseq = rb_iseq_new_with_opt(node, label, file, absolute_path, line,
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53457)
+++ ChangeLog	(revision 53458)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jan  8 09:33:59 2016  Shugo Maeda  <shugo@r...>
+
+	* iseq.c (rb_iseq_compile_with_option): move variable initialization
+	  code to avoid maybe-uninitialized warnings by gcc 4.8.
+
 Fri Jan  8 00:03:22 2016  Shugo Maeda  <shugo@r...>
 
 	* enum.c (enum_min, enum_max): do the same optimization as r53454.

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

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