Failed to build CppUTest in CrashCatcher
TibaChang opened this issue · 6 comments
TibaChang commented
Failed to build CppUTest in CrashCatcher
commands : make clean all
...
Compiling FloatMocks/tests/AllTests.cpp
Compiling FloatMocks/tests/FloatMocksTests.cpp
FloatMocks/tests/FloatMocksTests.cpp: In member function ‘virtual void TEST_FloatMocks_SetAllFloatingPointRegisters_ValidateCopyUsesThoseValues_Test::testBody()’:
FloatMocks/tests/FloatMocksTests.cpp:50:43: error: ‘memset’ was not declared in this scope
memset(floatRegs, 0, sizeof(floatRegs));
^
In file included from CppUTest/include/CppUTest/TestHarness.h:72:0,
from FloatMocks/tests/FloatMocksTests.cpp:24:
FloatMocks/tests/FloatMocksTests.cpp:52:75: error: ‘memcmp’ was not declared in this scope
CHECK_TRUE(0 == memcmp(testFloatRegs, floatRegs, sizeof(testFloatRegs)));
^
CppUTest/include/CppUTest/UtestMacros.h:93:43: note: in definition of macro ‘CHECK_LOCATION_TRUE’
{ UtestShell::getCurrent()->assertTrue((condition) != 0, checkString, conditionString, file, line); }
^
FloatMocks/tests/FloatMocksTests.cpp:52:5: note: in expansion of macro ‘CHECK_TRUE’
CHECK_TRUE(0 == memcmp(testFloatRegs, floatRegs, sizeof(testFloatRegs)));
^
FloatMocks/tests/FloatMocksTests.cpp: In member function ‘virtual void TEST_FloatMocks_SetUpperFloatingPointRegisters_ValidateCopyUsesThoseValues_Test::testBody()’:
FloatMocks/tests/FloatMocksTests.cpp:63:43: error: ‘memset’ was not declared in this scope
memset(floatRegs, 0, sizeof(floatRegs));
^
In file included from CppUTest/include/CppUTest/TestHarness.h:72:0,
from FloatMocks/tests/FloatMocksTests.cpp:24:
FloatMocks/tests/FloatMocksTests.cpp:65:75: error: ‘memcmp’ was not declared in this scope
CHECK_TRUE(0 == memcmp(testFloatRegs, floatRegs, sizeof(testFloatRegs)));
^
CppUTest/include/CppUTest/UtestMacros.h:93:43: note: in definition of macro ‘CHECK_LOCATION_TRUE’
{ UtestShell::getCurrent()->assertTrue((condition) != 0, checkString, conditionString, file, line); }
^
FloatMocks/tests/FloatMocksTests.cpp:65:5: note: in expansion of macro ‘CHECK_TRUE’
CHECK_TRUE(0 == memcmp(testFloatRegs, floatRegs, sizeof(testFloatRegs)));
^
makefile:336: recipe for target 'obj/host/FloatMocks/tests/FloatMocksTests.o' failed
make: *** [obj/host/FloatMocks/tests/FloatMocksTests.o] Error 1
adamgreen commented
Should be fixed now.
Thanks for reporting.
TibaChang commented
New error(-Werror=narrowing) happened.
Compiling Core/tests/AllTests.cpp
Compiling Core/tests/CrashCatcherTests.cpp
Core/tests/CrashCatcherTests.cpp: In member function ‘virtual void TEST_CrashCatcher_DumpOneWordRegion_EmulateCortexM3_ShouldAppendFaultStatusRegisters_Test::testBody()’:
Core/tests/CrashCatcherTests.cpp:338:82: error: narrowing conversion of ‘(((long unsigned int)((TEST_CrashCatcher_DumpOneWordRegion_EmulateCortexM3_ShouldAppendFaultStatusRegisters_Test*)this)->TEST_CrashCatcher_DumpOneWordRegion_EmulateCortexM3_ShouldAppendFaultStatusRegisters_Test::<anonymous>.TEST_GROUP_CppUTestGroupCrashCatcher::m_faultStatusRegistersStart) + (sizeof (uint32_t) * 5ul))’ from ‘long unsigned int’ to ‘uint32_t {aka unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
m_faultStatusRegistersStart + 5 * sizeof(uint32_t),
^
cc1plus: all warnings being treated as errors
makefile:336: recipe for target 'obj/host/Core/tests/CrashCatcherTests.o' failed
make: *** [obj/host/Core/tests/CrashCatcherTests.o] Error 1
Thanks
adamgreen commented
Try changing that line to
m_faultStatusRegistersStart + 5 * (uint32_t)sizeof(uint32_t),
TibaChang commented
The error is fixed by your advice.
Thanks!
adamgreen commented
If you issue a PR then I will merge it.
adamgreen commented
PR accepted and merged. Thanks!