aboutsummaryrefslogtreecommitdiffstats
path: root/iseq.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-28 06:42:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-28 06:42:18 +0000
commitf84ba30af5f324e85e076cb68a7d6908e8573125 (patch)
tree11ee49aaeba2985c7c0f5dca623907af323b12e4 /iseq.c
parent2eb5e09ea5115ecba93efa38b0662eb28d657c1d (diff)
downloadruby-f84ba30af5f324e85e076cb68a7d6908e8573125.tar.gz
iseq.c: suppress warnings
* iseq.c (rb_iseq_compile_with_option): suppress "clobbered" warnings by old gcc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/iseq.c b/iseq.c
index 3c68264262..da5fce65ff 100644
--- a/iseq.c
+++ b/iseq.c
@@ -386,7 +386,7 @@ make_compile_option(rb_compile_option_t *option, VALUE opt)
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, VALUE file, VALUE absolute_path, VALUE li
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;