From f5ff3504b50ca524e9b431ba45fd36ae2735fac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Draszik?= Date: Mon, 25 May 2020 07:14:14 +0100 Subject: [PATCH 1/2] auto/run_test: fix Wsign-compare warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compiling a source base / test with Wsign-compare enabled, gives the following warning: build/test/runners/test_system_runner.c: In function ‘run_test’: build/test/runners/test_system_runner.c:62:35: warning: conversion to ‘UNITY_UINT’ {aka ‘long unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion] 62 | Unity.CurrentTestLineNumber = line_num; | ^~~~~~~~ Fix by updating the type in the function declaration. Signed-off-by: André Draszik --- auto/run_test.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auto/run_test.erb b/auto/run_test.erb index cb7f2b5..f91b566 100644 --- a/auto/run_test.erb +++ b/auto/run_test.erb @@ -1,5 +1,5 @@ /*=======Test Runner Used To Run Each Test=====*/ -static void run_test(UnityTestFunction func, const char* name, int line_num) +static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num) { Unity.CurrentTestName = name; Unity.CurrentTestLineNumber = line_num; From 9760c4f14fdf4b0089991cccc30b414c12480a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Draszik?= Date: Mon, 25 May 2020 07:48:16 +0100 Subject: [PATCH 2/2] unity: fix Wswitch-enum warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/unity.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/unity.c b/src/unity.c index ffa5cf0..be6eaf7 100644 --- a/src/unity.c +++ b/src/unity.c @@ -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;