From e4326be030bb72e813cc8bf65a146131c98fc8da Mon Sep 17 00:00:00 2001 From: Matt Swartwout Date: Wed, 8 Mar 2023 11:12:19 -0700 Subject: [PATCH 1/3] Remove DLL_IMPORT macro This macro is unused. --- src/lib/support/DLLUtil.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lib/support/DLLUtil.h b/src/lib/support/DLLUtil.h index b62b2261be836f..d46e0caf3f49ae 100644 --- a/src/lib/support/DLLUtil.h +++ b/src/lib/support/DLLUtil.h @@ -29,16 +29,13 @@ #pragma once #if defined _WIN32 || defined __CYGWIN__ -#define DLL_IMPORT __declspec(dllimport) #define DLL_EXPORT __declspec(dllexport) #define DLL_LOCAL #else #if __GNUC__ >= 4 -#define DLL_IMPORT __attribute__((visibility("default"))) #define DLL_EXPORT __attribute__((visibility("default"))) #define DLL_LOCAL __attribute__((visibility("hidden"))) #else -#define DLL_IMPORT #define DLL_EXPORT #define DLL_LOCAL #endif From 4c154b45bb7435ab711e0c416bf18f4c9fb4a22c Mon Sep 17 00:00:00 2001 From: Matt Swartwout Date: Wed, 8 Mar 2023 11:13:34 -0700 Subject: [PATCH 2/3] Remove DLL_LOCAL macro This macro doesn't appear to be providing any value, and make some compilation harder. --- src/lib/support/DLLUtil.h | 3 --- src/lib/support/logging/CHIPLogging.h | 10 +++++----- src/platform/Darwin/Logging.h | 9 ++++----- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/lib/support/DLLUtil.h b/src/lib/support/DLLUtil.h index d46e0caf3f49ae..70ae6df8a38ec2 100644 --- a/src/lib/support/DLLUtil.h +++ b/src/lib/support/DLLUtil.h @@ -30,13 +30,10 @@ #if defined _WIN32 || defined __CYGWIN__ #define DLL_EXPORT __declspec(dllexport) -#define DLL_LOCAL #else #if __GNUC__ >= 4 #define DLL_EXPORT __attribute__((visibility("default"))) -#define DLL_LOCAL __attribute__((visibility("hidden"))) #else #define DLL_EXPORT -#define DLL_LOCAL #endif #endif diff --git a/src/lib/support/logging/CHIPLogging.h b/src/lib/support/logging/CHIPLogging.h index 1591e6824c3e7d..5bb01ff1ed5c6b 100644 --- a/src/lib/support/logging/CHIPLogging.h +++ b/src/lib/support/logging/CHIPLogging.h @@ -338,9 +338,9 @@ DLL_EXPORT void SetLogFilter(uint8_t category); static constexpr uint16_t kMaxModuleNameLen = 3; #if CHIP_LOG_FILTERING -DLL_LOCAL bool IsCategoryEnabled(uint8_t category); +bool IsCategoryEnabled(uint8_t category); #else // CHIP_LOG_FILTERING -DLL_LOCAL inline bool IsCategoryEnabled(uint8_t category) +inline bool IsCategoryEnabled(uint8_t category) { return true; } @@ -395,9 +395,9 @@ DLL_LOCAL inline bool IsCategoryEnabled(uint8_t category) #define _IsModuleCategoryEnabled3(DUMMY_ARG, GLOB_CAT) _IsModuleCategoryEnabled4(DUMMY_ARG 0, GLOB_CAT) #define _IsModuleCategoryEnabled4(ARG1, ARG2, ...) (ARG2) -DLL_LOCAL void Log(uint8_t module, uint8_t category, const char * msg, ...) ENFORCE_FORMAT(3, 4); -DLL_LOCAL void LogByteSpan(uint8_t module, uint8_t category, const ByteSpan & span); -DLL_LOCAL void LogV(uint8_t module, uint8_t category, const char * msg, va_list args) ENFORCE_FORMAT(3, 0); +void Log(uint8_t module, uint8_t category, const char * msg, ...) ENFORCE_FORMAT(3, 4); +void LogByteSpan(uint8_t module, uint8_t category, const ByteSpan & span); +void LogV(uint8_t module, uint8_t category, const char * msg, va_list args) ENFORCE_FORMAT(3, 0); #if CHIP_SYSTEM_CONFIG_PLATFORM_LOG #ifndef ChipPlatformLog diff --git a/src/platform/Darwin/Logging.h b/src/platform/Darwin/Logging.h index 30f6c966af8a53..b85b3de9fbb2f2 100644 --- a/src/platform/Darwin/Logging.h +++ b/src/platform/Darwin/Logging.h @@ -17,7 +17,6 @@ #pragma once -#include #include #include @@ -65,18 +64,18 @@ enum OSLogCategory kOSLogCategory_AUTOMATION = OS_LOG_TYPE_DEFAULT, }; -DLL_LOCAL os_log_t LoggerForModule(chip::Logging::LogModule moduleId, char const * moduleName); -DLL_LOCAL void LogByteSpan(chip::Logging::LogModule moduleId, char const * moduleName, os_log_type_t type, +os_log_t LoggerForModule(chip::Logging::LogModule moduleId, char const * moduleName); +void LogByteSpan(chip::Logging::LogModule moduleId, char const * moduleName, os_log_type_t type, const chip::ByteSpan & span); // Helper constructs for compile-time validation of format strings for C++ / ObjC++ contexts. // Note that ObjC++ contexts are restricted to NSString style specifiers. Supporting os_log() // specifiers would require these to be emulated or stripped when log redirection is used. #ifdef __OBJC__ -DLL_LOCAL bool ValidateLogFormat(NSString * format, ...) __attribute__((format(__NSString__, 1, 0))); // not implemented +bool ValidateLogFormat(NSString * format, ...) __attribute__((format(__NSString__, 1, 0))); // not implemented #define ChipPlatformValidateLogFormat(F, ...) ((void) sizeof(chip::Logging::Platform::ValidateLogFormat(@F, ##__VA_ARGS__))) #else // __OBJC__ -DLL_LOCAL bool ValidateLogFormat(char const * format, ...) __attribute__((format(printf, 1, 0))); // not implemented +bool ValidateLogFormat(char const * format, ...) __attribute__((format(printf, 1, 0))); // not implemented #define ChipPlatformValidateLogFormat(F, ...) ((void) sizeof(chip::Logging::Platform::ValidateLogFormat(F, ##__VA_ARGS__))) #endif // __OBJC__ From 33a47e983be6d5ecbbf91544c9516060e0c95661 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 8 Mar 2023 18:49:38 +0000 Subject: [PATCH 3/3] Restyled by clang-format --- src/platform/Darwin/Logging.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/platform/Darwin/Logging.h b/src/platform/Darwin/Logging.h index b85b3de9fbb2f2..ae7d5b22921293 100644 --- a/src/platform/Darwin/Logging.h +++ b/src/platform/Darwin/Logging.h @@ -65,8 +65,7 @@ enum OSLogCategory }; os_log_t LoggerForModule(chip::Logging::LogModule moduleId, char const * moduleName); -void LogByteSpan(chip::Logging::LogModule moduleId, char const * moduleName, os_log_type_t type, - const chip::ByteSpan & span); +void LogByteSpan(chip::Logging::LogModule moduleId, char const * moduleName, os_log_type_t type, const chip::ByteSpan & span); // Helper constructs for compile-time validation of format strings for C++ / ObjC++ contexts. // Note that ObjC++ contexts are restricted to NSString style specifiers. Supporting os_log()