From 874b94e548e6a66264d5fa5b35c272a5b64aab35 Mon Sep 17 00:00:00 2001 From: s_c_c Date: Tue, 12 Mar 2024 16:11:06 +0800 Subject: [PATCH 2/2] feat for embedded fix unused errors --- frameworks/libhilog/hilog.cpp | 3 +-- frameworks/libhilog/utils/log_utils.cpp | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/libhilog/hilog.cpp b/frameworks/libhilog/hilog.cpp index 8da82c5..b42f601 100644 --- a/frameworks/libhilog/hilog.cpp +++ b/frameworks/libhilog/hilog.cpp @@ -76,7 +76,6 @@ int HiLogPrintArgs(const LogType type, const LogLevel level, const unsigned int char buf[MAX_LOG_LEN] = {0}; char *logBuf = buf; int traceBufLen = 0; - int ret; bool priv = false; #ifdef __clang__ @@ -88,7 +87,7 @@ int HiLogPrintArgs(const LogType type, const LogLevel level, const unsigned int #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif - ret = vsnprintfp_s(logBuf, MAX_LOG_LEN - traceBufLen, MAX_LOG_LEN - traceBufLen - 1, priv, fmt, ap); + (void)vsnprintfp_s(logBuf, MAX_LOG_LEN - traceBufLen, MAX_LOG_LEN - traceBufLen - 1, priv, fmt, ap); #ifdef __clang__ #pragma clang diagnostic pop #elif __GNUC__ diff --git a/frameworks/libhilog/utils/log_utils.cpp b/frameworks/libhilog/utils/log_utils.cpp index af130c4..0ff618f 100644 --- a/frameworks/libhilog/utils/log_utils.cpp +++ b/frameworks/libhilog/utils/log_utils.cpp @@ -494,7 +494,8 @@ void PrintErrorno(int err) constexpr int bufSize = 256; char buf[bufSize] = { 0 }; #ifndef __WINDOWS__ - (void)strerror_r(err, buf, bufSize); + char *ret = strerror_r(err, buf, bufSize); + (void)ret; #else (void)strerror_s(buf, bufSize, err); #endif -- 2.20.1 (Apple Git-117)