Get rid of conversion warning when using UNITY_FLOAT_VERBOSE with doubles

Change the parameter of UnityPrintFloat from float to double (_UD)
 The call to snprintf uses implict default promotion to a double anyway
This commit is contained in:
jsalling
2016-08-27 15:34:10 -05:00
parent 54aa838c8a
commit 6d54ec2ff7
2 changed files with 26 additions and 20 deletions

View File

@ -257,7 +257,7 @@ void UnityPrintMask(const _U_UINT mask, const _U_UINT number)
# endif # endif
#endif #endif
void UnityPrintFloat(_UF number) void UnityPrintFloat(_UD number)
{ {
char TempBuffer[UNITY_VERBOSE_NUMBER_MAX_LENGTH + 1]; char TempBuffer[UNITY_VERBOSE_NUMBER_MAX_LENGTH + 1];
snprintf(TempBuffer, sizeof(TempBuffer), "%.6f", number); snprintf(TempBuffer, sizeof(TempBuffer), "%.6f", number);

View File

@ -267,12 +267,18 @@ typedef UNITY_FLOAT_TYPE _UF;
#undef UNITY_INCLUDE_DOUBLE #undef UNITY_INCLUDE_DOUBLE
#endif #endif
#ifdef UNITY_FLOAT_VERBOSE
typedef _UF _UD;
/* For parameter in UnityPrintFloat, double promotion required */
#endif
#else #else
/* Double Floating Point Support */ /* Double Floating Point Support */
#ifndef UNITY_DOUBLE_PRECISION #ifndef UNITY_DOUBLE_PRECISION
#define UNITY_DOUBLE_PRECISION (1e-12f) #define UNITY_DOUBLE_PRECISION (1e-12f)
#endif #endif
#ifndef UNITY_DOUBLE_TYPE #ifndef UNITY_DOUBLE_TYPE
#define UNITY_DOUBLE_TYPE double #define UNITY_DOUBLE_TYPE double
#endif #endif
@ -484,7 +490,7 @@ void UnityPrintNumberUnsigned(const _U_UINT number);
void UnityPrintNumberHex(const _U_UINT number, const char nibbles); void UnityPrintNumberHex(const _U_UINT number, const char nibbles);
#ifdef UNITY_FLOAT_VERBOSE #ifdef UNITY_FLOAT_VERBOSE
void UnityPrintFloat(const _UF number); void UnityPrintFloat(const _UD number);
#endif #endif
/*------------------------------------------------------- /*-------------------------------------------------------