Browse Source

Enable -Werror=format

pull/1002/head
zhangxiaokun 5 years ago
parent
commit
1319ba7abc
3 changed files with 21 additions and 21 deletions
  1. +2
    -2
      ge/CMakeLists.txt
  2. +4
    -4
      inc/framework/common/debug/ge_log.h
  3. +15
    -15
      third_party/fwkacllib/inc/toolchain/slog.h

+ 2
- 2
ge/CMakeLists.txt View File

@@ -707,7 +707,7 @@ target_compile_options(ge_runner PRIVATE
-O2
-fno-common
$<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-variable>
$<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-const-variable>
$<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-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
$<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-variable>
$<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-const-variable>
$<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-const-variable -Werror=format>
)

target_include_directories(ge_compiler SYSTEM PRIVATE


+ 4
- 4
inc/framework/common/debug/ge_log.h View File

@@ -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<uint64_t>(syscall(__NR_gettid));
return tid;
}
#else
static int GetTid() {
thread_local static int tid = static_cast<int>(GetCurrentThreadId());
static uint64_t GetTid() {
thread_local static uint64_t tid = static_cast<uint64_t>(GetCurrentThreadId());
return tid;
}
#endif


+ 15
- 15
third_party/fwkacllib/inc/toolchain/slog.h View File

@@ -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
}


Loading…
Cancel
Save