!24 Fix code static&scripts checking warnings

Merge pull request !24 from 胡晓炜/master
This commit is contained in:
openharmony_ci 2021-09-27 13:28:16 +00:00 committed by Gitee
commit dbe2904b2f
8 changed files with 15 additions and 14 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
set -e set -e
TOP=`pwd` TOP=$(pwd)
CMD=${TOP}/panda/isa/gen.rb CMD=${TOP}/panda/isa/gen.rb
ISA_DATA=${TOP}/panda/isa/isa.yaml ISA_DATA=${TOP}/panda/isa/isa.yaml
ISA_REQUIRE=${TOP}/panda/isa/isapi.rb 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 while getopts "O:D:R:I" arg
do do
case $arg in case "$arg" in
O) O)
OUTPUT=${OPTARG} OUTPUT=${OPTARG}
;; ;;
@ -51,7 +51,7 @@ do
done done
shift $(($OPTIND - 1)) shift $(($OPTIND - 1))
if [ ${HAS_ISA} ];then if [ "${HAS_ISA}" ];then
DATA=${ISA_DATA} DATA=${ISA_DATA}
REQUIRE=${ISA_REQUIRE},${REQUIRE} REQUIRE=${ISA_REQUIRE},${REQUIRE}
fi fi

View File

@ -35,6 +35,8 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <securec.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gmock/gmock.h> #include <gmock/gmock.h>
@ -142,7 +144,7 @@ TEST(ItemContainer, TestFileFormatVersionValid)
auto writer = FileWriter(file_name); auto writer = FileWriter(file_name);
File::Header header; File::Header header;
memset(&header, 0, sizeof(header)); (void)memset_s(&header, sizeof(header), 0, sizeof(header));
header.magic = File::MAGIC; header.magic = File::MAGIC;
header.version = {0, 0, 0, 2}; header.version = {0, 0, 0, 2};
header.file_size = sizeof(File::Header); header.file_size = sizeof(File::Header);

View File

@ -39,7 +39,6 @@ config("arkruntime_config") {
cflags_cc = [ cflags_cc = [
"-Wno-invalid-offsetof", "-Wno-invalid-offsetof",
"-Wno-unused-parameter", "-Wno-unused-parameter",
"-Wno-implicit-fallthrough",
] ]
} }
@ -276,7 +275,6 @@ config("arkruntime_interpreter_impl_config") {
cflags_cc = [ cflags_cc = [
"-Wno-invalid-offsetof", "-Wno-invalid-offsetof",
"-Wno-unused-parameter", "-Wno-unused-parameter",
"-Wno-implicit-fallthrough",
] ]
defines = [] defines = []

View File

@ -496,7 +496,7 @@ static size_t LayoutFields(Class *klass, PandaList<Field *> *tagged_fields, Pand
if (is_static) { if (is_static) {
offset = klass->GetStaticFieldsOffset(); offset = klass->GetStaticFieldsOffset();
} else { } else {
offset = klass->GetBase() != nullptr ? klass->GetBase()->GetObjectSize() : ObjectHeader::ObjectHeaderSize(); offset = (klass->GetBase() != nullptr) ? klass->GetBase()->GetObjectSize() : ObjectHeader::ObjectHeaderSize();
} }
if (!ref_fields->empty()) { if (!ref_fields->empty()) {

View File

@ -120,7 +120,7 @@ public:
// If we don't have Hash inside an object header, thisThread constant shouldn't be used // If we don't have Hash inside an object header, thisThread constant shouldn't be used
HASH_SIZE = (CONFIG_HASH_STATUS_SIZE != 0UL) HASH_SIZE = (CONFIG_HASH_STATUS_SIZE != 0UL)
? 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, FORWARDING_ADDRESS_SIZE = CONFIG_MARK_WORD_BIT_SIZE - STATUS_SIZE - HASH_STATUS_SIZE,
// Unlocked state masks and shifts // Unlocked state masks and shifts

View File

@ -866,7 +866,7 @@ Expected<int, Runtime::Error> Runtime::ExecutePandaFile(std::string_view filenam
// Create app name from path to executable file. // Create app name from path to executable file.
std::string_view app_name = [](std::string_view path) -> std::string_view { std::string_view app_name = [](std::string_view path) -> std::string_view {
auto pos = path.find_last_of('/'); 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); }(filename);
StartDProfiler(app_name); 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 { std::string_view app_name = [](std::string_view path) -> std::string_view {
auto pos = path.find_last_of('/'); 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); }(profile_output_filename);
StartDProfiler(app_name); StartDProfiler(app_name);

View File

@ -1,4 +1,4 @@
#!/bin/bash -ex #!/bin/bash
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with 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 # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -ex
if [[ ${BUILD_TOOL} = "ninja" ]]; then if [[ "${BUILD_TOOL}" = "ninja" ]]; then
GENERATOR="Ninja" GENERATOR="Ninja"
BUILD_STR="ninja -k1" BUILD_STR="ninja -k1"
else else

View File

@ -1,4 +1,4 @@
#!/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");