From 703ac4ca9cbe6bb83ffe36720b09504a0194d4b3 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Mon, 25 Jan 2021 16:36:37 +0800 Subject: [PATCH] Add __attribute__((format(printf, 2, 3))) --- third_party/fwkacllib/inc/toolchain/slog.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) 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 }