Skip to content

Commit

Permalink
COMP: Avoid Superclass type alias GCC compile errors
Browse files Browse the repository at this point in the history
GCC is not resolving `object->Superclass` in some cases even though the
definition is available and other compilers are resolving the
definition.

xref #2676
  • Loading branch information
thewtex committed Sep 10, 2021
1 parent fa5b826 commit 230be6b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Modules/Core/TestKernel/include/itkTestingMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,22 @@ namespace itk
# define TEST_SET_GET_BOOLEAN ITK_TEST_SET_GET_BOOLEAN
#endif

// object's Class must be specified to build on sun studio
/* clang-format off */
#if defined(__GNUC__)
#define ITK_EXERCISE_BASIC_OBJECT_METHODS(object, ClassName, SuperclassName) \
object->Print(std::cout); \
std::cout << "Name of Class = " << object->GetNameOfClass() << std::endl; \
if (!std::strcmp(object->GetNameOfClass(), #ClassName)) \
{ \
std::cout << "Class name is correct" << std::endl; \
} \
else \
{ \
std::cerr << "Class name provided does not match object's NameOfClass" << std::endl; \
return EXIT_FAILURE; \
} \
ITK_MACROEND_NOOP_STATEMENT
#else // not GCC
#define ITK_EXERCISE_BASIC_OBJECT_METHODS(object, ClassName, SuperclassName) \
object->Print(std::cout); \
std::cout << "Name of Class = " << object->GetNameOfClass() << std::endl; \
Expand All @@ -86,6 +101,8 @@ namespace itk
return EXIT_FAILURE; \
} \
ITK_MACROEND_NOOP_STATEMENT
#endif // GCC
/* clang-format on */

#define ITK_TRY_EXPECT_EXCEPTION(command) \
try \
Expand Down

0 comments on commit 230be6b

Please sign in to comment.