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

ruby-changes:41283

From: nobu <ko1@a...>
Date: Mon, 28 Dec 2015 15:42:29 +0900 (JST)
Subject: [ruby-changes:41283] nobu:r53355 (trunk): iseq.c: suppress warnings

nobu	2015-12-28 15:42:18 +0900 (Mon, 28 Dec 2015)

  New Revision: 53355

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

  Log:
    iseq.c: suppress warnings
    
    * iseq.c (rb_iseq_compile_with_option): suppress "clobbered"
      warnings by old gcc.

  Modified files:
    trunk/iseq.c
Index: iseq.c
===================================================================
--- iseq.c	(revision 53354)
+++ iseq.c	(revision 53355)
@@ -386,7 +386,7 @@ make_compile_option(rb_compile_option_t https://github.com/ruby/ruby/blob/trunk/iseq.c#L386
 	for (i = 0; i < (int)(sizeof(rb_compile_option_t) / sizeof(int)); ++i)
 	    ((int *)option)[i] = 1;
     }
-    else if (CLASS_OF(opt) == rb_cHash) {
+    else if (RB_TYPE_P(opt, T_HASH)) {
 	*option = COMPILE_OPTION_DEFAULT;
 	set_compile_option_from_hash(option, opt);
     }
@@ -603,31 +603,25 @@ rb_iseq_compile_with_option(VALUE src, V https://github.com/ruby/ruby/blob/trunk/iseq.c#L603
     rb_thread_t *th = GET_THREAD();
     rb_block_t *prev_base_block = th->base_block;
     rb_iseq_t *iseq = NULL;
-    const rb_iseq_t *parent = NULL;
+    const rb_iseq_t *const parent = base_block ? base_block->iseq : NULL;
     rb_compile_option_t option;
     VALUE label;
-    enum iseq_type type;
-    NODE *(*parse)(VALUE vparser, VALUE fname, VALUE file, int start);
+    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);
-    if (RB_TYPE_P(src, T_FILE)) {
-	parse = rb_parser_compile_file_path;
-    }
-    else {
-	StringValue(src);
-	parse = rb_parser_compile_string_path;
-    }
 
     make_compile_option(&option, opt);
 
-    if (base_block && (parent = base_block->iseq) != NULL) {
+    if (parent) {
 	label = parent->body->location.label;
-	type = ISEQ_TYPE_EVAL;
     }
     else {
 	label = rb_fstring_cstr("<compiled>");
-	type = ISEQ_TYPE_TOP;
     }
 
     th->base_block = base_block;

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

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