Skip to content

Commit

Permalink
Remove redundant attributes from LogV implementation (project-chip#33984
Browse files Browse the repository at this point in the history
)

The function was already declared with ENFORCE_FORMAT(3, 0), so there is
no need to repeat this attribute in the definition.
  • Loading branch information
mbknust authored and diogopintodsr committed Jun 19, 2024
1 parent dca5d6c commit 97e3e3e
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 38 deletions.
3 changes: 1 addition & 2 deletions src/platform/ESP32/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <platform/logging/LogV.h>

#include <lib/core/CHIPConfig.h>
#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/Constants.h>

#include <stdio.h>
Expand All @@ -19,7 +18,7 @@ namespace chip {
namespace Logging {
namespace Platform {

void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
char tag[11];

Expand Down
6 changes: 3 additions & 3 deletions src/platform/Linux/Logging.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* See Project CHIP LICENSE file for licensing information. */

#include <platform/logging/LogV.h>

#include <lib/core/CHIPConfig.h>
#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/Constants.h>
#include <platform/logging/LogV.h>

#include <cinttypes>
#include <cstdio>
Expand Down Expand Up @@ -35,7 +35,7 @@ namespace Platform {
/**
* CHIP log output functions.
*/
void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
struct timeval tv;

Expand Down
6 changes: 3 additions & 3 deletions src/platform/NuttX/Logging.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* See Project CHIP LICENSE file for licensing information. */

#include <platform/logging/LogV.h>

#include <lib/core/CHIPConfig.h>
#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/Constants.h>
#include <platform/logging/LogV.h>

#include <cinttypes>
#include <cstdio>
Expand Down Expand Up @@ -35,7 +35,7 @@ namespace Platform {
/**
* CHIP log output functions.
*/
void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
struct timeval tv;

Expand Down
6 changes: 3 additions & 3 deletions src/platform/Tizen/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
* limitations under the License.
*/

#include <platform/logging/LogV.h>

#include <cstdint>
#include <cstdio>

#include <dlog.h>

#include <lib/core/CHIPConfig.h>
#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/Constants.h>
#include <platform/logging/LogV.h>

namespace chip {
namespace Logging {
Expand All @@ -32,7 +32,7 @@ namespace Platform {
/**
* CHIP log output functions.
*/
void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
static constexpr char kLogTag[] = "CHIP";

Expand Down
3 changes: 1 addition & 2 deletions src/platform/Zephyr/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <platform/logging/LogV.h>

#include <lib/core/CHIPConfig.h>
#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/Constants.h>

#include <zephyr/kernel.h>
Expand Down Expand Up @@ -42,7 +41,7 @@ namespace Platform {
* CHIP log output function.
*/

void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE];
snprintfcb(formattedMsg, sizeof(formattedMsg), "[%s]", module);
Expand Down
6 changes: 3 additions & 3 deletions src/platform/logging/impl/android/Logging.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* See Project chip LICENSE file for licensing information. */

#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/Constants.h>
#include <platform/logging/LogV.h>

#include <lib/support/logging/Constants.h>

#include <android/log.h>

namespace chip {
namespace Logging {
namespace Platform {

void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
int priority = (category == kLogCategory_Error) ? ANDROID_LOG_ERROR : ANDROID_LOG_DEBUG;
__android_log_vprint(priority, module, msg, v);
Expand Down
6 changes: 3 additions & 3 deletions src/platform/logging/impl/stdio/Logging.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* See Project CHIP LICENSE file for licensing information. */

#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/Constants.h>
#include <platform/logging/LogV.h>

#include <lib/support/logging/Constants.h>

#include <stdio.h>

namespace chip {
namespace Logging {
namespace Platform {

void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
printf("CHIP:%s: ", module);
vprintf(msg, v);
Expand Down
6 changes: 3 additions & 3 deletions src/platform/logging/impl/stdio/darwin/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

#include <platform/logging/LogV.h>

#include <lib/core/CHIPConfig.h>
#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/Constants.h>
#include <platform/logging/LogV.h>
#include <pthread.h>
#include <stdio.h>
#include <sys/time.h>
Expand All @@ -28,7 +28,7 @@ namespace chip {
namespace Logging {
namespace Platform {

void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
timeval time;
gettimeofday(&time, nullptr);
Expand Down
10 changes: 5 additions & 5 deletions src/platform/mbed/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
* Logging implementation for Mbed platform
*/

#include <lib/core/CHIPConfig.h>
#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/CHIPLogging.h>
#include <lib/support/logging/Constants.h>
#include <platform/logging/LogV.h>

#include <stdio.h>
#include <string.h>

#include <lib/core/CHIPConfig.h>
#include <lib/support/logging/CHIPLogging.h>
#include <lib/support/logging/Constants.h>

#include "mbed-trace/mbed_trace.h"

#ifdef MBED_TRACE_FILTER_LENGTH
Expand Down Expand Up @@ -66,7 +66,7 @@ char logMsgBuffer[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE];
/**
* CHIP log output functions.
*/
void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
size_t prefixLen = 0;
snprintf(logMsgBuffer, sizeof(logMsgBuffer), "[%s]", module);
Expand Down
5 changes: 3 additions & 2 deletions src/platform/nxp/k32w/k32w0/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

#include <platform/logging/LogV.h>

#include <cstring>
#include <inttypes.h>

#include <lib/core/CHIPConfig.h>
#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/Constants.h>
#include <platform/CHIPDeviceConfig.h>
#include <src/lib/support/CodeUtils.h>

#include "fsl_debug_console.h"
#include <cstring>

#define K32W_LOG_MODULE_NAME chip
#define EOL_CHARS "\r\n" /* End of Line Characters */
Expand Down Expand Up @@ -128,7 +129,7 @@ namespace Platform {
/**
* CHIP log output function.
*/
void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
(void) module;
(void) category;
Expand Down
2 changes: 1 addition & 1 deletion src/platform/nxp/k32w/k32w1/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace Platform {
/**
* CHIP log output function.
*/
void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
(void) module;
(void) category;
Expand Down
6 changes: 3 additions & 3 deletions src/platform/openiotsdk/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
* for Open IOT SDK platform.
*/

#include <platform/logging/LogV.h>

#include <lib/core/CHIPConfig.h>
#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/CHIPLogging.h>
#include <lib/support/logging/Constants.h>
#include <platform/logging/LogV.h>

#include <stdio.h>
#include <string.h>
Expand All @@ -50,7 +50,7 @@ namespace Platform {
/**
* CHIP log output functions.
*/
void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
char logMsgBuffer[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE];

Expand Down
3 changes: 1 addition & 2 deletions src/platform/qpg/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include <lib/core/CHIPConfig.h>
#include <lib/support/CHIPPlatformMemory.h>
#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/Constants.h>
#include <platform/CHIPDeviceConfig.h>
#include <system/SystemClock.h>
Expand Down Expand Up @@ -67,7 +66,7 @@ static size_t AddTimeStampAndPrefixStr(char * logBuffer, const char * prefix, si
* CHIP log output function.
*/

void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE];
size_t formattedMsgLen;
Expand Down
6 changes: 3 additions & 3 deletions src/platform/webos/Logging.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* See Project CHIP LICENSE file for licensing information. */

#include <lib/support/EnforceFormat.h>
#include <lib/support/logging/Constants.h>
#include <platform/logging/LogV.h>

#include <cinttypes>
Expand All @@ -10,6 +8,8 @@
#include <sys/time.h>
#include <unistd.h>

#include <lib/support/logging/Constants.h>

#ifdef USE_SYSLOG
#include <syslog.h>
#endif
Expand All @@ -33,7 +33,7 @@ namespace Platform {
/**
* CHIP log output functions.
*/
void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char * msg, va_list v)
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
struct timeval tv;

Expand Down

0 comments on commit 97e3e3e

Please sign in to comment.