diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 888f565c..12af76ec 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -707,7 +707,7 @@ target_compile_options(ge_runner PRIVATE -O2 -fno-common $<$:-Werror=unused-variable> - $<$:-Werror=unused-const-variable> + $<$:-Werror=unused-const-variable -Werror=format> ) target_include_directories(ge_runner SYSTEM PRIVATE @@ -776,7 +776,7 @@ target_compile_options(ge_compiler PRIVATE -O2 -fno-common $<$:-Werror=unused-variable> - $<$:-Werror=unused-const-variable> + $<$:-Werror=unused-const-variable -Werror=format> ) target_include_directories(ge_compiler SYSTEM PRIVATE diff --git a/inc/framework/common/debug/ge_log.h b/inc/framework/common/debug/ge_log.h index 4a32af36..d5b673c4 100644 --- a/inc/framework/common/debug/ge_log.h +++ b/inc/framework/common/debug/ge_log.h @@ -40,13 +40,13 @@ enum TraceStatus { TRACE_INIT = 0, TRACE_RUNNING, TRACE_WAITING, TRACE_STOP }; class GeLog { public: #ifdef __GNUC__ -static pid_t GetTid() { - thread_local static pid_t tid = syscall(__NR_gettid); +static uint64_t GetTid() { + thread_local static uint64_t tid = static_cast(syscall(__NR_gettid)); return tid; } #else -static int GetTid() { - thread_local static int tid = static_cast(GetCurrentThreadId()); +static uint64_t GetTid() { + thread_local static uint64_t tid = static_cast(GetCurrentThreadId()); return tid; } #endif diff --git a/third_party/fwkacllib/inc/toolchain/slog.h b/third_party/fwkacllib/inc/toolchain/slog.h index 7c4f7be2..ba286d02 100644 --- a/third_party/fwkacllib/inc/toolchain/slog.h +++ b/third_party/fwkacllib/inc/toolchain/slog.h @@ -120,15 +120,15 @@ typedef struct tagKV { } KeyValue; typedef enum { - APPLICATION = 0, - SYSTEM + APPLICATION = 0, + SYSTEM } ProcessType; typedef struct { - ProcessType type; - unsigned int pid; - unsigned int deviceId; - char reserved[RESERVERD_LENGTH]; + ProcessType type; + unsigned int pid; + unsigned int deviceId; + char reserved[RESERVERD_LENGTH]; } LogAttr; /** @@ -381,13 +381,13 @@ DLL_EXPORT void DlogFlush(void); * @ingroup slog * @brief Internal log interface, other modules are not allowed to call this interface */ -void DlogErrorInner(int moduleId, const char *fmt, ...); -void DlogWarnInner(int moduleId, const char *fmt, ...); -void DlogInfoInner(int moduleId, const char *fmt, ...); -void DlogDebugInner(int moduleId, const char *fmt, ...); -void DlogEventInner(int moduleId, const char *fmt, ...); -void DlogInner(int moduleId, int level, const char *fmt, ...); -void DlogWithKVInner(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...); +void DlogErrorInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +void DlogWarnInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +void DlogInfoInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +void DlogDebugInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +void DlogEventInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +void DlogInner(int moduleId, int level, const char *fmt, ...) __attribute__((format(printf, 3, 4))); +void DlogWithKVInner(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...) __attribute__((format(printf, 5, 6))); #ifdef __cplusplus #ifndef LOG_CPP @@ -500,8 +500,8 @@ DLL_EXPORT void DlogFlushForC(void); * @ingroup slog * @brief Internal log interface, other modules are not allowed to call this interface */ -void DlogInnerForC(int moduleId, int level, const char *fmt, ...); -void DlogWithKVInnerForC(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...); +void DlogInnerForC(int moduleId, int level, const char *fmt, ...) __attribute__((format(printf, 3, 4))); +void DlogWithKVInnerForC(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...) __attribute__((format(printf, 5, 6))); #ifdef __cplusplus }