Skip to content

Commit 1638627

Browse files
committed
Fix -Wextra-semi-stmt error with proper macro hygiene
"empty expression statement has no effect; remove unnecessary ';'" These macros were not properly wrapped
1 parent 442a060 commit 1638627

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

test/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ E = -Weverything
1313
CFLAGS += $E -Wno-unknown-warning-option -Wno-missing-prototypes
1414
CFLAGS += -Wno-unused-macros -Wno-padded -Wno-missing-noreturn
1515
CFLAGS += -Wno-unsafe-buffer-usage -Wno-reserved-identifier
16-
CFLAGS += -Wno-extra-semi-stmt
1716
endif
1817
CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror
1918
#CFLAGS += -Wconversion #disabled because if falsely complains about the isinf and isnan macros

test/tests/self_assessment_utils.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,19 +133,19 @@ void flushSpy(void)
133133
if (flushSpyEnabled){ flushSpyCalls++; }
134134
}
135135

136-
#define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) { \
136+
#define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) do { \
137137
startPutcharSpy(); UnityPrintNumber((actual)); endPutcharSpy(); \
138138
TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \
139-
}
139+
} while (0)
140140

141-
#define TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS(expected, actual) { \
141+
#define TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS(expected, actual) do { \
142142
startPutcharSpy(); UnityPrintNumberUnsigned((actual)); endPutcharSpy(); \
143143
TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \
144-
}
144+
} while (0)
145145

146-
#define TEST_ASSERT_EQUAL_PRINT_FLOATING(expected, actual) { \
146+
#define TEST_ASSERT_EQUAL_PRINT_FLOATING(expected, actual) do { \
147147
startPutcharSpy(); UnityPrintFloat((actual)); endPutcharSpy(); \
148148
TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \
149-
}
149+
} while (0)
150150

151151
#endif

0 commit comments

Comments
 (0)