mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-06-27 13:02:47 +08:00
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:
@ -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);
|
||||||
|
@ -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
|
||||||
|
|
||||||
/*-------------------------------------------------------
|
/*-------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user