diff --git a/isa/gen_wrapper.sh b/isa/gen_wrapper.sh index ba5c4ebdf94986a20d2a10ff4562a2282c691300..4e470348440359228fcf5ceac1c57c58a1b9f6e7 100644 --- a/isa/gen_wrapper.sh +++ b/isa/gen_wrapper.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ set -e -TOP=`pwd` +TOP=$(pwd) CMD=${TOP}/panda/isa/gen.rb ISA_DATA=${TOP}/panda/isa/isa.yaml ISA_REQUIRE=${TOP}/panda/isa/isapi.rb @@ -30,7 +30,7 @@ if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi while getopts "O:D:R:I" arg do - case $arg in + case "$arg" in O) OUTPUT=${OPTARG} ;; @@ -51,7 +51,7 @@ do done shift $(($OPTIND - 1)) -if [ ${HAS_ISA} ];then +if [ "${HAS_ISA}" ];then DATA=${ISA_DATA} REQUIRE=${ISA_REQUIRE},${REQUIRE} fi diff --git a/libpandafile/tests/file_item_container_test.cpp b/libpandafile/tests/file_item_container_test.cpp index 5f86c7ee998239bf453805495cb026218bab5dd2..4c63f227291a6762525c48cfd1d3cadae6fd0813 100644 --- a/libpandafile/tests/file_item_container_test.cpp +++ b/libpandafile/tests/file_item_container_test.cpp @@ -35,6 +35,8 @@ #include #include +#include + #include #include @@ -142,7 +144,7 @@ TEST(ItemContainer, TestFileFormatVersionValid) auto writer = FileWriter(file_name); File::Header header; - memset(&header, 0, sizeof(header)); + (void)memset_s(&header, sizeof(header), 0, sizeof(header)); header.magic = File::MAGIC; header.version = {0, 0, 0, 2}; header.file_size = sizeof(File::Header); diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index e4d9aee1afb9fd2f460cf32f5d5dd5f47ba3b246..31165dddb99529da0094a56612e9d16f6639b9c9 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -39,7 +39,6 @@ config("arkruntime_config") { cflags_cc = [ "-Wno-invalid-offsetof", "-Wno-unused-parameter", - "-Wno-implicit-fallthrough", ] } @@ -276,7 +275,6 @@ config("arkruntime_interpreter_impl_config") { cflags_cc = [ "-Wno-invalid-offsetof", "-Wno-unused-parameter", - "-Wno-implicit-fallthrough", ] defines = [] diff --git a/runtime/class_linker.cpp b/runtime/class_linker.cpp index 08fc3b2ef445ca23932011351414a44fc4c9a16c..f79fdada4e4b283b0b01d5f3f0f3915818cf44b7 100644 --- a/runtime/class_linker.cpp +++ b/runtime/class_linker.cpp @@ -496,7 +496,7 @@ static size_t LayoutFields(Class *klass, PandaList *tagged_fields, Pand if (is_static) { offset = klass->GetStaticFieldsOffset(); } else { - offset = klass->GetBase() != nullptr ? klass->GetBase()->GetObjectSize() : ObjectHeader::ObjectHeaderSize(); + offset = (klass->GetBase() != nullptr) ? klass->GetBase()->GetObjectSize() : ObjectHeader::ObjectHeaderSize(); } if (!ref_fields->empty()) { diff --git a/runtime/mark_word.h b/runtime/mark_word.h index a2dbf7c57501211677ba74ecc99cf74f4fa62091..557216db9c39e0ab83cce579115f50b6f40c1397 100644 --- a/runtime/mark_word.h +++ b/runtime/mark_word.h @@ -120,7 +120,7 @@ public: // If we don't have Hash inside an object header, thisThread constant shouldn't be used HASH_SIZE = (CONFIG_HASH_STATUS_SIZE != 0UL) ? 0UL - : CONFIG_MARK_WORD_BIT_SIZE - STATUS_SIZE - GC_STATUS_SIZE - RB_STATUS_SIZE, + : (CONFIG_MARK_WORD_BIT_SIZE - STATUS_SIZE - GC_STATUS_SIZE - RB_STATUS_SIZE), FORWARDING_ADDRESS_SIZE = CONFIG_MARK_WORD_BIT_SIZE - STATUS_SIZE - HASH_STATUS_SIZE, // Unlocked state masks and shifts diff --git a/runtime/runtime.cpp b/runtime/runtime.cpp index 893adc8d42d373b4b14ba75f623cc1b8b0b6d47b..e0e1a673a17bd7e610b42ac6a81a6a17a9b3ddfd 100644 --- a/runtime/runtime.cpp +++ b/runtime/runtime.cpp @@ -866,7 +866,7 @@ Expected Runtime::ExecutePandaFile(std::string_view filenam // Create app name from path to executable file. std::string_view app_name = [](std::string_view path) -> std::string_view { auto pos = path.find_last_of('/'); - return path.substr(pos == std::string_view::npos ? 0 : pos + 1); + return path.substr((pos == std::string_view::npos) ? 0 : (pos + 1)); }(filename); StartDProfiler(app_name); } @@ -900,7 +900,7 @@ void Runtime::RegisterAppInfo(const PandaVector &code_paths, const } std::string_view app_name = [](std::string_view path) -> std::string_view { auto pos = path.find_last_of('/'); - return path.substr(pos == std::string_view::npos ? 0 : pos + 1); + return path.substr((pos == std::string_view::npos) ? 0 : (pos + 1)); }(profile_output_filename); StartDProfiler(app_name); diff --git a/scripts/extra/build.sh b/scripts/extra/build.sh index e3b567a10b26dcc2f92b68060f7a43d2f8b7f02b..979541c32d7cf2e5fc186205ea3c739635e02e57 100755 --- a/scripts/extra/build.sh +++ b/scripts/extra/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash -ex +#!/bin/bash # Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +set -ex -if [[ ${BUILD_TOOL} = "ninja" ]]; then +if [[ "${BUILD_TOOL}" = "ninja" ]]; then GENERATOR="Ninja" BUILD_STR="ninja -k1" else diff --git a/scripts/memdump.py b/scripts/memdump.py index 0cea92660c0e4a66c440908c9b9edd9de7f2a880..e8fd40163e6d865accdfcb118da2ef462b5b7b55 100755 --- a/scripts/memdump.py +++ b/scripts/memdump.py @@ -1,4 +1,4 @@ -#!/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License");