Closed MacDada closed 10 months ago
I encountered the same issue. A workaround that I used was to use macros to use unity's definitions for isnan and isinf when unit testing, then use the std::isinf and std::isnan otherwise.
#ifdef UNIT_TESTING
#define _ISNAN(x) isnan(x)
#define _ISINF(x) isinf(x)
#else
#define _ISNAN(x) std::isnan(x)
#define _ISINF(x) std::isinf(x)
#endif // UNIT_TESTING
I am unsure what the implications of this workaround are, but at least it allows for the use of unity without modifying it.
I just hit the same issue with Apple's default toolchain. The workaround above didn't work for me, but I was able to find another one. I added a custom unity config.h with #define UNITY_EXCLUDE_FLOAT
in it. This only works for me because I don't use floating point math in unity itself, but it'll have to do for now.
I encountered a similar issue when evaluating Au, which defines an isnan
template function. I think this macro should be renamed to UNITY_ISNAN
or similar, isnan
is too generic.
Note: my workaround here was to add #undef isnan
to the top of the generated au.h file. In cmake:
add_custom_target(
au-rebuild
COMMAND echo \#undef isnan > ${CMAKE_CURRENT_SOURCE_DIR}/prebuilt/au-prebuilt.h
COMMAND ${PYTHON_EXE} tools/bin/make-single-file --noio --units ${UNITS} >> ${CMAKE_CURRENT_SOURCE_DIR}/prebuilt/au-prebuilt.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/au
)
Good point. I agree.
Thanks everyone. I believe the cutting edge has this fixed now.
Thank you! For anyone wondering, this was fixed in a1b1600e4361cdf98bdb57e7d32a1cafa6eb90bf and is included in v2.6.0 RC1.
Thanks @DavidSchinazi ! I should have included those details. Thanks for picking up the slack!
Hey, it's me with C++ again ;)
I've just changed the stock Apple's Clang into the "generic" Clang from Homebrew. Everything works but one thing – some of my unity tests stopped working.
If I go and remove the
isnan
macro fromunity_internals.h
. everything is starting to work again.The upgrade in my project.