Fix code&scripts static checking warnings

Signed-off-by: shawn_hu_ls <huxiaowei3@huawei.com>
This commit is contained in:
shawn_hu_ls
2021-09-27 15:32:51 +08:00
parent e4f2d430ca
commit 10a01e3a2d
8 changed files with 15 additions and 14 deletions
+4 -4
View File
@@ -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
@@ -35,6 +35,8 @@
#include <memory>
#include <vector>
#include <securec.h>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
@@ -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);
-2
View File
@@ -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 = []
+1 -1
View File
@@ -496,7 +496,7 @@ static size_t LayoutFields(Class *klass, PandaList<Field *> *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()) {
+1 -1
View File
@@ -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
+2 -2
View File
@@ -866,7 +866,7 @@ Expected<int, Runtime::Error> 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<PandaString> &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);
+3 -2
View File
@@ -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
+1 -1
View File
@@ -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");