aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Sipka <rsipka.uszeged@partner.samsung.com>2017-02-22 10:34:44 +0100
committerGitHub <noreply@github.com>2017-02-22 10:34:44 +0100
commit39dc4a627304c8dcf61b32e994bc7359c90b0261 (patch)
tree56ce429643555167deb8015b59550de04b4bf22e
parent5ef305dfeeac947a91516e626854d9dac090447a (diff)
Remove shadowed declarations, undefined identifiers, and specify argument types where it is required. (#1601)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
-rw-r--r--CMakeLists.txt2
-rw-r--r--jerry-core/ecma/base/ecma-helpers.h2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-date.c8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-json.c18
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c17
-rw-r--r--jerry-core/ecma/operations/ecma-objects.c7
-rw-r--r--jerry-core/ecma/operations/ecma-regexp-object.c2
-rw-r--r--jerry-core/jmem/jmem-heap.c20
-rw-r--r--jerry-core/parser/js/js-parser-util.c4
-rw-r--r--jerry-core/parser/js/js-parser.c20
-rw-r--r--jerry-core/parser/regexp/re-compiler.c4
-rw-r--r--jerry-core/parser/regexp/re-compiler.h2
-rw-r--r--jerry-core/vm/vm.c6
-rw-r--r--jerry-main/main-unix.c9
-rw-r--r--tests/unit/test-date-helpers.c2
-rw-r--r--tests/unit/test-heap.c2
-rw-r--r--tests/unit/test-libm.c2
-rw-r--r--tests/unit/test-lit-char-helpers.c2
-rw-r--r--tests/unit/test-literal-storage.c4
-rw-r--r--tests/unit/test-longjmp.c2
-rw-r--r--tests/unit/test-number-to-integer.c2
-rw-r--r--tests/unit/test-number-to-string.c2
-rw-r--r--tests/unit/test-poolman.c2
-rw-r--r--tests/unit/test-string-to-number.c2
-rw-r--r--tests/unit/test-strings.c2
26 files changed, 75 insertions, 82 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 29fe8e27..a8353740 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -179,7 +179,7 @@ jerry_add_compile_flags(-fno-stack-protector)
endif()
if (USING_GCC OR USING_CLANG)
- jerry_add_compile_warnings(all extra format-nonliteral init-self conversion sign-conversion format-security missing-declarations)
+ jerry_add_compile_warnings(all extra format-nonliteral init-self conversion sign-conversion format-security missing-declarations shadow strict-prototypes undef)
jerry_add_compile_flags(-Wno-stack-protector -Wno-attributes)
endif()
diff --git a/jerry-core/ecma/base/ecma-helpers.h b/jerry-core/ecma/base/ecma-helpers.h
index c332a096..6c7a9d55 100644
--- a/jerry-core/ecma/base/ecma-helpers.h
+++ b/jerry-core/ecma/base/ecma-helpers.h
@@ -170,7 +170,7 @@ ecma_string_t *ecma_new_ecma_string_from_uint32 (uint32_t uint32_number);
ecma_string_t *ecma_new_ecma_string_from_number (ecma_number_t num);
ecma_string_t *ecma_new_ecma_string_from_magic_string_id (lit_magic_string_id_t id);
ecma_string_t *ecma_new_ecma_string_from_magic_string_ex_id (lit_magic_string_ex_id_t id);
-ecma_string_t *ecma_new_ecma_length_string ();
+ecma_string_t *ecma_new_ecma_length_string (void);
ecma_string_t *ecma_concat_ecma_strings (ecma_string_t *string1_p, ecma_string_t *string2_p);
void ecma_ref_ecma_string (ecma_string_t *string_p);
void ecma_deref_ecma_string (ecma_string_t *string_p);
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c
index 9021c1a9..ef10f84b 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c
@@ -783,10 +783,10 @@ ecma_builtin_array_prototype_object_shift (ecma_value_t this_arg) /**< this argu
if (ecma_is_value_empty (ret_value))
{
len--;
- ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (len);
+ ecma_string_t *len_str_p = ecma_new_ecma_string_from_uint32 (len);
/* 8. */
- ECMA_TRY_CATCH (del_value, ecma_op_object_delete (obj_p, index_str_p, true), ret_value);
+ ECMA_TRY_CATCH (del_value, ecma_op_object_delete (obj_p, len_str_p, true), ret_value);
/* 9. */
ECMA_TRY_CATCH (set_length_value,
@@ -797,7 +797,7 @@ ecma_builtin_array_prototype_object_shift (ecma_value_t this_arg) /**< this argu
ECMA_FINALIZE (set_length_value);
ECMA_FINALIZE (del_value);
- ecma_deref_ecma_string (index_str_p);
+ ecma_deref_ecma_string (len_str_p);
}
ECMA_FINALIZE (first_value);
@@ -1426,11 +1426,9 @@ ecma_builtin_array_prototype_object_splice (ecma_value_t this_arg, /**< this arg
}
/* 8-9. */
- uint32_t k;
+ uint32_t k = 0;
- for (uint32_t del_item_idx, k = 0;
- k < delete_count && ecma_is_value_empty (ret_value);
- k++)
+ for (uint32_t del_item_idx; k < delete_count && ecma_is_value_empty (ret_value); k++)
{
/* 9.a */
del_item_idx = k + start;
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date.c b/jerry-core/ecma/builtin-objects/ecma-builtin-date.c
index 0b34fe2f..540d501d 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-date.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date.c
@@ -319,11 +319,11 @@ ecma_builtin_date_parse (ecma_value_t this_arg, /**< this argument */
else if (date_str_curr_p < date_str_end_p
&& (*date_str_curr_p == '+' || *date_str_curr_p == '-'))
{
- ecma_length_t remaining_length;
- remaining_length = lit_utf8_string_length (date_str_curr_p,
- (lit_utf8_size_t) (date_str_end_p - date_str_curr_p)) - 1;
+ ecma_length_t remaining_date_length;
+ remaining_date_length = lit_utf8_string_length (date_str_curr_p,
+ (lit_utf8_size_t) (date_str_end_p - date_str_curr_p)) - 1;
- if (remaining_length == 5)
+ if (remaining_date_length == 5)
{
bool is_negative = false;
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-json.c b/jerry-core/ecma/builtin-objects/ecma-builtin-json.c
index 36617e6e..47748bab 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-json.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-json.c
@@ -934,11 +934,10 @@ ecma_builtin_json_stringify (ecma_value_t this_arg, /**< 'this' argument */
array_length,
ret_value);
- uint32_t array_length = ecma_number_to_uint32 (array_length_num);
uint32_t index = 0;
/* 4.b.ii */
- while ((index < array_length) && ecma_is_value_empty (ret_value))
+ while ((index < ecma_number_to_uint32 (array_length_num)) && ecma_is_value_empty (ret_value))
{
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (index);
@@ -1060,23 +1059,24 @@ ecma_builtin_json_stringify (ecma_value_t this_arg, /**< 'this' argument */
/* 6.a */
int32_t num_of_spaces = ecma_number_to_int32 (array_length_num);
- int32_t space = (num_of_spaces > 10) ? 10 : num_of_spaces;
+ num_of_spaces = (num_of_spaces > 10) ? 10 : num_of_spaces;
/* 6.b */
- if (space < 1)
+ if (num_of_spaces < 1)
{
context.gap_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
}
else
{
- JMEM_DEFINE_LOCAL_ARRAY (space_buff, space, char);
+ JMEM_DEFINE_LOCAL_ARRAY (space_buff, num_of_spaces, char);
- for (int32_t i = 0; i < space; i++)
+ for (int32_t i = 0; i < num_of_spaces; i++)
{
space_buff[i] = LIT_CHAR_SP;
}
- context.gap_str_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) space_buff, (lit_utf8_size_t) space);
+ context.gap_str_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) space_buff,
+ (lit_utf8_size_t) num_of_spaces);
JMEM_FINALIZE_LOCAL_ARRAY (space_buff);
}
@@ -1738,11 +1738,9 @@ ecma_builtin_json_array (ecma_object_t *obj_p, /**< the array object*/
array_length,
ret_value);
- uint32_t array_length = ecma_number_to_uint32 (array_length_num);
-
/* 7. - 8. */
for (uint32_t index = 0;
- index < array_length && ecma_is_value_empty (ret_value);
+ index < ecma_number_to_uint32 (array_length_num) && ecma_is_value_empty (ret_value);
index++)
{
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c
index d58a5bab..1a22be70 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c
@@ -998,7 +998,6 @@ ecma_builtin_string_prototype_object_replace_get_string (ecma_builtin_replace_se
}
ecma_string_t *index_string_p = ecma_new_ecma_string_from_uint32 (index);
- ecma_object_t *match_object_p = ecma_get_object_from_value (match_value);
ECMA_TRY_CATCH (submatch_value,
ecma_op_object_get (match_object_p, index_string_p),
@@ -1863,18 +1862,18 @@ ecma_builtin_string_prototype_object_split (ecma_value_t this_arg, /**< this arg
ecma_string_t *idx_str_p = ecma_new_ecma_string_from_uint32 (i);
ecma_string_t *new_array_idx_str_p = ecma_new_ecma_string_from_uint32 (new_array_length);
- ecma_value_t match_comp_value = ecma_op_object_get (match_array_obj_p, idx_str_p);
+ match_comp_value = ecma_op_object_get (match_array_obj_p, idx_str_p);
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (match_comp_value));
/* 13.c.iii.7.b */
- ecma_value_t put_comp = ecma_builtin_helper_def_prop (new_array_p,
- new_array_idx_str_p,
- match_comp_value,
- true,
- true,
- true,
- false);
+ put_comp = ecma_builtin_helper_def_prop (new_array_p,
+ new_array_idx_str_p,
+ match_comp_value,
+ true,
+ true,
+ true,
+ false);
JERRY_ASSERT (ecma_is_value_true (put_comp));
diff --git a/jerry-core/ecma/operations/ecma-objects.c b/jerry-core/ecma/operations/ecma-objects.c
index 6e0f88bc..0a8e571a 100644
--- a/jerry-core/ecma/operations/ecma-objects.c
+++ b/jerry-core/ecma/operations/ecma-objects.c
@@ -864,9 +864,9 @@ ecma_op_object_put (ecma_object_t *object_p, /**< the object */
if (create_new_property
&& ecma_get_object_extensible (object_p))
{
- const ecma_object_type_t type = ecma_get_object_type (object_p);
+ const ecma_object_type_t obj_type = ecma_get_object_type (object_p);
- if (type == ECMA_OBJECT_TYPE_PSEUDO_ARRAY)
+ if (obj_type == ECMA_OBJECT_TYPE_PSEUDO_ARRAY)
{
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
@@ -884,7 +884,7 @@ ecma_op_object_put (ecma_object_t *object_p, /**< the object */
uint32_t index = ecma_string_get_array_index (property_name_p);
- if (type == ECMA_OBJECT_TYPE_ARRAY
+ if (obj_type == ECMA_OBJECT_TYPE_ARRAY
&& index != ECMA_STRING_NOT_ARRAY_INDEX)
{
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
@@ -1622,7 +1622,6 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
/* name with same hash already occured */
bool is_equal_found = false;
- ecma_collection_iterator_t iter;
ecma_collection_iterator_init (&iter, ret_p);
while (ecma_collection_iterator_next (&iter))
diff --git a/jerry-core/ecma/operations/ecma-regexp-object.c b/jerry-core/ecma/operations/ecma-regexp-object.c
index c495d487..faa514e4 100644
--- a/jerry-core/ecma/operations/ecma-regexp-object.c
+++ b/jerry-core/ecma/operations/ecma-regexp-object.c
@@ -1008,7 +1008,7 @@ re_match_regexp (re_matcher_ctx_t *re_ctx_p, /**< RegExp matcher context */
old_start_p = re_ctx_p->saved_p[start_idx];
re_ctx_p->saved_p[start_idx] = str_curr_p;
- ecma_value_t match_value = re_match_regexp (re_ctx_p, bc_p, str_curr_p, &sub_str_p);
+ match_value = re_match_regexp (re_ctx_p, bc_p, str_curr_p, &sub_str_p);
if (ecma_is_value_true (match_value))
{
diff --git a/jerry-core/jmem/jmem-heap.c b/jerry-core/jmem/jmem-heap.c
index 3527b65c..fd804a73 100644
--- a/jerry-core/jmem/jmem-heap.c
+++ b/jerry-core/jmem/jmem-heap.c
@@ -119,10 +119,10 @@ JERRY_STATIC_ASSERT (sizeof (jmem_heap_t) <= JMEM_HEAP_SIZE,
static void jmem_heap_stat_init (void);
static void jmem_heap_stat_alloc (size_t num);
static void jmem_heap_stat_free (size_t num);
-static void jmem_heap_stat_skip ();
-static void jmem_heap_stat_nonskip ();
-static void jmem_heap_stat_alloc_iter ();
-static void jmem_heap_stat_free_iter ();
+static void jmem_heap_stat_skip (void);
+static void jmem_heap_stat_nonskip (void);
+static void jmem_heap_stat_alloc_iter (void);
+static void jmem_heap_stat_free_iter (void);
# define JMEM_HEAP_STAT_INIT() jmem_heap_stat_init ()
# define JMEM_HEAP_STAT_ALLOC(v1) jmem_heap_stat_alloc (v1)
@@ -465,7 +465,7 @@ jmem_heap_free_block (void *ptr, /**< pointer to beginning of data space of the
/* Find position of region in the list. */
while (prev_p->next_offset < block_offset)
{
- jmem_heap_free_t *const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);
+ next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);
JERRY_ASSERT (jmem_is_heap_pointer (next_p));
VALGRIND_DEFINED_SPACE (next_p, sizeof (jmem_heap_free_t));
@@ -619,7 +619,7 @@ jmem_heap_stats_print (void)
* Initalize heap memory usage statistics account structure
*/
static void
-jmem_heap_stat_init ()
+jmem_heap_stat_init (void)
{
JERRY_CONTEXT (jmem_heap_stats).size = JMEM_HEAP_AREA_SIZE;
} /* jmem_heap_stat_init */
@@ -678,7 +678,7 @@ jmem_heap_stat_free (size_t size) /**< Size of freed block */
* Counts number of skip-aheads during insertion of free block
*/
static void
-jmem_heap_stat_skip ()
+jmem_heap_stat_skip (void)
{
JERRY_CONTEXT (jmem_heap_stats).skip_count++;
} /* jmem_heap_stat_skip */
@@ -687,7 +687,7 @@ jmem_heap_stat_skip ()
* Counts number of times we could not skip ahead during free block insertion
*/
static void
-jmem_heap_stat_nonskip ()
+jmem_heap_stat_nonskip (void)
{
JERRY_CONTEXT (jmem_heap_stats).nonskip_count++;
} /* jmem_heap_stat_nonskip */
@@ -696,7 +696,7 @@ jmem_heap_stat_nonskip ()
* Count number of iterations required for allocations
*/
static void
-jmem_heap_stat_alloc_iter ()
+jmem_heap_stat_alloc_iter (void)
{
JERRY_CONTEXT (jmem_heap_stats).alloc_iter_count++;
} /* jmem_heap_stat_alloc_iter */
@@ -705,7 +705,7 @@ jmem_heap_stat_alloc_iter ()
* Counts number of iterations required for inserting free blocks
*/
static void
-jmem_heap_stat_free_iter ()
+jmem_heap_stat_free_iter (void)
{
JERRY_CONTEXT (jmem_heap_stats).free_iter_count++;
} /* jmem_heap_stat_free_iter */
diff --git a/jerry-core/parser/js/js-parser-util.c b/jerry-core/parser/js/js-parser-util.c
index 10e8e08e..7241c8b3 100644
--- a/jerry-core/parser/js/js-parser-util.c
+++ b/jerry-core/parser/js/js-parser-util.c
@@ -192,7 +192,7 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
{
literal_index = context_p->last_cbc.third_literal_index;
- lexer_literal_t *literal_p = PARSER_GET_LITERAL (literal_index);
+ literal_p = PARSER_GET_LITERAL (literal_index);
JERRY_DEBUG_MSG (" idx:%d->", literal_index);
util_print_literal (literal_p);
}
@@ -640,7 +640,7 @@ parser_set_continues_to_current_position (parser_context_t *context_p, /**< cont
}
} /* parser_set_continues_to_current_position */
-#if JERRY_ENABLE_ERROR_MESSAGES
+#ifdef JERRY_ENABLE_ERROR_MESSAGES
/**
* Returns with the string representation of the error
*/
diff --git a/jerry-core/parser/js/js-parser.c b/jerry-core/parser/js/js-parser.c
index 334939f5..5b111dbf 100644
--- a/jerry-core/parser/js/js-parser.c
+++ b/jerry-core/parser/js/js-parser.c
@@ -1563,16 +1563,16 @@ parser_post_processing (parser_context_t *context_p) /**< context */
{
/* These opcodes are deleted from the stream. */
#if PARSER_MAXIMUM_CODE_SIZE <= 65535
- size_t length = 3;
+ size_t counter = 3;
#else /* PARSER_MAXIMUM_CODE_SIZE > 65535 */
- size_t length = 4;
+ size_t counter = 4;
#endif /* PARSER_MAXIMUM_CODE_SIZE <= 65535 */
do
{
PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);
}
- while (--length > 0);
+ while (--counter > 0);
continue;
}
@@ -1586,8 +1586,8 @@ parser_post_processing (parser_context_t *context_p) /**< context */
#ifdef JERRY_DEBUGGER
if (opcode == CBC_BREAKPOINT_DISABLED)
{
- uint32_t offset = (uint32_t) (((uint8_t *) dst_p) - ((uint8_t *) compiled_code_p) - 1);
- parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST, offset);
+ uint32_t bp_offset = (uint32_t) (((uint8_t *) dst_p) - ((uint8_t *) compiled_code_p) - 1);
+ parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST, bp_offset);
}
#endif /* JERRY_DEBUGGER */
@@ -2087,8 +2087,8 @@ parser_parse_function (parser_context_t *context_p, /**< context */
* function expression name, so there is no need to assign special flags. */
if (context_p->lit_object.type != LEXER_LITERAL_OBJECT_ARGUMENTS)
{
- uint8_t status_flags = LEXER_FLAG_VAR | LEXER_FLAG_INITIALIZED | LEXER_FLAG_FUNCTION_NAME;
- context_p->lit_object.literal_p->status_flags |= status_flags;
+ uint8_t lexer_flags = LEXER_FLAG_VAR | LEXER_FLAG_INITIALIZED | LEXER_FLAG_FUNCTION_NAME;
+ context_p->lit_object.literal_p->status_flags |= lexer_flags;
}
if (context_p->token.literal_is_reserved
@@ -2177,8 +2177,8 @@ parser_parse_function (parser_context_t *context_p, /**< context */
}
else
{
- uint8_t status_flags = LEXER_FLAG_VAR | LEXER_FLAG_INITIALIZED | LEXER_FLAG_FUNCTION_ARGUMENT;
- context_p->lit_object.literal_p->status_flags |= status_flags;
+ uint8_t lexer_flags = LEXER_FLAG_VAR | LEXER_FLAG_INITIALIZED | LEXER_FLAG_FUNCTION_ARGUMENT;
+ context_p->lit_object.literal_p->status_flags |= lexer_flags;
}
context_p->argument_count++;
@@ -2388,7 +2388,7 @@ parser_parse_script (const uint8_t *source_p, /**< source code */
* situation. However, a simple value can still be thrown. */
return ecma_make_error_value (ecma_make_simple_value (ECMA_SIMPLE_VALUE_NULL));
}
-#if JERRY_ENABLE_ERROR_MESSAGES
+#ifdef JERRY_ENABLE_ERROR_MESSAGES
const char *err_str_p = parser_error_to_string (parser_error.error);
uint32_t err_str_size = lit_zt_utf8_string_size ((const lit_utf8_byte_t *) err_str_p);
diff --git a/jerry-core/parser/regexp/re-compiler.c b/jerry-core/parser/regexp/re-compiler.c
index 333215be..780f8e95 100644
--- a/jerry-core/parser/regexp/re-compiler.c
+++ b/jerry-core/parser/regexp/re-compiler.c
@@ -387,7 +387,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
: RE_OP_CHAR_CLASS);
uint32_t offset = re_get_bytecode_length (re_ctx_p->bytecode_ctx_p);
- ECMA_TRY_CATCH (empty,
+ ECMA_TRY_CATCH (empty_value,
re_parse_char_class (re_ctx_p->parser_ctx_p,
re_append_char_class,
re_ctx_p,
@@ -400,7 +400,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
re_insert_simple_iterator (re_ctx_p, new_atom_start_offset);
}
- ECMA_FINALIZE (empty);
+ ECMA_FINALIZE (empty_value);
break;
}
diff --git a/jerry-core/parser/regexp/re-compiler.h b/jerry-core/parser/regexp/re-compiler.h
index 3b916275..3933597a 100644
--- a/jerry-core/parser/regexp/re-compiler.h
+++ b/jerry-core/parser/regexp/re-compiler.h
@@ -49,7 +49,7 @@ typedef struct
ecma_value_t
re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, ecma_string_t *pattern_str_p, uint16_t flags);
-void re_cache_gc_run ();
+void re_cache_gc_run (void);
/**
* @}
diff --git a/jerry-core/vm/vm.c b/jerry-core/vm/vm.c
index 22468d08..f9e3850a 100644
--- a/jerry-core/vm/vm.c
+++ b/jerry-core/vm/vm.c
@@ -753,9 +753,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
{
case VM_OC_GET_LITERAL_LITERAL:
{
- uint16_t literal_index;
- READ_LITERAL_INDEX (literal_index);
- READ_LITERAL (literal_index, right_value);
+ uint16_t second_literal_index;
+ READ_LITERAL_INDEX (second_literal_index);
+ READ_LITERAL (second_literal_index, right_value);
break;
}
case VM_OC_GET_STACK_LITERAL:
diff --git a/jerry-main/main-unix.c b/jerry-main/main-unix.c
index a893342e..b9998eb0 100644
--- a/jerry-main/main-unix.c
+++ b/jerry-main/main-unix.c
@@ -344,7 +344,6 @@ main (int argc,
}
const char *file_names[JERRY_MAX_COMMAND_LINE_ARGS];
- int i;
int files_counter = 0;
jerry_init_flag_t flags = JERRY_INIT_EMPTY;
@@ -364,7 +363,7 @@ main (int argc,
bool is_repl_mode = false;
bool no_prompt = false;
- for (i = 1; i < argc; i++)
+ for (int i = 1; i < argc; i++)
{
if (!strcmp ("-h", argv[i]) || !strcmp ("--help", argv[i]))
{
@@ -744,9 +743,9 @@ main (int argc,
const char *prompt = !no_prompt ? "jerry> " : "";
bool is_done = false;
- jerry_value_t global_obj_val = jerry_get_global_object ();
+ jerry_value_t global_object_val = jerry_get_global_object ();
jerry_value_t print_func_name_val = jerry_create_string ((jerry_char_t *) "print");
- jerry_value_t print_function = jerry_get_property (global_obj_val, print_func_name_val);
+ jerry_value_t print_function = jerry_get_property (global_object_val, print_func_name_val);
jerry_release_value (print_func_name_val);
@@ -808,7 +807,7 @@ main (int argc,
}
}
- jerry_release_value (global_obj_val);
+ jerry_release_value (global_object_val);
jerry_release_value (print_function);
}
diff --git a/tests/unit/test-date-helpers.c b/tests/unit/test-date-helpers.c
index 1b7f576f..426dabd7 100644
--- a/tests/unit/test-date-helpers.c
+++ b/tests/unit/test-date-helpers.c
@@ -31,7 +31,7 @@
* Unit test's main function.
*/
int
-main ()
+main (void)
{
/* int ecma_date_day (time)*/
diff --git a/tests/unit/test-heap.c b/tests/unit/test-heap.c
index 7d3b598b..6197def8 100644
--- a/tests/unit/test-heap.c
+++ b/tests/unit/test-heap.c
@@ -75,7 +75,7 @@ test_heap_give_some_memory_back (jmem_free_unused_memory_severity_t severity)
} /* test_heap_give_some_memory_back */
int
-main ()
+main (void)
{
TEST_INIT ();
diff --git a/tests/unit/test-libm.c b/tests/unit/test-libm.c
index 6a167a63..bcd54030 100644
--- a/tests/unit/test-libm.c
+++ b/tests/unit/test-libm.c
@@ -84,7 +84,7 @@ check_double (const char *expr, double computed, double expected)
} /* check_double */
int
-main ()
+main (void)
{
#define INF INFINITY
#include "test-libm.inc.h"
diff --git a/tests/unit/test-lit-char-helpers.c b/tests/unit/test-lit-char-helpers.c
index 9e10803e..c203e5c3 100644
--- a/tests/unit/test-lit-char-helpers.c
+++ b/tests/unit/test-lit-char-helpers.c
@@ -22,7 +22,7 @@
#include "test-common.h"
int
-main ()
+main (void)
{
TEST_INIT ();
diff --git a/tests/unit/test-literal-storage.c b/tests/unit/test-literal-storage.c
index 0f1c0b16..ceae4a76 100644
--- a/tests/unit/test-literal-storage.c
+++ b/tests/unit/test-literal-storage.c
@@ -38,7 +38,7 @@ generate_string (lit_utf8_byte_t *str, lit_utf8_size_t len)
} /* generate_string */
static ecma_number_t
-generate_number ()
+generate_number (void)
{
ecma_number_t num = ((ecma_number_t) rand () / 32767.0);
if (rand () % 2)
@@ -54,7 +54,7 @@ generate_number ()
} /* generate_number */
int
-main ()
+main (void)
{
TEST_INIT ();
diff --git a/tests/unit/test-longjmp.c b/tests/unit/test-longjmp.c
index fb9f0e89..8ac0fbf4 100644
--- a/tests/unit/test-longjmp.c
+++ b/tests/unit/test-longjmp.c
@@ -68,7 +68,7 @@ test_setjmp_longjmp (volatile int depth)
} /* test_setjmp_longjmp */
int
-main ()
+main (void)
{
TEST_INIT ();
diff --git a/tests/unit/test-number-to-integer.c b/tests/unit/test-number-to-integer.c
index 8467163b..0fe66649 100644
--- a/tests/unit/test-number-to-integer.c
+++ b/tests/unit/test-number-to-integer.c
@@ -34,7 +34,7 @@ typedef struct
* Unit test's main function.
*/
int
-main ()
+main (void)
{
TEST_INIT ();
diff --git a/tests/unit/test-number-to-string.c b/tests/unit/test-number-to-string.c
index 3e3cc555..20c9203c 100644
--- a/tests/unit/test-number-to-string.c
+++ b/tests/unit/test-number-to-string.c
@@ -22,7 +22,7 @@
* Unit test's main function.
*/
int
-main ()
+main (void)
{
TEST_INIT ();
diff --git a/tests/unit/test-poolman.c b/tests/unit/test-poolman.c
index 7435e108..cff56477 100644
--- a/tests/unit/test-poolman.c
+++ b/tests/unit/test-poolman.c
@@ -39,7 +39,7 @@ uint8_t *ptrs[TEST_MAX_SUB_ITERS];
uint8_t data[TEST_MAX_SUB_ITERS][TEST_CHUNK_SIZE];
int
-main ()
+main (void)
{
TEST_INIT ();
diff --git a/tests/unit/test-string-to-number.c b/tests/unit/test-string-to-number.c
index d39bb47c..a9115570 100644
--- a/tests/unit/test-string-to-number.c
+++ b/tests/unit/test-string-to-number.c
@@ -23,7 +23,7 @@
* Unit test's main function.
*/
int
-main ()
+main (void)
{
TEST_INIT ();
diff --git a/tests/unit/test-strings.c b/tests/unit/test-strings.c
index 5cad4da5..31218bde 100644
--- a/tests/unit/test-strings.c
+++ b/tests/unit/test-strings.c
@@ -100,7 +100,7 @@ generate_cesu8_string (lit_utf8_byte_t *buf_p,
} /* generate_cesu8_string */
int
-main ()
+main (void)
{
TEST_INIT ();