Commit e4b01da9 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2393 from goyox86/fix-clang-analizer-warnings

Fix clang analizer warnings
parents 774703c5 61032c5a
......@@ -71,7 +71,6 @@ output_backtrace(mrb_state *mrb, mrb_int ciidx, mrb_code *pc0, output_stream_fun
for (i = ciidx; i >= 0; i--) {
ci = &mrb->c->cibase[i];
filename = NULL;
lineno = -1;
if (!ci->proc) continue;
if (MRB_PROC_CFUNC_P(ci->proc)) {
......
......@@ -475,6 +475,8 @@ new_msym(codegen_scope *s, mrb_sym sym)
{
size_t i, len;
mrb_assert(s->irep);
len = s->irep->slen;
if (len > 256) len = 256;
for (i=0; i<len; i++) {
......@@ -1106,21 +1108,23 @@ readint_mrb_int(codegen_scope *s, const char *p, int base, mrb_bool neg, mrb_boo
codegen_error(s, "malformed readint input");
}
if (neg) {
if ((MRB_INT_MIN + n)/base > result) {
*overflow = TRUE;
return 0;
if(base > 0) {
if (neg) {
if ((MRB_INT_MIN + n)/base > result) {
*overflow = TRUE;
return 0;
}
result *= base;
result -= n;
}
result *= base;
result -= n;
}
else {
if ((MRB_INT_MAX - n)/base < result) {
*overflow = TRUE;
return 0;
else {
if ((MRB_INT_MAX - n)/base < result) {
*overflow = TRUE;
return 0;
}
result *= base;
result += n;
}
result *= base;
result += n;
}
p++;
}
......
......@@ -343,7 +343,6 @@ write_section_irep(mrb_state *mrb, mrb_irep *irep, uint8_t *bin)
if (result != MRB_DUMP_OK) {
return result;
}
cur += rsize;
section_size += rsize;
write_section_irep_header(mrb, section_size, bin);
......
......@@ -4243,7 +4243,6 @@ parser_yylex(parser_state *p)
return '=';
case '<':
last_state = p->lstate;
c = nextc(p);
if (c == '<' &&
p->lstate != EXPR_DOT &&
......@@ -4374,7 +4373,7 @@ parser_yylex(parser_state *p)
p->lstate = EXPR_VALUE;
return '?';
}
token_column = newtok(p);
newtok(p);
/* need support UTF-8 if configured */
if ((isalnum(c) || c == '_')) {
int c2 = nextc(p);
......@@ -4538,7 +4537,7 @@ parser_yylex(parser_state *p)
is_float = seen_point = seen_e = nondigit = 0;
p->lstate = EXPR_END;
token_column = newtok(p);
newtok(p);
if (c == '-' || c == '+') {
tokadd(p, c);
c = nextc(p);
......@@ -5160,7 +5159,6 @@ parser_yylex(parser_state *p)
{
int result = 0;
last_state = p->lstate;
switch (tok(p)[0]) {
case '$':
p->lstate = EXPR_END;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment