1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 08:25:58 +01:00

Fix Wmissing-noreturn errors

This commit is contained in:
Ross Smyth
2025-07-02 21:34:02 -04:00
parent 8bac36463d
commit faaaaa4fca
3 changed files with 14 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ endif
ifeq ($(findstring clang, $(CC)), clang) ifeq ($(findstring clang, $(CC)), clang)
E = -Weverything E = -Weverything
CFLAGS += $E -Wno-unknown-warning-option -Wno-missing-prototypes CFLAGS += $E -Wno-unknown-warning-option -Wno-missing-prototypes
CFLAGS += -Wno-unused-macros -Wno-padded -Wno-missing-noreturn CFLAGS += -Wno-unused-macros -Wno-padded
CFLAGS += -Wno-unsafe-buffer-usage CFLAGS += -Wno-unsafe-buffer-usage
endif endif
CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror

View File

@@ -92,19 +92,19 @@ void testUnitySizeInitializationReminder(void)
TEST_ASSERT_EQUAL_MESSAGE(sizeof(Expected_Unity), sizeof(Unity), message); TEST_ASSERT_EQUAL_MESSAGE(sizeof(Expected_Unity), sizeof(Unity), message);
} }
void testPassShouldEndImmediatelyWithPass(void) UNITY_FUNCTION_ATTR(noreturn) void testPassShouldEndImmediatelyWithPass(void)
{ {
TEST_PASS(); TEST_PASS();
TEST_FAIL_MESSAGE("We should have passed already and finished this test"); TEST_FAIL_MESSAGE("We should have passed already and finished this test");
} }
void testPassShouldEndImmediatelyWithPassAndMessage(void) UNITY_FUNCTION_ATTR(noreturn) void testPassShouldEndImmediatelyWithPassAndMessage(void)
{ {
TEST_PASS_MESSAGE("Woohoo! This Automatically Passes!"); TEST_PASS_MESSAGE("Woohoo! This Automatically Passes!");
TEST_FAIL_MESSAGE("We should have passed already and finished this test"); TEST_FAIL_MESSAGE("We should have passed already and finished this test");
} }
void testMessageShouldDisplayMessageWithoutEndingAndGoOnToPass(void) UNITY_FUNCTION_ATTR(noreturn) void testMessageShouldDisplayMessageWithoutEndingAndGoOnToPass(void)
{ {
TEST_MESSAGE("This is just a message"); TEST_MESSAGE("This is just a message");
TEST_MESSAGE("This is another message"); TEST_MESSAGE("This is another message");
@@ -282,7 +282,7 @@ void testProtection(void)
TEST_ASSERT_EQUAL(3, mask); TEST_ASSERT_EQUAL(3, mask);
} }
void testIgnoredAndThenFailInTearDown(void) UNITY_FUNCTION_ATTR(noreturn) void testIgnoredAndThenFailInTearDown(void)
{ {
SetToOneToFailInTearDown = 1; SetToOneToFailInTearDown = 1;
TEST_IGNORE(); TEST_IGNORE();

View File

@@ -1208,6 +1208,9 @@ void testNotEqualFloatEachEqualLengthZero(void)
#endif #endif
} }
#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_INCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY)
UNITY_FUNCTION_ATTR(noreturn)
#endif
void testFloatPrinting(void) void testFloatPrinting(void)
{ {
#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_INCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY) #if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_INCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY)
@@ -1257,6 +1260,9 @@ void testFloatPrinting(void)
#endif #endif
} }
#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_INCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY)
UNITY_FUNCTION_ATTR(noreturn)
#endif
void testFloatPrintingRoundTiesToEven(void) void testFloatPrintingRoundTiesToEven(void)
{ {
#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_INCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY) #if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_INCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY)
@@ -1368,6 +1374,9 @@ static void printFloatValue(float f)
#endif #endif
#endif #endif
#if !defined(UNITY_TEST_ALL_FLOATS_PRINT_OK) || !defined(USING_OUTPUT_SPY)
UNITY_FUNCTION_ATTR(noreturn)
#endif
void testFloatPrintingRandomSamples(void) void testFloatPrintingRandomSamples(void)
{ {
#if !defined(UNITY_TEST_ALL_FLOATS_PRINT_OK) || !defined(USING_OUTPUT_SPY) #if !defined(UNITY_TEST_ALL_FLOATS_PRINT_OK) || !defined(USING_OUTPUT_SPY)