Skip to content

Commit

Permalink
Remove compiler warning when U_CX_PORT_PRINTF is defined as nothing.
Browse files Browse the repository at this point in the history
When using uxclient with ubxlib we define U_CX_AT_CONFIG_FILE in order to use our own configuration file. When ubxlib is configured to have no logging at compile-time, so U_CX_PORT_PRINTF is defined to be empty, we get a compiler warning from uCxLogPrintTime() because the stack variables in that function are no longer used. This PR makes the whole of the body of uCxLogPrintTime() conditional on U_CX_PORT_PRINTF being defined in order to remove the warning.
  • Loading branch information
RobMeades authored and antevir committed Mar 24, 2024
1 parent 4e8d9c7 commit 508768f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/u_cx_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ static bool gUCxLogEnabled = true;

void uCxLogPrintTime(void)
{
#if U_CX_PORT_PRINTF
int32_t timestamp_ms = U_CX_PORT_GET_TIME_MS();
int32_t ms = (int32_t) (timestamp_ms % 1000);
int32_t seconds = (int32_t) (timestamp_ms / 1000) % 60 ;
int32_t minutes = (int32_t) ((timestamp_ms / (1000 * 60)) % 60);
int32_t hours = (int32_t) ((timestamp_ms / (1000 * 60 * 60)));
U_CX_PORT_PRINTF("[%02" PRId32 ":%02" PRId32 ":%02" PRId32 ".%03" PRId32"]",
hours, minutes, seconds, ms);
#endif
}

void uCxLogDisable(void)
Expand Down

0 comments on commit 508768f

Please sign in to comment.