1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-24 17:01:35 +01:00

unity: fix Wswitch-enum warning

Compiling a source base / test with Wswitch-enum enabled, gives
the following warning:

../src/unity.c: In function ‘UnityAssertFloatSpecial’:
../src/unity.c:1092:5: warning: enumeration value ‘UNITY_FLOAT_INVALID_TRAIT’ not handled in switch [-Wswitch-enum]
 1092 |     switch (style)
      |     ^~~~~~

Fix by adding the missing value to the default (unhandled) case.

Signed-off-by: André Draszik <git@andred.net>
This commit is contained in:
André Draszik
2020-05-25 07:48:16 +01:00
parent f5ff3504b5
commit 9760c4f14f

View File

@@ -1001,6 +1001,7 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
is_trait = !isinf(actual) && !isnan(actual);
break;
case UNITY_FLOAT_INVALID_TRAIT:
default:
trait_index = 0;
trait_names[0] = UnityStrInvalidFloatTrait;
@@ -1141,6 +1142,7 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
is_trait = !isinf(actual) && !isnan(actual);
break;
case UNITY_FLOAT_INVALID_TRAIT:
default:
trait_index = 0;
trait_names[0] = UnityStrInvalidFloatTrait;