mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-27 18:24:27 +01:00
Clean up int conversion warnings in core Unity using a 32-bit build
To expose warnings use -Wconversion -m32, and *not* -D UNITY_SUPPORT_64 In 32-bit mode, the variable and parameter are the same width, so sign conversion is implicit. In 64-bit, implicit conversion is clean.
This commit is contained in:
18
src/unity.c
18
src/unity.c
@@ -551,7 +551,7 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
|
|||||||
{
|
{
|
||||||
UnityTestResultsFailBegin(lineNumber);
|
UnityTestResultsFailBegin(lineNumber);
|
||||||
UnityPrint(UnityStrElement);
|
UnityPrint(UnityStrElement);
|
||||||
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
||||||
UnityPrint(UnityStrExpected);
|
UnityPrint(UnityStrExpected);
|
||||||
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_exp, style);
|
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_exp, style);
|
||||||
UnityPrint(UnityStrWas);
|
UnityPrint(UnityStrWas);
|
||||||
@@ -572,7 +572,7 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
|
|||||||
{
|
{
|
||||||
UnityTestResultsFailBegin(lineNumber);
|
UnityTestResultsFailBegin(lineNumber);
|
||||||
UnityPrint(UnityStrElement);
|
UnityPrint(UnityStrElement);
|
||||||
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
||||||
UnityPrint(UnityStrExpected);
|
UnityPrint(UnityStrExpected);
|
||||||
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp, style);
|
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp, style);
|
||||||
UnityPrint(UnityStrWas);
|
UnityPrint(UnityStrWas);
|
||||||
@@ -594,7 +594,7 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
|
|||||||
{
|
{
|
||||||
UnityTestResultsFailBegin(lineNumber);
|
UnityTestResultsFailBegin(lineNumber);
|
||||||
UnityPrint(UnityStrElement);
|
UnityPrint(UnityStrElement);
|
||||||
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
||||||
UnityPrint(UnityStrExpected);
|
UnityPrint(UnityStrExpected);
|
||||||
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp, style);
|
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp, style);
|
||||||
UnityPrint(UnityStrWas);
|
UnityPrint(UnityStrWas);
|
||||||
@@ -614,7 +614,7 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
|
|||||||
{
|
{
|
||||||
UnityTestResultsFailBegin(lineNumber);
|
UnityTestResultsFailBegin(lineNumber);
|
||||||
UnityPrint(UnityStrElement);
|
UnityPrint(UnityStrElement);
|
||||||
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
||||||
UnityPrint(UnityStrExpected);
|
UnityPrint(UnityStrExpected);
|
||||||
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp, style);
|
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp, style);
|
||||||
UnityPrint(UnityStrWas);
|
UnityPrint(UnityStrWas);
|
||||||
@@ -669,7 +669,7 @@ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,
|
|||||||
{
|
{
|
||||||
UnityTestResultsFailBegin(lineNumber);
|
UnityTestResultsFailBegin(lineNumber);
|
||||||
UnityPrint(UnityStrElement);
|
UnityPrint(UnityStrElement);
|
||||||
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
||||||
#ifdef UNITY_FLOAT_VERBOSE
|
#ifdef UNITY_FLOAT_VERBOSE
|
||||||
UnityPrint(UnityStrExpected);
|
UnityPrint(UnityStrExpected);
|
||||||
UnityPrintFloat(*ptr_expected);
|
UnityPrintFloat(*ptr_expected);
|
||||||
@@ -831,7 +831,7 @@ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,
|
|||||||
{
|
{
|
||||||
UnityTestResultsFailBegin(lineNumber);
|
UnityTestResultsFailBegin(lineNumber);
|
||||||
UnityPrint(UnityStrElement);
|
UnityPrint(UnityStrElement);
|
||||||
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
||||||
#ifdef UNITY_DOUBLE_VERBOSE
|
#ifdef UNITY_DOUBLE_VERBOSE
|
||||||
UnityPrint(UnityStrExpected);
|
UnityPrint(UnityStrExpected);
|
||||||
UnityPrintFloat((float)(*ptr_expected));
|
UnityPrintFloat((float)(*ptr_expected));
|
||||||
@@ -1125,7 +1125,7 @@ void UnityAssertEqualStringArray( const char** expected,
|
|||||||
if (num_elements > 1)
|
if (num_elements > 1)
|
||||||
{
|
{
|
||||||
UnityPrint(UnityStrElement);
|
UnityPrint(UnityStrElement);
|
||||||
UnityPrintNumberByStyle((j), UNITY_DISPLAY_STYLE_UINT);
|
UnityPrintNumberUnsigned(j);
|
||||||
}
|
}
|
||||||
UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));
|
UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));
|
||||||
UnityAddMsgIfSpecified(msg);
|
UnityAddMsgIfSpecified(msg);
|
||||||
@@ -1173,10 +1173,10 @@ void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
|
|||||||
if (num_elements > 1)
|
if (num_elements > 1)
|
||||||
{
|
{
|
||||||
UnityPrint(UnityStrElement);
|
UnityPrint(UnityStrElement);
|
||||||
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
||||||
}
|
}
|
||||||
UnityPrint(UnityStrByte);
|
UnityPrint(UnityStrByte);
|
||||||
UnityPrintNumberByStyle((length - bytes - 1), UNITY_DISPLAY_STYLE_UINT);
|
UnityPrintNumberUnsigned(length - bytes - 1);
|
||||||
UnityPrint(UnityStrExpected);
|
UnityPrint(UnityStrExpected);
|
||||||
UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
|
UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
|
||||||
UnityPrint(UnityStrWas);
|
UnityPrint(UnityStrWas);
|
||||||
|
|||||||
Reference in New Issue
Block a user