Workaround a crash with MSYS2 gcc 9.1 again

The changes of 2144ca38d2 (Get rid of CppUnit boilerplate in
DynamicLibraryTestCase, 2022-04-17) accidentally undid the workaround
from 054cb35b39 (Workaround for a crash with gcc 9.1 from MSYS2 MinGW
32bit, 2019-08-03), so work around the same problem again by avoiding
using CHECK() with function pointers.
This commit is contained in:
Vadim Zeitlin
2022-04-18 14:36:52 +02:00
parent 61e24f6be0
commit 02434dcc1f

View File

@@ -59,14 +59,15 @@ TEST_CASE("DynamicLibrary::Load", "[dynlib]")
typedef int (wxSTDCALL *wxStrlenType)(const char *);
wxStrlenType pfnStrlen = (wxStrlenType)lib.GetSymbol(FUNC_NAME);
INFO("'" << FUNC_NAME << "' wasn't found in '" << LIB_NAME << "'");
CHECK( pfnStrlen );
if ( pfnStrlen )
{
// Call the function dynamically loaded
CHECK( pfnStrlen("foo") == 3 );
}
else
{
FAIL(FUNC_NAME << " wasn't found in " << LIB_NAME);
}
}
#ifdef __WINDOWS__
@@ -78,10 +79,14 @@ TEST_CASE("DynamicLibrary::Load", "[dynlib]")
wxStrlenTypeAorW
pfnStrlenAorW = (wxStrlenTypeAorW)lib.GetSymbolAorW(FUNC_NAME_AW);
INFO( "'" << FUNC_NAME_AW << "' wasn't found in '" << LIB_NAME << "'");
REQUIRE( pfnStrlenAorW );
CHECK( pfnStrlenAorW(wxT("foobar")) == 6 );
if ( pfnStrlenAorW )
{
CHECK( pfnStrlenAorW(wxT("foobar")) == 6 );
}
else
{
FAIL(FUNC_NAME_AW << " wasn't found in " << LIB_NAME);
}
}
#endif // __WINDOWS__
}