From 1638627cb5ac3c24c9840ea837c9115119158a02 Mon Sep 17 00:00:00 2001 From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> Date: Wed, 2 Jul 2025 21:12:40 -0400 Subject: [PATCH] Fix -Wextra-semi-stmt error with proper macro hygiene "empty expression statement has no effect; remove unnecessary ';'" These macros were not properly wrapped --- test/Makefile | 1 - test/tests/self_assessment_utils.h | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/test/Makefile b/test/Makefile index 532cc40..2275e3b 100644 --- a/test/Makefile +++ b/test/Makefile @@ -13,7 +13,6 @@ E = -Weverything CFLAGS += $E -Wno-unknown-warning-option -Wno-missing-prototypes CFLAGS += -Wno-unused-macros -Wno-padded -Wno-missing-noreturn CFLAGS += -Wno-unsafe-buffer-usage -Wno-reserved-identifier -CFLAGS += -Wno-extra-semi-stmt endif CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror #CFLAGS += -Wconversion #disabled because if falsely complains about the isinf and isnan macros diff --git a/test/tests/self_assessment_utils.h b/test/tests/self_assessment_utils.h index 6051bda..f764ca9 100644 --- a/test/tests/self_assessment_utils.h +++ b/test/tests/self_assessment_utils.h @@ -133,19 +133,19 @@ void flushSpy(void) if (flushSpyEnabled){ flushSpyCalls++; } } -#define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) { \ +#define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) do { \ startPutcharSpy(); UnityPrintNumber((actual)); endPutcharSpy(); \ TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \ - } + } while (0) -#define TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS(expected, actual) { \ +#define TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS(expected, actual) do { \ startPutcharSpy(); UnityPrintNumberUnsigned((actual)); endPutcharSpy(); \ TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \ - } + } while (0) -#define TEST_ASSERT_EQUAL_PRINT_FLOATING(expected, actual) { \ +#define TEST_ASSERT_EQUAL_PRINT_FLOATING(expected, actual) do { \ startPutcharSpy(); UnityPrintFloat((actual)); endPutcharSpy(); \ TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \ - } + } while (0) #endif