From 5eb41e6e43d65af001e2f022362e4ee42301042a Mon Sep 17 00:00:00 2001 From: hwx1163501 Date: Mon, 25 Sep 2023 20:22:57 +0800 Subject: [PATCH] Modifying Code Alarms Signed-off-by: hwx1163501 issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I849Y4 --- ecmascript/compiler/aot_file/elf_builder.cpp | 4 ++-- ecmascript/mem/mem_map_allocator.h | 4 ++-- ecmascript/pgo_profiler/types/pgo_profiler_type.h | 4 ++-- test/run_ts_test262.py | 1 + tools/circuit_viewer/test/test_viewer.py | 3 ++- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ecmascript/compiler/aot_file/elf_builder.cpp b/ecmascript/compiler/aot_file/elf_builder.cpp index a9de5da8b8..8edd523abe 100644 --- a/ecmascript/compiler/aot_file/elf_builder.cpp +++ b/ecmascript/compiler/aot_file/elf_builder.cpp @@ -396,9 +396,9 @@ void ElfBuilder::FixSymtab(llvm::ELF::Elf64_Shdr* shdr) localCount = static_cast(i); } if (sy->getType() == llvm::ELF::STT_SECTION) { - sy->st_shndx = shStrTabIndex; + sy->st_shndx = static_cast(shStrTabIndex); } else if (sy->getType() == llvm::ELF::STT_FUNC) { - sy->st_shndx = textSecIndex; + sy->st_shndx = static_cast(textSecIndex); sy->st_value += textSecOffset; } if (sy->st_shndx > secNum) { diff --git a/ecmascript/mem/mem_map_allocator.h b/ecmascript/mem/mem_map_allocator.h index dc8cbc16f4..74b7a6f226 100644 --- a/ecmascript/mem/mem_map_allocator.h +++ b/ecmascript/mem/mem_map_allocator.h @@ -83,8 +83,8 @@ public: int ShouldFreeMore(size_t cachedSize) { os::memory::LockHolder lock(lock_); - size_t result = regularMapCommitted_.size(); - return result - cachedSize / REGULAR_MMAP_SIZE; + int result = regularMapCommitted_.size(); + return result - static_cast(cachedSize / REGULAR_MMAP_SIZE); } void AddMemToCommittedCache(void *mem, size_t size) diff --git a/ecmascript/pgo_profiler/types/pgo_profiler_type.h b/ecmascript/pgo_profiler/types/pgo_profiler_type.h index eae0858d7e..82aba571fd 100644 --- a/ecmascript/pgo_profiler/types/pgo_profiler_type.h +++ b/ecmascript/pgo_profiler/types/pgo_profiler_type.h @@ -181,7 +181,7 @@ public: { if (type_.index() == 0) { auto oldType = static_cast(std::get(type_)); - oldType = oldType & AnyType(); + oldType = oldType & static_cast(AnyType()); type_ = Type(oldType | static_cast(std::get(type.type_))); } else { @@ -230,7 +230,7 @@ public: Type GetPrimitiveType() const { auto type = static_cast(std::get(type_)); - return Type(type & AnyType()); + return Type(type & static_cast(AnyType())); } uint32_t GetWeight() const diff --git a/test/run_ts_test262.py b/test/run_ts_test262.py index e3aeea9ae5..15aa1ea8c6 100644 --- a/test/run_ts_test262.py +++ b/test/run_ts_test262.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tools/circuit_viewer/test/test_viewer.py b/tools/circuit_viewer/test/test_viewer.py index 6cd11829ce..8bb3015f37 100755 --- a/tools/circuit_viewer/test/test_viewer.py +++ b/tools/circuit_viewer/test/test_viewer.py @@ -20,6 +20,7 @@ import nltk import cv2 import tempfile import pytest +import subprocess web_path = os.path.realpath("../dist") @@ -60,7 +61,7 @@ def setup(): os.chdir("..") print("setup : 编译项目") - os.system("npm run dist") + subprocess.run(["npm", "run", "dist"]) print("setup : 拷贝测试文件") shutil.copy("examples/log_loop.txt", "dist/test.txt")