From 8ecdd89c69171d4cb2fdc7fa9ebd47ba18b49009 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Wed, 2 Sep 2026 07:36:56 -0700 Subject: [PATCH] Remove obsolete IBM VisualAge / XL C++ workarounds in googletest Classic IBM XL C/C++ (__IBMCPP__) only supported up to C++14 (V16.1 for AIX) before IBM retired the proprietary frontend and transitioned to IBM Open XL C/C++ (which is Clang-based and defines __clang__). Since the legacy XL frontend never supported C++17, the workarounds are obsolete and should be removed. PiperOrigin-RevId: 975123206 Change-Id: Ia706c7759d3f1df73d375fca68f91eee3aaef825 --- googletest/cmake/internal_utils.cmake | 10 ---------- googletest/include/gtest/internal/gtest-port.h | 15 +-------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index 729e91a5..5bcef779 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -119,16 +119,6 @@ macro(config_compiler_and_linker) set(cxx_no_rtti_flags "-fno-rtti") set(cxx_strict_flags "-Wextra -Wno-unused-parameter -Wno-missing-field-initializers") - - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "VisualAge" OR - CMAKE_CXX_COMPILER_ID STREQUAL "XL") - # CMake 2.8 changes Visual Age's compiler ID to "XL". - set(cxx_exception_flags "-qeh") - set(cxx_no_exception_flags "-qnoeh") - # Until version 9.0, Visual Age doesn't define a macro to indicate - # whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI - # explicitly. - set(cxx_no_rtti_flags "-qnortti -DGTEST_HAS_RTTI=0") endif() # The pthreads library is available and allowed? diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index dc502566..154be3c1 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -465,9 +465,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #elif defined(__GNUC__) && defined(__EXCEPTIONS) && __EXCEPTIONS // gcc defines __EXCEPTIONS to 1 if and only if exceptions are enabled. #define GTEST_HAS_EXCEPTIONS 1 -#elif defined(__IBMCPP__) && defined(__EXCEPTIONS) && __EXCEPTIONS -// xlC defines __EXCEPTIONS to 1 if and only if exceptions are enabled. -#define GTEST_HAS_EXCEPTIONS 1 #else // For other compilers, we assume exceptions are disabled to be // conservative. @@ -596,16 +593,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #define GTEST_HAS_RTTI __has_feature(cxx_rtti) -// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if -// both the typeid and dynamic_cast features are present. -#elif defined(__IBMCPP__) && (__IBMCPP__ >= 900) - -#ifdef __RTTI_ALL__ -#define GTEST_HAS_RTTI 1 -#else -#define GTEST_HAS_RTTI 0 -#endif - #else // For all other compilers, we assume RTTI is enabled. @@ -727,7 +714,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // Typed tests need and variadic macros, which GCC, VC++ 8.0, // Sun Pro CC, IBM Visual Age, and HP aCC support. -#if defined(__GNUC__) || defined(_MSC_VER) || defined(__IBMCPP__) +#if defined(__GNUC__) || defined(_MSC_VER) #define GTEST_HAS_TYPED_TEST 1 #define GTEST_HAS_TYPED_TEST_P 1 #endif