1
0
mirror of https://github.com/ThrowTheSwitch/Unity synced 2025-03-12 16:11:12 -04: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:
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
void UnityPrintFloat(_UF number)
void UnityPrintFloat(_UD number)
{
char TempBuffer[UNITY_VERBOSE_NUMBER_MAX_LENGTH + 1];
snprintf(TempBuffer, sizeof(TempBuffer), "%.6f", number);

View File

@ -251,32 +251,38 @@ typedef UNITY_FLOAT_TYPE _UF;
/* unlike FLOAT, we DON'T include by default */
#ifndef UNITY_EXCLUDE_DOUBLE
#ifndef UNITY_INCLUDE_DOUBLE
#define UNITY_EXCLUDE_DOUBLE
#endif
#ifndef UNITY_INCLUDE_DOUBLE
#define UNITY_EXCLUDE_DOUBLE
#endif
#endif
#ifdef UNITY_EXCLUDE_DOUBLE
/* No Floating Point Support */
#undef UNITY_DOUBLE_PRECISION
#undef UNITY_DOUBLE_TYPE
#undef UNITY_DOUBLE_VERBOSE
/* No Floating Point Support */
#undef UNITY_DOUBLE_PRECISION
#undef UNITY_DOUBLE_TYPE
#undef UNITY_DOUBLE_VERBOSE
#ifdef UNITY_INCLUDE_DOUBLE
#undef UNITY_INCLUDE_DOUBLE
#endif
#ifdef UNITY_INCLUDE_DOUBLE
#undef UNITY_INCLUDE_DOUBLE
#endif
#ifdef UNITY_FLOAT_VERBOSE
typedef _UF _UD;
/* For parameter in UnityPrintFloat, double promotion required */
#endif
#else
/* Double Floating Point Support */
#ifndef UNITY_DOUBLE_PRECISION
#define UNITY_DOUBLE_PRECISION (1e-12f)
#endif
#ifndef UNITY_DOUBLE_TYPE
#define UNITY_DOUBLE_TYPE double
#endif
typedef UNITY_DOUBLE_TYPE _UD;
/* Double Floating Point Support */
#ifndef UNITY_DOUBLE_PRECISION
#define UNITY_DOUBLE_PRECISION (1e-12f)
#endif
#ifndef UNITY_DOUBLE_TYPE
#define UNITY_DOUBLE_TYPE double
#endif
typedef UNITY_DOUBLE_TYPE _UD;
#endif
@ -484,7 +490,7 @@ void UnityPrintNumberUnsigned(const _U_UINT number);
void UnityPrintNumberHex(const _U_UINT number, const char nibbles);
#ifdef UNITY_FLOAT_VERBOSE
void UnityPrintFloat(const _UF number);
void UnityPrintFloat(const _UD number);
#endif
/*-------------------------------------------------------