From 795088a131be84ae7ca0e64a661b49139a7ca370 Mon Sep 17 00:00:00 2001 From: Sympatron GmbH <35803463+Sympatron@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:35:34 +0100 Subject: [PATCH 1/2] Fix unused args errors in release builds --- src/logger.c | 3 +++ src/utils.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/logger.c b/src/logger.c index 2eb48e8..f7864f9 100644 --- a/src/logger.c +++ b/src/logger.c @@ -70,6 +70,9 @@ static inline void logger_log_set_color(logger_t *ctx, const char *color) assert(ret == len); ARG_UNUSED(ret); /* squash warning in Release builds */ } +#else + ARG_UNUSED(ctx); + ARG_UNUSED(color); #endif } diff --git a/src/utils.c b/src/utils.c index dc103ac..827834d 100644 --- a/src/utils.c +++ b/src/utils.c @@ -162,12 +162,15 @@ struct timezone { int gettimeofday(struct timeval * tp, struct timezone * tzp) { + ARG_UNUSED(tzp); tp->tv_sec = 0; tp->tv_usec = 0; return 0; } int add_iso8601_utc_datetime(char* buf, size_t size) { + ARG_UNUSED(buf); + ARG_UNUSED(size); return 0; } From 83860683b2807590ab0d9a5693e7aab10862f707 Mon Sep 17 00:00:00 2001 From: Sympatron GmbH <35803463+Sympatron@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:35:42 +0100 Subject: [PATCH 2/2] Only define timeval and timezone for __BARE_METAL__ targets if they are not already defined --- src/utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils.c b/src/utils.c index 827834d..cae87ab 100644 --- a/src/utils.c +++ b/src/utils.c @@ -150,15 +150,19 @@ int add_iso8601_utc_datetime(char *buf, size_t size) #elif defined(__BARE_METAL__) +#ifndef _TIMEVAL_DEFINED struct timeval { long tv_sec; // seconds since epoch long tv_usec; // microseconds }; +#endif +#ifndef _TIMEZONE_DEFINED struct timezone { int tz_minuteswest; // minutes west of UTC int tz_dsttime; // daylight saving time flag }; +#endif int gettimeofday(struct timeval * tp, struct timezone * tzp) {