adamgreen/CrashCatcher

Failed to build CppUTest in CrashCatcher

TibaChang opened this issue · 6 comments

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

Should be fixed now.

Thanks for reporting.

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

Try changing that line to
m_faultStatusRegistersStart + 5 * (uint32_t)sizeof(uint32_t),

The error is fixed by your advice.
Thanks!

If you issue a PR then I will merge it.

PR accepted and merged. Thanks!