From 15f5e2072dfbcba0502e86932a8165cd644882a8 Mon Sep 17 00:00:00 2001 From: Michael Dwan Date: Thu, 5 Sep 2024 19:00:57 -0700 Subject: [PATCH] unity_internals: Update UNITY_PRINT_EXEC_TIME for older clang, to fix Wextra-semi-stmt and Wsign-conversion errors. --- src/unity_internals.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unity_internals.h b/src/unity_internals.h index 192f7ffa..add46585 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -398,13 +398,13 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT; #define UNITY_GET_TIME(t) clock_gettime(CLOCK_MONOTONIC, &t) #define UNITY_EXEC_TIME_START() UNITY_GET_TIME(Unity.CurrentTestStartTime) #define UNITY_EXEC_TIME_STOP() UNITY_GET_TIME(Unity.CurrentTestStopTime) - #define UNITY_PRINT_EXEC_TIME() { \ - UNITY_UINT execTimeMs = ((Unity.CurrentTestStopTime.tv_sec - Unity.CurrentTestStartTime.tv_sec) * 1000L); \ - execTimeMs += ((Unity.CurrentTestStopTime.tv_nsec - Unity.CurrentTestStartTime.tv_nsec) / 1000000L); \ + #define UNITY_PRINT_EXEC_TIME() do { \ + UNITY_UINT execTimeMs = (UNITY_UINT)((Unity.CurrentTestStopTime.tv_sec - Unity.CurrentTestStartTime.tv_sec) * 1000L); \ + execTimeMs += (UNITY_UINT)((Unity.CurrentTestStopTime.tv_nsec - Unity.CurrentTestStartTime.tv_nsec) / 1000000L); \ UnityPrint(" ("); \ UnityPrintNumberUnsigned(execTimeMs); \ UnityPrint(" ms)"); \ - } + } while(0) #endif #endif #endif