From defb708946357d02bdd0831999200d66f949c89b Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 1 Sep 2026 14:12:59 -0700 Subject: [PATCH] Remove obsolete HP aC++ workarounds in googletest HP aC++ for HP-UX on Itanium (A.06.28) only supported up to C++03 and partial C++11 before HPE placed HP-UX and Itanium into maintenance mode. It was discontinued without ever supporting C++14 or C++17. As GoogleTest requires C++17, the HP-specific workarounds are obsolete and should be removed. PiperOrigin-RevId: 974700202 Change-Id: Iff9a41101f90f65d76394752bf197b8f2e97311f --- googletest/cmake/internal_utils.cmake | 6 ------ googletest/include/gtest/internal/gtest-port.h | 6 +----- googletest/include/gtest/internal/gtest-type-util.h | 8 ++------ googletest/test/gtest_unittest.cc | 6 +++--- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index 3ead0892..51dfda2a 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -134,12 +134,6 @@ macro(config_compiler_and_linker) # whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI # explicitly. set(cxx_no_rtti_flags "-qnortti -DGTEST_HAS_RTTI=0") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "HP") - set(cxx_base_flags "-AA -mt") - set(cxx_exception_flags "-DGTEST_HAS_EXCEPTIONS=1") - set(cxx_no_exception_flags "+noeh -DGTEST_HAS_EXCEPTIONS=0") - # RTTI can not be disabled in HP aCC compiler. - set(cxx_no_rtti_flags "") 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 249bfb75..5d35f672 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -481,10 +481,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #elif defined(__IBMCPP__) && defined(__EXCEPTIONS) && __EXCEPTIONS // xlC defines __EXCEPTIONS to 1 if and only if exceptions are enabled. #define GTEST_HAS_EXCEPTIONS 1 -#elif defined(__HP_aCC) -// Exception handling is in effect by default in HP aCC compiler. It has to -// be turned of by +noeh compiler option if desired. -#define GTEST_HAS_EXCEPTIONS 1 #else // For other compilers, we assume exceptions are disabled to be // conservative. @@ -745,7 +741,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(__SUNPRO_CC) || \ - defined(__IBMCPP__) || defined(__HP_aCC) + defined(__IBMCPP__) #define GTEST_HAS_TYPED_TEST 1 #define GTEST_HAS_TYPED_TEST_P 1 #endif diff --git a/googletest/include/gtest/internal/gtest-type-util.h b/googletest/include/gtest/internal/gtest-type-util.h index 78da0531..fb4d6823 100644 --- a/googletest/include/gtest/internal/gtest-type-util.h +++ b/googletest/include/gtest/internal/gtest-type-util.h @@ -47,8 +47,6 @@ // libstdc++ (which is where cxxabi.h comes from). #if GTEST_HAS_CXXABI_H_ #include -#elif defined(__HP_aCC) -#include #endif // GTEST_HASH_CXXABI_H_ namespace testing { @@ -90,13 +88,11 @@ inline std::string CanonicalizeForStdLibVersioning(std::string s) { // GetTypeName(const std::type_info&) returns a human-readable name of type T. inline std::string GetTypeName(const std::type_info& type) { const char* const name = type.name(); -#if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC) +#if GTEST_HAS_CXXABI_H_ int status = 0; // gcc's implementation of typeid(T).name() mangles the type name, // so we have to demangle it. -#if GTEST_HAS_CXXABI_H_ using abi::__cxa_demangle; -#endif // GTEST_HAS_CXXABI_H_ char* const readable_name = __cxa_demangle(name, nullptr, nullptr, &status); const std::string name_str(status == 0 ? readable_name : name); free(readable_name); @@ -117,7 +113,7 @@ inline std::string GetTypeName(const std::type_info& type) { return s; #else return name; -#endif // GTEST_HAS_CXXABI_H_ || __HP_aCC +#endif // GTEST_HAS_CXXABI_H_ } #endif // GTEST_HAS_RTTI diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index c77f7822..6f37c536 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -4010,8 +4010,8 @@ TEST(AssertionTest, NamedEnum) { EXPECT_NONFATAL_FAILURE(EXPECT_EQ(kE1, kE2), "Which is: 1"); } -// Sun Studio and HP aCC2reject this code. -#if !defined(__SUNPRO_CC) && !defined(__HP_aCC) +// Sun Studio rejects this code. +#if !defined(__SUNPRO_CC) // Tests using assertions with anonymous enums. enum { @@ -4072,7 +4072,7 @@ TEST(AssertionTest, AnonymousEnum) { EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC), "\n Which is: -1"); } -#endif // !GTEST_OS_MAC && !defined(__SUNPRO_CC) +#endif // !defined(__SUNPRO_CC) #ifdef GTEST_OS_WINDOWS