From e693ff313567f55def61c0942413b7b3f6017945 Mon Sep 17 00:00:00 2001 From: lhc Date: Thu, 31 Jul 2025 10:43:31 +0800 Subject: [PATCH] Modify the code coverage comment Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICPZRC?from=project-issue Signed-off-by: lhc Change-Id: I00e1722cb739ecae4b1cadd637a97a0d5881a542 --- common_components/base/rw_lock.h | 2 +- common_components/base/utf_helper.cpp | 2 +- common_components/common/page_pool.h | 2 +- common_components/log/log.cpp | 66 +++++++++++++-------------- common_components/log/log.h | 60 ++++++++++++------------ 5 files changed, 66 insertions(+), 66 deletions(-) diff --git a/common_components/base/rw_lock.h b/common_components/base/rw_lock.h index 2b52c642a7..c09c1044f4 100755 --- a/common_components/base/rw_lock.h +++ b/common_components/base/rw_lock.h @@ -66,7 +66,7 @@ public: void UnlockRead() { int count = lockCount_.fetch_sub(1); - if (count < 0) { //LCOV_EXCL_BR_LINE + if (count < 0) { // LCOV_EXCL_BR_LINE LOG_COMMON(FATAL) << "Unresolved fatal"; UNREACHABLE_CC(); } diff --git a/common_components/base/utf_helper.cpp b/common_components/base/utf_helper.cpp index 1425545508..d88b0f0911 100644 --- a/common_components/base/utf_helper.cpp +++ b/common_components/base/utf_helper.cpp @@ -144,7 +144,7 @@ bool IsValidUTF8(const std::vector &data) return false; } break; - default: //LCOV_EXCL_BR_LINE + default: // LCOV_EXCL_BR_LINE LOG_COMMON(FATAL) << "this branch is unreachable"; UNREACHABLE_CC(); break; diff --git a/common_components/common/page_pool.h b/common_components/common/page_pool.h index a4a44642ce..fb6d37a60b 100755 --- a/common_components/common/page_pool.h +++ b/common_components/common/page_pool.h @@ -135,7 +135,7 @@ protected: { #ifdef _WIN64 void* result = VirtualAlloc(NULL, size, isCommit ? MEM_COMMIT : MEM_RESERVE, PAGE_READWRITE); - if (result == NULL) { //LCOV_EXCL_BR_LINE + if (result == NULL) { // LCOV_EXCL_BR_LINE LOG_COMMON(FATAL) << "allocate create page failed! Out of Memory!"; UNREACHABLE_CC(); } diff --git a/common_components/log/log.cpp b/common_components/log/log.cpp index e058b405f1..372ed45220 100755 --- a/common_components/log/log.cpp +++ b/common_components/log/log.cpp @@ -28,22 +28,22 @@ Level ConvertToLevel(LogLevel hilogLevel) { Level level = Level::ERROR; std::string logLevel; - switch (hilogLevel) { //LCOV_EXCL_BR_LINE - case LogLevel::LOG_INFO: //LCOV_EXCL_BR_LINE + switch (hilogLevel) { // LCOV_EXCL_BR_LINE + case LogLevel::LOG_INFO: // LCOV_EXCL_BR_LINE level = Level::INFO; break; - case LogLevel::LOG_WARN: //LCOV_EXCL_BR_LINE + case LogLevel::LOG_WARN: // LCOV_EXCL_BR_LINE level = Level::WARN; break; - case LogLevel::LOG_ERROR: //LCOV_EXCL_BR_LINE + case LogLevel::LOG_ERROR: // LCOV_EXCL_BR_LINE level = Level::ERROR; break; - case LogLevel::LOG_FATAL: //LCOV_EXCL_BR_LINE - case LogLevel::LOG_LEVEL_MAX: //LCOV_EXCL_BR_LINE + case LogLevel::LOG_FATAL: // LCOV_EXCL_BR_LINE + case LogLevel::LOG_LEVEL_MAX: // LCOV_EXCL_BR_LINE level = Level::FATAL; break; - case LogLevel::LOG_DEBUG: //LCOV_EXCL_BR_LINE - default: //LCOV_EXCL_BR_LINE + case LogLevel::LOG_DEBUG: // LCOV_EXCL_BR_LINE + default: // LCOV_EXCL_BR_LINE level = Level::DEBUG; break; } @@ -53,8 +53,8 @@ Level ConvertToLevel(LogLevel hilogLevel) LogLevel GetHiLogLevel() { - for (int32_t level = LogLevel::LOG_LEVEL_MIN; level <= LogLevel::LOG_LEVEL_MAX; level++) { //LCOV_EXCL_BR_LINE - if (HiLogIsLoggable(LOG_DOMAIN, LOG_TAG, static_cast(level))) { //LCOV_EXCL_BR_LINE + for (int32_t level = LogLevel::LOG_LEVEL_MIN; level <= LogLevel::LOG_LEVEL_MAX; level++) { // LCOV_EXCL_BR_LINE + if (HiLogIsLoggable(LOG_DOMAIN, LOG_TAG, static_cast(level))) { // LCOV_EXCL_BR_LINE return static_cast(level); } } @@ -68,26 +68,26 @@ ComponentMark Log::components_ = static_cast(Component::ALL); Level Log::ConvertFromRuntime(LOG_LEVEL level) { Level logLevel = Level::INFO; - switch (level) { //LCOV_EXCL_BR_LINE - case LOG_LEVEL::FOLLOW: //LCOV_EXCL_BR_LINE + switch (level) { // LCOV_EXCL_BR_LINE + case LOG_LEVEL::FOLLOW: // LCOV_EXCL_BR_LINE #ifdef ENABLE_HILOG logLevel = ConvertToLevel(GetHiLogLevel()); break; #endif - case LOG_LEVEL::INFO: //LCOV_EXCL_BR_LINE + case LOG_LEVEL::INFO: // LCOV_EXCL_BR_LINE logLevel = Level::INFO; break; - case LOG_LEVEL::WARN: //LCOV_EXCL_BR_LINE + case LOG_LEVEL::WARN: // LCOV_EXCL_BR_LINE logLevel = Level::WARN; break; - case LOG_LEVEL::ERROR: //LCOV_EXCL_BR_LINE + case LOG_LEVEL::ERROR: // LCOV_EXCL_BR_LINE logLevel = Level::ERROR; break; - case LOG_LEVEL::FATAL: //LCOV_EXCL_BR_LINE + case LOG_LEVEL::FATAL: // LCOV_EXCL_BR_LINE logLevel = Level::FATAL; break; - case LOG_LEVEL::DEBUG: //LCOV_EXCL_BR_LINE - default: //LCOV_EXCL_BR_LINE + case LOG_LEVEL::DEBUG: // LCOV_EXCL_BR_LINE + default: // LCOV_EXCL_BR_LINE logLevel = Level::DEBUG; break; } @@ -98,21 +98,21 @@ Level Log::ConvertFromRuntime(LOG_LEVEL level) std::string Log::LevelToString(Level level) { std::string logLevel; - switch (level) { //LCOV_EXCL_BR_LINE - case Level::INFO: //LCOV_EXCL_BR_LINE + switch (level) { // LCOV_EXCL_BR_LINE + case Level::INFO: // LCOV_EXCL_BR_LINE logLevel = "info"; break; - case Level::WARN: //LCOV_EXCL_BR_LINE + case Level::WARN: // LCOV_EXCL_BR_LINE logLevel = "warning"; break; - case Level::ERROR: //LCOV_EXCL_BR_LINE + case Level::ERROR: // LCOV_EXCL_BR_LINE logLevel = "error"; break; - case Level::FATAL: //LCOV_EXCL_BR_LINE + case Level::FATAL: // LCOV_EXCL_BR_LINE logLevel = "fatal"; break; - case Level::DEBUG: //LCOV_EXCL_BR_LINE - default: //LCOV_EXCL_BR_LINE + case Level::DEBUG: // LCOV_EXCL_BR_LINE + default: // LCOV_EXCL_BR_LINE logLevel = "debug"; break; } @@ -122,26 +122,26 @@ std::string Log::LevelToString(Level level) int32_t Log::PrintLogger(int32_t, int32_t level, const char *, const char *, const char *message) { - switch (level) { //LCOV_EXCL_BR_LINE - case panda::Logger::PandaLog2MobileLog::VERBOSE: //LCOV_EXCL_BR_LINE + switch (level) { // LCOV_EXCL_BR_LINE + case panda::Logger::PandaLog2MobileLog::VERBOSE: // LCOV_EXCL_BR_LINE LOG_COMMON(VERBOSE) << message; break; - case panda::Logger::PandaLog2MobileLog::DEBUG: //LCOV_EXCL_BR_LINE + case panda::Logger::PandaLog2MobileLog::DEBUG: // LCOV_EXCL_BR_LINE LOG_COMMON(DEBUG) << message; break; - case panda::Logger::PandaLog2MobileLog::INFO: //LCOV_EXCL_BR_LINE + case panda::Logger::PandaLog2MobileLog::INFO: // LCOV_EXCL_BR_LINE LOG_COMMON(INFO) << message; break; - case panda::Logger::PandaLog2MobileLog::WARN: //LCOV_EXCL_BR_LINE + case panda::Logger::PandaLog2MobileLog::WARN: // LCOV_EXCL_BR_LINE LOG_COMMON(WARN) << message; break; - case panda::Logger::PandaLog2MobileLog::ERROR: //LCOV_EXCL_BR_LINE + case panda::Logger::PandaLog2MobileLog::ERROR: // LCOV_EXCL_BR_LINE LOG_COMMON(ERROR) << message; break; - case panda::Logger::PandaLog2MobileLog::FATAL: //LCOV_EXCL_BR_LINE + case panda::Logger::PandaLog2MobileLog::FATAL: // LCOV_EXCL_BR_LINE LOG_COMMON(FATAL) << message; break; - default: //LCOV_EXCL_BR_LINE + default: // LCOV_EXCL_BR_LINE LOG_COMMON(DEBUG) << message; break; } diff --git a/common_components/log/log.h b/common_components/log/log.h index 7dc455d275..34ac5b61e1 100644 --- a/common_components/log/log.h +++ b/common_components/log/log.h @@ -56,47 +56,47 @@ public: static void Initialize(const LogOptions &options); static inline bool LogIsLoggable(Level level, Component component) { - switch (component) //LCOV_EXCL_BR_LINE + switch (component) // LCOV_EXCL_BR_LINE { - case Component::SA: //LCOV_EXCL_BR_LINE + case Component::SA: // LCOV_EXCL_BR_LINE return ((components_ & static_cast(component)) != 0ULL); - default: //LCOV_EXCL_BR_LINE + default: // LCOV_EXCL_BR_LINE return (level >= level_) && ((components_ & static_cast(component)) != 0ULL); } } static inline std::string GetComponentStr(Component component) { - switch (component) //LCOV_EXCL_BR_LINE + switch (component) // LCOV_EXCL_BR_LINE { - case Component::NO_TAG: //LCOV_EXCL_BR_LINE + case Component::NO_TAG: // LCOV_EXCL_BR_LINE return ""; - case Component::GC: //LCOV_EXCL_BR_LINE + case Component::GC: // LCOV_EXCL_BR_LINE return "[gc] "; - case Component::ECMASCRIPT: //LCOV_EXCL_BR_LINE + case Component::ECMASCRIPT: // LCOV_EXCL_BR_LINE return "[ecmascript] "; - case Component::PGO: //LCOV_EXCL_BR_LINE + case Component::PGO: // LCOV_EXCL_BR_LINE return "[pgo] "; - case Component::INTERPRETER: //LCOV_EXCL_BR_LINE + case Component::INTERPRETER: // LCOV_EXCL_BR_LINE return "[interpreter] "; - case Component::DEBUGGER: //LCOV_EXCL_BR_LINE + case Component::DEBUGGER: // LCOV_EXCL_BR_LINE return "[debugger] "; - case Component::COMPILER: //LCOV_EXCL_BR_LINE + case Component::COMPILER: // LCOV_EXCL_BR_LINE return "[compiler] "; - case Component::BUILTINS: //LCOV_EXCL_BR_LINE + case Component::BUILTINS: // LCOV_EXCL_BR_LINE return "[builtins] "; - case Component::TRACE: //LCOV_EXCL_BR_LINE + case Component::TRACE: // LCOV_EXCL_BR_LINE return "[trace] "; - case Component::JIT: //LCOV_EXCL_BR_LINE + case Component::JIT: // LCOV_EXCL_BR_LINE return "[jit] "; - case Component::BASELINEJIT: //LCOV_EXCL_BR_LINE + case Component::BASELINEJIT: // LCOV_EXCL_BR_LINE return "[baselinejit] "; - case Component::SA: //LCOV_EXCL_BR_LINE + case Component::SA: // LCOV_EXCL_BR_LINE return "[sa] "; - case Component::COMMON: //LCOV_EXCL_BR_LINE + case Component::COMMON: // LCOV_EXCL_BR_LINE return "[common] "; - case Component::ALL: //LCOV_EXCL_BR_LINE + case Component::ALL: // LCOV_EXCL_BR_LINE return "[default] "; - default: //LCOV_EXCL_BR_LINE + default: // LCOV_EXCL_BR_LINE return "[unknown] "; } } @@ -121,19 +121,19 @@ public: } ~HiLog() { - if constexpr (level == LOG_LEVEL_MIN) { //LCOV_EXCL_BR_LINE + if constexpr (level == LOG_LEVEL_MIN) { // LCOV_EXCL_BR_LINE // print nothing - } else if constexpr (level == LOG_DEBUG) { //LCOV_EXCL_BR_LINE + } else if constexpr (level == LOG_DEBUG) { // LCOV_EXCL_BR_LINE HILOG_DEBUG(LOG_CORE, "%{public}s", stream_.str().c_str()); - } else if constexpr (level == LOG_INFO) { //LCOV_EXCL_BR_LINE + } else if constexpr (level == LOG_INFO) { // LCOV_EXCL_BR_LINE HILOG_INFO(LOG_CORE, "%{public}s", stream_.str().c_str()); - } else if constexpr (level == LOG_WARN) { //LCOV_EXCL_BR_LINE + } else if constexpr (level == LOG_WARN) { // LCOV_EXCL_BR_LINE HILOG_WARN(LOG_CORE, "%{public}s", stream_.str().c_str()); - } else if constexpr (level == LOG_ERROR) { //LCOV_EXCL_BR_LINE + } else if constexpr (level == LOG_ERROR) { // LCOV_EXCL_BR_LINE HILOG_ERROR(LOG_CORE, "%{public}s", stream_.str().c_str()); - } else { //LCOV_EXCL_BR_LINE + } else { // LCOV_EXCL_BR_LINE HILOG_FATAL(LOG_CORE, "%{public}s", stream_.str().c_str()); - if (level == LOG_FATAL) { //LCOV_EXCL_BR_LINE + if (level == LOG_FATAL) { // LCOV_EXCL_BR_LINE std::abort(); } } @@ -180,13 +180,13 @@ public: } ~StdLog() { - if constexpr (level >= Level::ERROR) { //LCOV_EXCL_BR_LINE + if constexpr (level >= Level::ERROR) { // LCOV_EXCL_BR_LINE std::cerr << stream_.str().c_str() << std::endl; - } else { //LCOV_EXCL_BR_LINE + } else { // LCOV_EXCL_BR_LINE std::cout << stream_.str().c_str() << std::endl; } - if constexpr (level == Level::FATAL) { //LCOV_EXCL_BR_LINE + if constexpr (level == Level::FATAL) { // LCOV_EXCL_BR_LINE std::abort(); } } @@ -258,7 +258,7 @@ private: strerror(errno) << \ " return " << errno; \ } \ - } while (false) //LCOV_EXCL_BR_LINE + } while (false) // LCOV_EXCL_BR_LINE std::string Pretty(uint64_t number) noexcept; std::string PrettyOrderInfo(uint64_t number, const char* unit); -- Gitee