mirror of
https://gitee.com/jiuyilian/embedded-framework.git
synced 2025-01-06 10:16:51 -05:00
Fix clang-tidy warnings.
This commit is contained in:
parent
076a6da052
commit
3c52037560
|
@ -23,7 +23,7 @@ llvm-twine-local,\
|
|||
misc-confusable-identifiers,\
|
||||
misc-definitions-in-headers,\
|
||||
misc-header-include-cycle,\
|
||||
misc-include-cleaner,\
|
||||
-misc-include-cleaner,\
|
||||
misc-misleading-bidirectional,\
|
||||
misc-misleading-identifier,\
|
||||
misc-misplaced-const,\
|
||||
|
|
|
@ -32,11 +32,15 @@ target_link_libraries(${IMPL_TARGET} ${ABSTRACT_TARGET})
|
|||
if ("${CLANG_TIDY_SUPPORT}" MATCHES "true")
|
||||
add_custom_target(
|
||||
hal_code_check
|
||||
COMMAND ${CMAKE_SOURCE_DIR_IPCSDK}/tools/clang-tidy/clang-tidy
|
||||
# COMMAND ${CMAKE_SOURCE_DIR_IPCSDK}/tools/clang-tidy/clang-tidy
|
||||
COMMAND ${CLANG_TIDY_EXE}
|
||||
-checks='${CLANG_TIDY_CHECKS}'
|
||||
-header-filter=.*
|
||||
-system-headers
|
||||
# -header-filter=.*
|
||||
# -system-headers
|
||||
--header-filter=.*
|
||||
--system-headers=false
|
||||
${ABSTRACT_SRC_FILES}
|
||||
${IMPL_SRC_FILES}
|
||||
${CLANG_TIDY_CONFIG}
|
||||
-p ${CMAKE_SOURCE_DIR_IPCSDK}/cmake-shell-linux
|
||||
# -- -I /usr/include/linux/ -X c++
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "IHalCpp.h"
|
||||
#include "Log.h"
|
||||
#include "ILog.h"
|
||||
// #include <thread>
|
||||
#include <memory>
|
||||
std::shared_ptr<IHalCpp> &IHalCpp::GetInstance(std::shared_ptr<IHalCpp> *impl)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "Hal.h"
|
||||
#include "Log.h"
|
||||
#include "ILog.h"
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
static void HalFree(IHal *object)
|
||||
|
@ -35,9 +35,9 @@ StatusCode NewHal(Hal **hal)
|
|||
LogError("NewHal failed.\n");
|
||||
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
||||
}
|
||||
else
|
||||
// else
|
||||
{
|
||||
HalImplInit(*hal);
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#include "HalCpp.h"
|
||||
#include "Log.h"
|
||||
#include "ILog.h"
|
||||
StatusCode HalCpp::Init(void)
|
||||
{
|
||||
LogInfo("HalCpp::Init\n");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "HalMakePtr.h"
|
||||
#include "Log.h"
|
||||
#include "Hal.h"
|
||||
#include "HalCpp.h"
|
||||
#include "ILog.h"
|
||||
StatusCode create_hal_module(void)
|
||||
{
|
||||
IHal *hal = NULL;
|
||||
|
|
|
@ -3,16 +3,14 @@
|
|||
#include <gtest/gtest.h>
|
||||
namespace ILogTest
|
||||
{
|
||||
// ../out/test/bin/ILogTest --gtest_filter=LogCTest.Demo
|
||||
// ../out/test/bin/LogTest --gtest_filter=ILogTest.Demo
|
||||
TEST(ILogTest, Demo)
|
||||
{
|
||||
CreateLogModule();
|
||||
ILogInit(LOG_INSTANCE_TYPE_END);
|
||||
|
||||
LogInfo("hello world.");
|
||||
LogError("create ... failed.");
|
||||
LogDebug("a = %d b = %s", 124, "apple");
|
||||
|
||||
IHalUnInit();
|
||||
DestroyLogModule();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
# cmake_minimum_required(VERSION 2.8.0)
|
||||
add_subdirectory(ReturnCode)
|
||||
# add_subdirectory(ReturnCode)
|
||||
add_subdirectory(StatusCode)
|
||||
add_subdirectory(Log)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "ILog.h"
|
||||
#include "ILogCpp.h"
|
||||
#include <string.h>
|
||||
static void ILogInitCallBack(ILog *object, const LogInstance log)
|
||||
static void ILogInitCallBack(ILog *object, const int log)
|
||||
{
|
||||
return ILogCpp::GetInstance()->Init(log);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ void NewILog(ILog **object)
|
|||
memcpy(*object, &default_log, sizeof(ILog));
|
||||
return;
|
||||
}
|
||||
void ResetHalImpl(ILog *impl)
|
||||
void ResetLogImpl(ILog *impl)
|
||||
{
|
||||
log_instance->free(log_instance);
|
||||
log_instance = impl;
|
||||
|
|
|
@ -24,7 +24,6 @@ extern "C"
|
|||
{
|
||||
LOG_SERIAL_PRINT = 0, // for serial print.
|
||||
LOG_EASYLOGGING, // for easylogging++.
|
||||
LOG_CAPTURE_LOG, // capture log to other who need it
|
||||
LOG_INSTANCE_TYPE_END
|
||||
};
|
||||
#define LogVerbose(...) GetLogIntance()->printf(GetLogIntance(), __FUNCTION__, __LINE__, LOG_TYPE_VERBOSE, __VA_ARGS__)
|
||||
|
@ -36,19 +35,19 @@ extern "C"
|
|||
typedef struct i_log ILog;
|
||||
typedef struct i_log
|
||||
{
|
||||
void (*init)(ILog *, const LogInstance);
|
||||
void (*init)(ILog *, const int);
|
||||
void (*free)(ILog *);
|
||||
int (*printf)(ILog *, const char *, const int, const int, const char *, ...);
|
||||
void (*un_init)(ILog *);
|
||||
} ILog;
|
||||
ILog *GetLogIntance(void);
|
||||
void NewILog(ILog **object);
|
||||
void ResetHalImpl(ILog *impl);
|
||||
static inline void ILogInit(const LogInstance log)
|
||||
void ResetLogImpl(ILog *impl);
|
||||
static inline void ILogInit(const int log)
|
||||
{
|
||||
return GetLogIntance()->init(GetLogIntance(), log);
|
||||
}
|
||||
static inline void IHalUnInit(void)
|
||||
static inline void ILolUnInit(void)
|
||||
{
|
||||
return GetLogIntance()->un_init(GetLogIntance());
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ public:
|
|||
ILogCpp() = default;
|
||||
virtual ~ILogCpp() = default;
|
||||
static std::shared_ptr<ILogCpp> &GetInstance(std::shared_ptr<ILogCpp> *impl = nullptr);
|
||||
virtual void Init(const LogInstance &log) {}
|
||||
virtual void Init(const int &log) {}
|
||||
virtual void UnInit(void) {}
|
||||
};
|
||||
#endif
|
|
@ -21,7 +21,7 @@ LogEasylogging::LogEasylogging(const LogSetting *setting)
|
|||
mMaxSize = setting->maxSize;
|
||||
}
|
||||
}
|
||||
void LogEasylogging::Init(const LogInstance &log)
|
||||
void LogEasylogging::Init(const int &log)
|
||||
{
|
||||
#if 0
|
||||
el::Configurations conf("/home/xiaojiazhu/project/OS/OSThings/test/out/bin/default-logger.conf");
|
||||
|
|
|
@ -6,7 +6,7 @@ class LogEasylogging : public ILogCpp
|
|||
public:
|
||||
LogEasylogging(const LogSetting *setting);
|
||||
virtual ~LogEasylogging() = default;
|
||||
void Init(const LogInstance &log) override;
|
||||
void Init(const int &log) override;
|
||||
void UnInit(void) override;
|
||||
// bool IsWorking(); // override;
|
||||
// int Log(const char *buff); // override;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "StatusCode.h"
|
||||
#include "Log.h"
|
||||
#include "ILog.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
static const char *StatusCodeString[STATUS_CODE_END + 1] = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user