From ef4cb2bf7444f4b859fa61cfeb8dab9d749868ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Tokodi?= Date: Wed, 22 Nov 2023 11:36:45 +0100 Subject: [PATCH] Update cppcheck (#5108) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Re-enable cppcheck CI job Update cppcheck suppression list: The new version of cppcheck raises warnings for many potential issues that are guarded against, so those warnings have been supressed. Handle realloc failures: - jerry-ext/util/sources.c - jerry-port/common/jerry-port-io.c Refactor test-snapshot: move each test to separate functions like some others already were. Rename `handler` variables inside `main` of `test-api.c` as they shadowed the `handler` function in the same file. JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu --- .github/workflows/gh-actions.yml | 8 +- jerry-core/ecma/base/ecma-helpers-errol.c | 16 +- jerry-ext/handle-scope/handle-scope.c | 3 - jerry-ext/util/sources.c | 4 + jerry-port/common/jerry-port-io.c | 4 + tests/unit-core/test-api.c | 12 +- tests/unit-core/test-snapshot.c | 382 +++++++++++----------- tests/unit-core/test-to-integer.c | 6 +- tools/cppcheck/suppressions-list | 47 ++- 9 files changed, 270 insertions(+), 212 deletions(-) diff --git a/.github/workflows/gh-actions.yml b/.github/workflows/gh-actions.yml index 85a8d32a06..3977a5f95a 100644 --- a/.github/workflows/gh-actions.yml +++ b/.github/workflows/gh-actions.yml @@ -17,8 +17,8 @@ jobs: python-version: '3.10' - run: sudo apt update # TODO: update checkers to current versions available in ubuntu 22.04 -# - run: sudo apt install clang-format-10 cppcheck python-serial - - run: sudo apt install pylint doxygen +# - run: sudo apt install clang-format-10 python-serial + - run: sudo apt install pylint doxygen cppcheck - run: $RUNNER --check-signed-off=gh-actions if: ${{ always() }} - run: $RUNNER --check-doxygen @@ -31,8 +31,8 @@ jobs: # if: ${{ always() }} - run: $RUNNER --check-pylint if: ${{ always() }} -# - run: $RUNNER --check-cppcheck -# if: ${{ always() }} + - run: $RUNNER --check-cppcheck + if: ${{ always() }} Linux_x86-64_Build_Correctness_Debugger_Tests: runs-on: ubuntu-latest diff --git a/jerry-core/ecma/base/ecma-helpers-errol.c b/jerry-core/ecma/base/ecma-helpers-errol.c index 62190f8ac7..df5f635876 100644 --- a/jerry-core/ecma/base/ecma-helpers-errol.c +++ b/jerry-core/ecma/base/ecma-helpers-errol.c @@ -143,7 +143,7 @@ ecma_errol0_dtoa (double val, /**< ecma number */ int32_t *exp_p) /**< [out] exponent */ { double power_of_10 = 1.0; - int32_t exp = 1; + int32_t exponent = 1; /* normalize the midpoint */ ecma_high_prec_t mid; @@ -151,16 +151,16 @@ ecma_errol0_dtoa (double val, /**< ecma number */ mid.value = val; mid.offset = 0.0; - while (((mid.value > 10.0) || ((mid.value == 10.0) && (mid.offset >= 0.0))) && (exp < 308)) + while (((mid.value > 10.0) || ((mid.value == 10.0) && (mid.offset >= 0.0))) && (exponent < 308)) { - exp++; + exponent++; ecma_divide_high_prec_by_10 (&mid); power_of_10 /= 10.0; } - while (((mid.value < 1.0) || ((mid.value == 1.0) && (mid.offset < 0.0))) && (exp > -307)) + while (((mid.value < 1.0) || ((mid.value == 1.0) && (mid.offset < 0.0))) && (exponent > -307)) { - exp--; + exponent--; ecma_multiply_high_prec_by_10 (&mid); power_of_10 *= 10.0; } @@ -185,14 +185,14 @@ ecma_errol0_dtoa (double val, /**< ecma number */ while (high_bound.value > 10.0 || (high_bound.value == 10.0 && (high_bound.offset >= 0.0))) { - exp++; + exponent++; ecma_divide_high_prec_by_10 (&high_bound); ecma_divide_high_prec_by_10 (&low_bound); } while (high_bound.value < 1.0 || (high_bound.value == 1.0 && (high_bound.offset < 0.0))) { - exp--; + exponent--; ecma_multiply_high_prec_by_10 (&high_bound); ecma_multiply_high_prec_by_10 (&low_bound); } @@ -234,7 +234,7 @@ ecma_errol0_dtoa (double val, /**< ecma number */ double mdig = (high_bound.value + low_bound.value) / 2.0 + 0.5; *dst_p++ = (lit_utf8_byte_t) ('0' + (uint8_t) mdig); - *exp_p = exp; + *exp_p = exponent; return (lit_utf8_size_t) (dst_p - buffer_p); } /* ecma_errol0_dtoa */ diff --git a/jerry-ext/handle-scope/handle-scope.c b/jerry-ext/handle-scope/handle-scope.c index 517ceb8c6e..bbf212265b 100644 --- a/jerry-ext/handle-scope/handle-scope.c +++ b/jerry-ext/handle-scope/handle-scope.c @@ -254,10 +254,7 @@ jerryx_escape_handle_internal (jerryx_escapable_handle_scope scope, * Escape handle to parent scope */ *result = jerryx_handle_scope_add_handle_to (found_handle, parent); - } - if (should_promote) - { scope->escaped = true; } return jerryx_handle_scope_ok; diff --git a/jerry-ext/util/sources.c b/jerry-ext/util/sources.c index 30cbe56d1b..dbd629ee7a 100644 --- a/jerry-ext/util/sources.c +++ b/jerry-ext/util/sources.c @@ -146,6 +146,10 @@ jerryx_source_exec_stdin (void) jerry_size_t new_size = source_size + line_size; source_p = realloc (source_p, new_size); + if (source_p == NULL) + { + return jerry_throw_sz (JERRY_ERROR_COMMON, "Out of memory."); + } memcpy (source_p + source_size, line_p, line_size); jerry_port_line_free (line_p); diff --git a/jerry-port/common/jerry-port-io.c b/jerry-port/common/jerry-port-io.c index 593d744742..761c5a79e5 100644 --- a/jerry-port/common/jerry-port-io.c +++ b/jerry-port/common/jerry-port-io.c @@ -71,6 +71,10 @@ jerry_port_line_read (jerry_size_t *out_size_p) { allocated += 64; line_p = realloc (line_p, allocated); + if (line_p == NULL) + { + jerry_port_fatal (JERRY_FATAL_OUT_OF_MEMORY); + } while (bytes < allocated - 1) { diff --git a/tests/unit-core/test-api.c b/tests/unit-core/test-api.c index a433a8a9ff..6bdc0c4a66 100644 --- a/tests/unit-core/test-api.c +++ b/tests/unit-core/test-api.c @@ -709,12 +709,12 @@ main (void) if (jerry_feature_enabled (JERRY_FEATURE_PROXY)) { jerry_value_t target = jerry_object (); - jerry_value_t handler = jerry_object (); - jerry_value_t proxy = jerry_proxy (target, handler); + jerry_value_t proxy_handler = jerry_object (); + jerry_value_t proxy = jerry_proxy (target, proxy_handler); jerry_value_t obj_proto = jerry_eval ((jerry_char_t *) "Object.prototype", 16, JERRY_PARSE_NO_OPTS); jerry_value_free (target); - jerry_value_free (handler); + jerry_value_free (proxy_handler); proto_val = jerry_object_proto (proxy); TEST_ASSERT (!jerry_value_is_exception (proto_val)); TEST_ASSERT (proto_val == obj_proto); @@ -745,8 +745,8 @@ main (void) if (jerry_feature_enabled (JERRY_FEATURE_PROXY)) { jerry_value_t target = jerry_object (); - jerry_value_t handler = jerry_object (); - jerry_value_t proxy = jerry_proxy (target, handler); + jerry_value_t proxy_handler = jerry_object (); + jerry_value_t proxy = jerry_proxy (target, proxy_handler); new_proto = jerry_eval ((jerry_char_t *) "Function.prototype", 18, JERRY_PARSE_NO_OPTS); res = jerry_object_set_proto (proxy, new_proto); @@ -755,7 +755,7 @@ main (void) TEST_ASSERT (target_proto == new_proto); jerry_value_free (target); - jerry_value_free (handler); + jerry_value_free (proxy_handler); jerry_value_free (proxy); jerry_value_free (new_proto); jerry_value_free (target_proto); diff --git a/tests/unit-core/test-snapshot.c b/tests/unit-core/test-snapshot.c index e4451a7a81..4de459c1a5 100644 --- a/tests/unit-core/test-snapshot.c +++ b/tests/unit-core/test-snapshot.c @@ -41,121 +41,6 @@ static const jerry_char_t *magic_strings[] = { (const jerry_char_t *) " ", */ static const jerry_length_t magic_string_lengths[] = { 1, 1, 1, 1, 4, 4, 6, 8 }; -static void -test_function_snapshot (void) -{ - /* function to snapshot */ - if (!jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) || !jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC)) - { - return; - } - - const jerry_init_flag_t flags = JERRY_INIT_EMPTY; - static uint32_t function_snapshot_buffer[SNAPSHOT_BUFFER_SIZE]; - - const jerry_char_t code_to_snapshot[] = "return a + b"; - - jerry_init (flags); - - jerry_parse_options_t parse_options; - parse_options.options = JERRY_PARSE_HAS_ARGUMENT_LIST; - parse_options.argument_list = jerry_string_sz ("a, b"); - - jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, &parse_options); - TEST_ASSERT (!jerry_value_is_exception (parse_result)); - - jerry_value_t generate_result = - jerry_generate_snapshot (parse_result, 0, function_snapshot_buffer, SNAPSHOT_BUFFER_SIZE); - jerry_value_free (parse_result); - jerry_value_free (parse_options.argument_list); - - TEST_ASSERT (!jerry_value_is_exception (generate_result) && jerry_value_is_number (generate_result)); - - size_t function_snapshot_size = (size_t) jerry_value_as_number (generate_result); - jerry_value_free (generate_result); - - jerry_cleanup (); - - jerry_init (flags); - - jerry_value_t function_obj = jerry_exec_snapshot (function_snapshot_buffer, - function_snapshot_size, - 0, - JERRY_SNAPSHOT_EXEC_LOAD_AS_FUNCTION, - NULL); - - TEST_ASSERT (!jerry_value_is_exception (function_obj)); - TEST_ASSERT (jerry_value_is_function (function_obj)); - - jerry_value_t this_val = jerry_undefined (); - jerry_value_t args[2]; - args[0] = jerry_number (1.0); - args[1] = jerry_number (2.0); - - jerry_value_t res = jerry_call (function_obj, this_val, args, 2); - - TEST_ASSERT (!jerry_value_is_exception (res)); - TEST_ASSERT (jerry_value_is_number (res)); - double num = jerry_value_as_number (res); - TEST_ASSERT (num == 3); - - jerry_value_free (args[0]); - jerry_value_free (args[1]); - jerry_value_free (res); - jerry_value_free (function_obj); - - jerry_cleanup (); -} /* test_function_snapshot */ - -static void -arguments_test_exec_snapshot (uint32_t *snapshot_p, size_t snapshot_size, uint32_t exec_snapshot_flags) -{ - jerry_init (JERRY_INIT_EMPTY); - jerry_value_t res = jerry_exec_snapshot (snapshot_p, snapshot_size, 0, exec_snapshot_flags, NULL); - TEST_ASSERT (!jerry_value_is_exception (res)); - TEST_ASSERT (jerry_value_is_number (res)); - double raw_value = jerry_value_as_number (res); - TEST_ASSERT (raw_value == 15); - jerry_value_free (res); - - jerry_cleanup (); -} /* arguments_test_exec_snapshot */ - -static void -test_function_arguments_snapshot (void) -{ - if (jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC)) - { - static uint32_t arguments_snapshot_buffer[SNAPSHOT_BUFFER_SIZE]; - - const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL ("function f(a,b,c) {" - " arguments[0]++;" - " arguments[1]++;" - " arguments[2]++;" - " return a + b + c;" - "}" - "f(3,4,5);"); - jerry_init (JERRY_INIT_EMPTY); - - jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, NULL); - TEST_ASSERT (!jerry_value_is_exception (parse_result)); - - jerry_value_t generate_result = - jerry_generate_snapshot (parse_result, 0, arguments_snapshot_buffer, SNAPSHOT_BUFFER_SIZE); - jerry_value_free (parse_result); - - TEST_ASSERT (!jerry_value_is_exception (generate_result) && jerry_value_is_number (generate_result)); - - size_t snapshot_size = (size_t) jerry_value_as_number (generate_result); - jerry_value_free (generate_result); - - jerry_cleanup (); - - arguments_test_exec_snapshot (arguments_snapshot_buffer, snapshot_size, 0); - arguments_test_exec_snapshot (arguments_snapshot_buffer, snapshot_size, JERRY_SNAPSHOT_EXEC_COPY_DATA); - } -} /* test_function_arguments_snapshot */ - static void test_exec_snapshot (uint32_t *snapshot_p, size_t snapshot_size, uint32_t exec_snapshot_flags) { @@ -182,74 +67,8 @@ test_exec_snapshot (uint32_t *snapshot_p, size_t snapshot_size, uint32_t exec_sn } /* test_exec_snapshot */ static void -test_snapshot_with_user (void) -{ - if (jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC)) - { - static uint32_t snapshot_buffer[SNAPSHOT_BUFFER_SIZE]; - - const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL ("function f() {}\n" - "f"); - jerry_init (JERRY_INIT_EMPTY); - - jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, NULL); - TEST_ASSERT (!jerry_value_is_exception (parse_result)); - - jerry_value_t generate_result = jerry_generate_snapshot (parse_result, 0, snapshot_buffer, SNAPSHOT_BUFFER_SIZE); - jerry_value_free (parse_result); - - TEST_ASSERT (!jerry_value_is_exception (generate_result) && jerry_value_is_number (generate_result)); - - size_t snapshot_size = (size_t) jerry_value_as_number (generate_result); - jerry_value_free (generate_result); - - for (int i = 0; i < 3; i++) - { - jerry_exec_snapshot_option_values_t snapshot_exec_options; - - if (i == 0) - { - snapshot_exec_options.user_value = jerry_object (); - } - else if (i == 1) - { - snapshot_exec_options.user_value = jerry_number (-3.5); - } - else - { - snapshot_exec_options.user_value = jerry_string_sz ("AnyString..."); - } - - jerry_value_t result = jerry_exec_snapshot (snapshot_buffer, - snapshot_size, - 0, - JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE, - &snapshot_exec_options); - - TEST_ASSERT (!jerry_value_is_exception (result) && jerry_value_is_function (result)); - - jerry_value_t user_value = jerry_source_user_value (result); - jerry_value_free (result); - - result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, user_value, snapshot_exec_options.user_value); - - TEST_ASSERT (jerry_value_is_true (result)); - - jerry_value_free (result); - jerry_value_free (user_value); - jerry_value_free (snapshot_exec_options.user_value); - } - - jerry_cleanup (); - } -} /* test_snapshot_with_user */ - -int -main (void) +test_static_snapshot (void) { - TEST_INIT (); - - /* Static snapshot */ if (jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC)) { static uint32_t snapshot_buffer[SNAPSHOT_BUFFER_SIZE]; @@ -285,8 +104,11 @@ main (void) test_exec_snapshot (snapshot_buffer, snapshot_size, JERRY_SNAPSHOT_EXEC_ALLOW_STATIC); } +} /* test_static_snapshot */ - /* Merge snapshot */ +static void +test_merge_snapshot (void) +{ if (jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC)) { static uint32_t snapshot_buffer_0[SNAPSHOT_BUFFER_SIZE]; @@ -368,8 +190,11 @@ main (void) jerry_cleanup (); } +} /* test_merge_snapshot */ - /* Save literals */ +static void +test_save_literals (void) +{ if (jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE)) { /* C format generation */ @@ -432,6 +257,195 @@ main (void) jerry_cleanup (); } +} /* test_save_literals */ + +static void +test_function_snapshot (void) +{ + if (!jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) || !jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC)) + { + return; + } + + const jerry_init_flag_t flags = JERRY_INIT_EMPTY; + static uint32_t function_snapshot_buffer[SNAPSHOT_BUFFER_SIZE]; + + const jerry_char_t code_to_snapshot[] = "return a + b"; + + jerry_init (flags); + + jerry_parse_options_t parse_options; + parse_options.options = JERRY_PARSE_HAS_ARGUMENT_LIST; + parse_options.argument_list = jerry_string_sz ("a, b"); + + jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, &parse_options); + TEST_ASSERT (!jerry_value_is_exception (parse_result)); + + jerry_value_t generate_result = + jerry_generate_snapshot (parse_result, 0, function_snapshot_buffer, SNAPSHOT_BUFFER_SIZE); + jerry_value_free (parse_result); + jerry_value_free (parse_options.argument_list); + + TEST_ASSERT (!jerry_value_is_exception (generate_result) && jerry_value_is_number (generate_result)); + + size_t function_snapshot_size = (size_t) jerry_value_as_number (generate_result); + jerry_value_free (generate_result); + + jerry_cleanup (); + + jerry_init (flags); + + jerry_value_t function_obj = jerry_exec_snapshot (function_snapshot_buffer, + function_snapshot_size, + 0, + JERRY_SNAPSHOT_EXEC_LOAD_AS_FUNCTION, + NULL); + + TEST_ASSERT (!jerry_value_is_exception (function_obj)); + TEST_ASSERT (jerry_value_is_function (function_obj)); + + jerry_value_t this_val = jerry_undefined (); + jerry_value_t args[2]; + args[0] = jerry_number (1.0); + args[1] = jerry_number (2.0); + + jerry_value_t res = jerry_call (function_obj, this_val, args, 2); + + TEST_ASSERT (!jerry_value_is_exception (res)); + TEST_ASSERT (jerry_value_is_number (res)); + double num = jerry_value_as_number (res); + TEST_ASSERT (num == 3); + + jerry_value_free (args[0]); + jerry_value_free (args[1]); + jerry_value_free (res); + jerry_value_free (function_obj); + + jerry_cleanup (); +} /* test_function_snapshot */ + +static void +arguments_test_exec_snapshot (uint32_t *snapshot_p, size_t snapshot_size, uint32_t exec_snapshot_flags) +{ + jerry_init (JERRY_INIT_EMPTY); + jerry_value_t res = jerry_exec_snapshot (snapshot_p, snapshot_size, 0, exec_snapshot_flags, NULL); + TEST_ASSERT (!jerry_value_is_exception (res)); + TEST_ASSERT (jerry_value_is_number (res)); + double raw_value = jerry_value_as_number (res); + TEST_ASSERT (raw_value == 15); + jerry_value_free (res); + + jerry_cleanup (); +} /* arguments_test_exec_snapshot */ + +static void +test_function_arguments_snapshot (void) +{ + if (jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC)) + { + static uint32_t arguments_snapshot_buffer[SNAPSHOT_BUFFER_SIZE]; + + const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL ("function f(a,b,c) {" + " arguments[0]++;" + " arguments[1]++;" + " arguments[2]++;" + " return a + b + c;" + "}" + "f(3,4,5);"); + jerry_init (JERRY_INIT_EMPTY); + + jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, NULL); + TEST_ASSERT (!jerry_value_is_exception (parse_result)); + + jerry_value_t generate_result = + jerry_generate_snapshot (parse_result, 0, arguments_snapshot_buffer, SNAPSHOT_BUFFER_SIZE); + jerry_value_free (parse_result); + + TEST_ASSERT (!jerry_value_is_exception (generate_result) && jerry_value_is_number (generate_result)); + + size_t snapshot_size = (size_t) jerry_value_as_number (generate_result); + jerry_value_free (generate_result); + + jerry_cleanup (); + + arguments_test_exec_snapshot (arguments_snapshot_buffer, snapshot_size, 0); + arguments_test_exec_snapshot (arguments_snapshot_buffer, snapshot_size, JERRY_SNAPSHOT_EXEC_COPY_DATA); + } +} /* test_function_arguments_snapshot */ + +static void +test_snapshot_with_user (void) +{ + if (jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC)) + { + static uint32_t snapshot_buffer[SNAPSHOT_BUFFER_SIZE]; + + const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL ("function f() {}\n" + "f"); + jerry_init (JERRY_INIT_EMPTY); + + jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, NULL); + TEST_ASSERT (!jerry_value_is_exception (parse_result)); + + jerry_value_t generate_result = jerry_generate_snapshot (parse_result, 0, snapshot_buffer, SNAPSHOT_BUFFER_SIZE); + jerry_value_free (parse_result); + + TEST_ASSERT (!jerry_value_is_exception (generate_result) && jerry_value_is_number (generate_result)); + + size_t snapshot_size = (size_t) jerry_value_as_number (generate_result); + jerry_value_free (generate_result); + + for (int i = 0; i < 3; i++) + { + jerry_exec_snapshot_option_values_t snapshot_exec_options; + + if (i == 0) + { + snapshot_exec_options.user_value = jerry_object (); + } + else if (i == 1) + { + snapshot_exec_options.user_value = jerry_number (-3.5); + } + else + { + snapshot_exec_options.user_value = jerry_string_sz ("AnyString..."); + } + + jerry_value_t result = jerry_exec_snapshot (snapshot_buffer, + snapshot_size, + 0, + JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE, + &snapshot_exec_options); + + TEST_ASSERT (!jerry_value_is_exception (result) && jerry_value_is_function (result)); + + jerry_value_t user_value = jerry_source_user_value (result); + jerry_value_free (result); + + result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, user_value, snapshot_exec_options.user_value); + + TEST_ASSERT (jerry_value_is_true (result)); + + jerry_value_free (result); + jerry_value_free (user_value); + jerry_value_free (snapshot_exec_options.user_value); + } + + jerry_cleanup (); + } +} /* test_snapshot_with_user */ + +int +main (void) +{ + TEST_INIT (); + + test_static_snapshot (); + + test_merge_snapshot (); + + test_save_literals (); test_function_snapshot (); diff --git a/tests/unit-core/test-to-integer.c b/tests/unit-core/test-to-integer.c index 4e7c3f586d..1cbdb32ac6 100644 --- a/tests/unit-core/test-to-integer.c +++ b/tests/unit-core/test-to-integer.c @@ -110,11 +110,11 @@ main (void) TEST_ASSERT (num == ecma_number_make_infinity (false)); /* 5 */ - ecma_value_t floor = ecma_make_number_value (3.001f); + ecma_value_t floor_val = ecma_make_number_value (3.001f); - result = ecma_op_to_integer (floor, &num); + result = ecma_op_to_integer (floor_val, &num); - ecma_free_value (floor); + ecma_free_value (floor_val); TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result)); TEST_ASSERT (num == 3); diff --git a/tools/cppcheck/suppressions-list b/tools/cppcheck/suppressions-list index 2d7bcca466..0431fb3805 100644 --- a/tools/cppcheck/suppressions-list +++ b/tools/cppcheck/suppressions-list @@ -1,5 +1,44 @@ -wrongmathcall:tests/unit-math/test-math.inc.h -variableScope:jerry-math/*.c -invalidPointerCast:jerry-math/*.c - ConfigurationNotChecked:jerry-core/*.inc.h +arrayIndexOutOfBoundsCond:jerry-core/*.c +autoVariables:jerry-core/*.c +constParameter:jerry-core/*.c +constParameter:jerry-ext/*.c +constParameter:jerry-math/*.c +constParameter:tests/unit-core/*.c +duplicateValueTernary:jerry-core/*.c +incorrectStringBooleanError:tests/unit-core/test-newtarget.c +integerOverflowCond:jerry-math/*.c +invalidFunctionArg:tests/unit-math/test-math.inc.h +invalidPointerCast:jerry-math/*.c +knownConditionTrueFalse:jerry-core/*.c +knownConditionTrueFalse:jerry-math/*.c +negativeIndex:jerry-core/*.c +nullPointerArithmetic:jerry-core/parser/js/js-parser-line-info-create.c:572 +nullPointerArithmetic:jerry-core/parser/js/js-scanner-util.c:2345 +nullPointerArithmeticRedundantCheck:jerry-core/*.c +nullPointerRedundantCheck:jerry-core/*.c +nullPointerRedundantCheck:jerry-ext/*.c +nullPointerRedundantCheck:jerry-main/*.c +nullPointerRedundantCheck:tests/unit-core/*.c +oppositeInnerCondition:jerry-core/*.c +redundantAssignment:jerry-core/*.c +redundantAssignment:tests/unit-core/test-container-operation.c:129 +redundantInitialization:jerry-core/*.c +redundantInitialization:tests/unit-core/test-from-property-descriptor.c:42 +shiftNegative:jerry-core/*.c +shiftNegative:jerry-math/*.c +shiftNegativeLHS:jerry-math/*.c +shiftTooManyBits:jerry-core/*.c +shiftTooManyBitsSigned:jerry-math/*.c +signConversionCond:jerry-core/*.c +uninitvar:jerry-core/parser/js/js-parser-expr.c:3420 +uninitvar:tests/unit-core/test-api-objecttype.c:119 +unmatchedSuppression:jerry-core/*.inc.h +unreadVariable:jerry-core/*.c +unreadVariable:jerry-port/*.c +unusedStructMember:jerry-ext/arg/arg-transform-functions.c +unusedStructMember:jerry-main/*.c +unusedStructMember:tests/unit-core/*.c +variableScope:jerry-math/*.c +wrongmathcall:tests/unit-math/test-math.inc.h +zerodivcond:jerry-core/*.c