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 ...@@ -71,7 +71,6 @@ output_backtrace(mrb_state *mrb, mrb_int ciidx, mrb_code *pc0, output_stream_fun
for (i = ciidx; i >= 0; i--) { for (i = ciidx; i >= 0; i--) {
ci = &mrb->c->cibase[i]; ci = &mrb->c->cibase[i];
filename = NULL; filename = NULL;
lineno = -1;
if (!ci->proc) continue; if (!ci->proc) continue;
if (MRB_PROC_CFUNC_P(ci->proc)) { if (MRB_PROC_CFUNC_P(ci->proc)) {
......
...@@ -475,6 +475,8 @@ new_msym(codegen_scope *s, mrb_sym sym) ...@@ -475,6 +475,8 @@ new_msym(codegen_scope *s, mrb_sym sym)
{ {
size_t i, len; size_t i, len;
mrb_assert(s->irep);
len = s->irep->slen; len = s->irep->slen;
if (len > 256) len = 256; if (len > 256) len = 256;
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
...@@ -1106,6 +1108,7 @@ readint_mrb_int(codegen_scope *s, const char *p, int base, mrb_bool neg, mrb_boo ...@@ -1106,6 +1108,7 @@ readint_mrb_int(codegen_scope *s, const char *p, int base, mrb_bool neg, mrb_boo
codegen_error(s, "malformed readint input"); codegen_error(s, "malformed readint input");
} }
if(base > 0) {
if (neg) { if (neg) {
if ((MRB_INT_MIN + n)/base > result) { if ((MRB_INT_MIN + n)/base > result) {
*overflow = TRUE; *overflow = TRUE;
...@@ -1122,6 +1125,7 @@ readint_mrb_int(codegen_scope *s, const char *p, int base, mrb_bool neg, mrb_boo ...@@ -1122,6 +1125,7 @@ readint_mrb_int(codegen_scope *s, const char *p, int base, mrb_bool neg, mrb_boo
result *= base; result *= base;
result += n; result += n;
} }
}
p++; p++;
} }
*overflow = FALSE; *overflow = FALSE;
......
...@@ -343,7 +343,6 @@ write_section_irep(mrb_state *mrb, mrb_irep *irep, uint8_t *bin) ...@@ -343,7 +343,6 @@ write_section_irep(mrb_state *mrb, mrb_irep *irep, uint8_t *bin)
if (result != MRB_DUMP_OK) { if (result != MRB_DUMP_OK) {
return result; return result;
} }
cur += rsize;
section_size += rsize; section_size += rsize;
write_section_irep_header(mrb, section_size, bin); write_section_irep_header(mrb, section_size, bin);
......
...@@ -4243,7 +4243,6 @@ parser_yylex(parser_state *p) ...@@ -4243,7 +4243,6 @@ parser_yylex(parser_state *p)
return '='; return '=';
case '<': case '<':
last_state = p->lstate;
c = nextc(p); c = nextc(p);
if (c == '<' && if (c == '<' &&
p->lstate != EXPR_DOT && p->lstate != EXPR_DOT &&
...@@ -4374,7 +4373,7 @@ parser_yylex(parser_state *p) ...@@ -4374,7 +4373,7 @@ parser_yylex(parser_state *p)
p->lstate = EXPR_VALUE; p->lstate = EXPR_VALUE;
return '?'; return '?';
} }
token_column = newtok(p); newtok(p);
/* need support UTF-8 if configured */ /* need support UTF-8 if configured */
if ((isalnum(c) || c == '_')) { if ((isalnum(c) || c == '_')) {
int c2 = nextc(p); int c2 = nextc(p);
...@@ -4538,7 +4537,7 @@ parser_yylex(parser_state *p) ...@@ -4538,7 +4537,7 @@ parser_yylex(parser_state *p)
is_float = seen_point = seen_e = nondigit = 0; is_float = seen_point = seen_e = nondigit = 0;
p->lstate = EXPR_END; p->lstate = EXPR_END;
token_column = newtok(p); newtok(p);
if (c == '-' || c == '+') { if (c == '-' || c == '+') {
tokadd(p, c); tokadd(p, c);
c = nextc(p); c = nextc(p);
...@@ -5160,7 +5159,6 @@ parser_yylex(parser_state *p) ...@@ -5160,7 +5159,6 @@ parser_yylex(parser_state *p)
{ {
int result = 0; int result = 0;
last_state = p->lstate;
switch (tok(p)[0]) { switch (tok(p)[0]) {
case '$': case '$':
p->lstate = EXPR_END; 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