Add explicit casts to enum-to-integer conversions (#2467)
Clang 6 is more picky about implicit conversions and complains about loss of presicion and/or change of signedness. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -558,7 +558,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||
break;
|
||||
}
|
||||
|
||||
context_p->token.type = keyword_p->type;
|
||||
context_p->token.type = (uint8_t) keyword_p->type;
|
||||
break;
|
||||
}
|
||||
keyword_p++;
|
||||
|
||||
@@ -203,7 +203,7 @@ parser_emit_unary_lvalue_opcode (parser_context_t *context_p, /**< context */
|
||||
break;
|
||||
}
|
||||
}
|
||||
parser_emit_cbc (context_p, opcode);
|
||||
parser_emit_cbc (context_p, (uint16_t) opcode);
|
||||
}
|
||||
} /* parser_emit_unary_lvalue_opcode */
|
||||
|
||||
@@ -1091,7 +1091,7 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
}
|
||||
|
||||
parser_emit_cbc_literal_from_token (context_p, opcode);
|
||||
parser_emit_cbc_literal_from_token (context_p, (uint16_t) opcode);
|
||||
break;
|
||||
}
|
||||
case LEXER_KEYW_FUNCTION:
|
||||
@@ -1770,7 +1770,7 @@ parser_process_binary_opcodes (parser_context_t *context_p, /**< context */
|
||||
if (cbc_flags[opcode] & CBC_HAS_LITERAL_ARG)
|
||||
{
|
||||
uint16_t index = parser_stack_pop_uint16 (context_p);
|
||||
parser_emit_cbc_literal (context_p, opcode, index);
|
||||
parser_emit_cbc_literal (context_p, (uint16_t) opcode, index);
|
||||
|
||||
if (opcode == CBC_ASSIGN_PROP_THIS_LITERAL
|
||||
&& (context_p->stack_depth >= context_p->stack_limit))
|
||||
@@ -1830,7 +1830,7 @@ parser_process_binary_opcodes (parser_context_t *context_p, /**< context */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
parser_emit_cbc (context_p, opcode);
|
||||
parser_emit_cbc (context_p, (uint16_t) opcode);
|
||||
}
|
||||
} /* parser_process_binary_opcodes */
|
||||
|
||||
@@ -1916,7 +1916,7 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
|
||||
opcode = CBC_BRANCH_IF_TRUE_FORWARD;
|
||||
}
|
||||
|
||||
parser_emit_cbc_forward_branch (context_p, opcode, &cond_branch);
|
||||
parser_emit_cbc_forward_branch (context_p, (uint16_t) opcode, &cond_branch);
|
||||
|
||||
lexer_next_token (context_p);
|
||||
parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);
|
||||
|
||||
@@ -660,7 +660,7 @@ parser_parse_do_while_statement_end (parser_context_t *context_p) /**< context *
|
||||
parser_stack_iterator_skip (&iterator, sizeof (parser_loop_statement_t));
|
||||
parser_stack_iterator_read (&iterator, &do_while_statement, sizeof (parser_do_while_statement_t));
|
||||
|
||||
parser_emit_cbc_backward_branch (context_p, opcode, do_while_statement.start_offset);
|
||||
parser_emit_cbc_backward_branch (context_p, (uint16_t) opcode, do_while_statement.start_offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -759,7 +759,7 @@ parser_parse_while_statement_end (parser_context_t *context_p) /**< context */
|
||||
parser_stack_pop (context_p, NULL, 1 + sizeof (parser_loop_statement_t) + sizeof (parser_while_statement_t));
|
||||
parser_stack_iterator_init (context_p, &context_p->last_statement);
|
||||
|
||||
parser_emit_cbc_backward_branch (context_p, opcode, while_statement.start_offset);
|
||||
parser_emit_cbc_backward_branch (context_p, (uint16_t) opcode, while_statement.start_offset);
|
||||
parser_set_breaks_to_current_position (context_p, loop.branch_list_p);
|
||||
|
||||
parser_set_range (context_p, &range);
|
||||
@@ -1027,7 +1027,7 @@ parser_parse_for_statement_end (parser_context_t *context_p) /**< context */
|
||||
parser_stack_pop (context_p, NULL, 1 + sizeof (parser_loop_statement_t) + sizeof (parser_for_statement_t));
|
||||
parser_stack_iterator_init (context_p, &context_p->last_statement);
|
||||
|
||||
parser_emit_cbc_backward_branch (context_p, opcode, for_statement.start_offset);
|
||||
parser_emit_cbc_backward_branch (context_p, (uint16_t) opcode, for_statement.start_offset);
|
||||
parser_set_breaks_to_current_position (context_p, loop.branch_list_p);
|
||||
|
||||
parser_set_range (context_p, &range);
|
||||
@@ -1427,7 +1427,7 @@ parser_parse_break_statement (parser_context_t *context_p) /**< context */
|
||||
if (lexer_compare_identifier_to_current (context_p, &label_statement.label_ident))
|
||||
{
|
||||
label_statement.break_list_p = parser_emit_cbc_forward_branch_item (context_p,
|
||||
opcode,
|
||||
(uint16_t) opcode,
|
||||
label_statement.break_list_p);
|
||||
parser_stack_iterator_write (&iterator, &label_statement, sizeof (parser_label_statement_t));
|
||||
lexer_next_token (context_p);
|
||||
@@ -1470,7 +1470,7 @@ parser_parse_break_statement (parser_context_t *context_p) /**< context */
|
||||
parser_stack_iterator_skip (&iterator, 1);
|
||||
parser_stack_iterator_read (&iterator, &loop, sizeof (parser_loop_statement_t));
|
||||
loop.branch_list_p = parser_emit_cbc_forward_branch_item (context_p,
|
||||
opcode,
|
||||
(uint16_t) opcode,
|
||||
loop.branch_list_p);
|
||||
parser_stack_iterator_write (&iterator, &loop, sizeof (parser_loop_statement_t));
|
||||
return;
|
||||
@@ -1526,7 +1526,7 @@ parser_parse_continue_statement (parser_context_t *context_p) /**< context */
|
||||
parser_stack_iterator_skip (&loop_iterator, 1);
|
||||
parser_stack_iterator_read (&loop_iterator, &loop, sizeof (parser_loop_statement_t));
|
||||
loop.branch_list_p = parser_emit_cbc_forward_branch_item (context_p,
|
||||
opcode,
|
||||
(uint16_t) opcode,
|
||||
loop.branch_list_p);
|
||||
loop.branch_list_p->branch.offset |= CBC_HIGHEST_BIT_MASK;
|
||||
parser_stack_iterator_write (&loop_iterator, &loop, sizeof (parser_loop_statement_t));
|
||||
@@ -1583,7 +1583,7 @@ parser_parse_continue_statement (parser_context_t *context_p) /**< context */
|
||||
parser_stack_iterator_skip (&iterator, 1);
|
||||
parser_stack_iterator_read (&iterator, &loop, sizeof (parser_loop_statement_t));
|
||||
loop.branch_list_p = parser_emit_cbc_forward_branch_item (context_p,
|
||||
opcode,
|
||||
(uint16_t) opcode,
|
||||
loop.branch_list_p);
|
||||
loop.branch_list_p->branch.offset |= CBC_HIGHEST_BIT_MASK;
|
||||
parser_stack_iterator_write (&iterator, &loop, sizeof (parser_loop_statement_t));
|
||||
|
||||
@@ -117,7 +117,7 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
|
||||
|
||||
JERRY_ASSERT (opcode < CBC_EXT_END);
|
||||
flags = cbc_ext_flags[opcode];
|
||||
parser_emit_two_bytes (context_p, CBC_EXT_OPCODE, opcode);
|
||||
parser_emit_two_bytes (context_p, CBC_EXT_OPCODE, (uint8_t) opcode);
|
||||
context_p->byte_code_size += 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -1857,7 +1857,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
|
||||
/* Storing the opcode */
|
||||
*dst_p++ = opcode;
|
||||
*dst_p++ = (uint8_t) opcode;
|
||||
real_offset++;
|
||||
PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);
|
||||
flags = cbc_flags[opcode];
|
||||
@@ -1879,7 +1879,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
branch_offset_length = CBC_BRANCH_OFFSET_LENGTH (ext_opcode);
|
||||
|
||||
/* Storing the extended opcode */
|
||||
*dst_p++ = ext_opcode;
|
||||
*dst_p++ = (uint8_t) ext_opcode;
|
||||
opcode_p++;
|
||||
real_offset++;
|
||||
PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);
|
||||
|
||||
Reference in New Issue
Block a user