From 02434dcc1ff887b475379bad23015d856eb6576d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 18 Apr 2022 14:36:52 +0200 Subject: [PATCH] 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. --- tests/misc/dynamiclib.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/misc/dynamiclib.cpp b/tests/misc/dynamiclib.cpp index b6b1ad1099..00f88a1136 100644 --- a/tests/misc/dynamiclib.cpp +++ b/tests/misc/dynamiclib.cpp @@ -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__ }