提交 6d54ec2f 编写于 作者: J jsalling

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
上级 54aa838c
......@@ -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);
......
......@@ -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
/*-------------------------------------------------------
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册