From 0dcc9e45b5200b678c2cfc7990e930ef1aa1e1ed Mon Sep 17 00:00:00 2001 From: midronij Date: Fri, 22 Mar 2024 15:21:04 -0400 Subject: [PATCH] Add __open_xl__ macros to __IBMC__/__IBMCPP__ conditions Signed-off-by: midronij --- cmake/modules/OmrDetectSystemInformation.cmake | 10 +++++++--- compiler/compile/OSRData.cpp | 2 +- compiler/control/OptimizationPlan.hpp | 2 +- compiler/cs2/bitmanip.h | 2 +- compiler/env/defines.h | 2 +- compiler/env/jittypes.h | 2 +- compiler/infra/Annotations.hpp | 2 +- compiler/p/runtime/PPCCodeSync.inc | 6 +++--- compiler/runtime/OMRRuntimeAssumptions.cpp | 2 +- compiler/runtime/Runtime.cpp | 2 +- include_core/omrcomp.h | 2 +- .../gtest-1.8.0/include/gtest/internal/gtest-port.h | 10 +++++----- 12 files changed, 24 insertions(+), 20 deletions(-) diff --git a/cmake/modules/OmrDetectSystemInformation.cmake b/cmake/modules/OmrDetectSystemInformation.cmake index 55bc8e37d7d..d73f0639b07 100644 --- a/cmake/modules/OmrDetectSystemInformation.cmake +++ b/cmake/modules/OmrDetectSystemInformation.cmake @@ -193,10 +193,14 @@ macro(omr_detect_system_information) if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") # clang on Windows mimics MSVC set(_OMR_TOOLCONFIG "msvc") - else() - # For openxl, CMAKE_C_COMPILER_ID "Clang 17.x.x" + elseif(CMAKE_C_COMPILER_ID MATCHES "^Clang$") + # OpenXL17 uses CMAKE_C_COMPILER_ID "Clang" set(_OMR_TOOLCONFIG "openxl") - set(CMAKE_C_COMPILER_IS_OPENXL TRUE CACHE BOOL "OpenXL is the C compiler") + set(CMAKE_C_COMPILER_IS_OPENXL TRUE CACHE BOOL "OpenXL is the C compiler"i) + else() + # TODO we don't actually have a clang config + # just use GNU config + set(_OMR_TOOLCONFIG "gnu") endif() elseif(CMAKE_C_COMPILER_ID MATCHES "^XL(Clang)?$" OR CMAKE_C_COMPILER_ID STREQUAL "zOS") # In CMake 3.14 and prior, XLClang uses CMAKE_C_COMPILER_ID "XL" diff --git a/compiler/compile/OSRData.cpp b/compiler/compile/OSRData.cpp index 93ae51ba4e0..c4d2346c85a 100644 --- a/compiler/compile/OSRData.cpp +++ b/compiler/compile/OSRData.cpp @@ -1515,7 +1515,7 @@ bool TR_OSRCompilationData::TR_ScratchBufferInfo::operator==(const TR_ScratchBuf #if (defined(TR_HOST_POWER) && defined(TR_TARGET_POWER) \ || defined(TR_HOST_S390) && defined(TR_TARGET_S390)) \ - && defined(__IBMCPP__) + && (defined(__IBMCPP__) || defined(__open_xl__) && defined(__cplusplus)) __attribute__((__noinline__)) //This tiny function when inlined by xlC 12 or later at -O3 breaks java -version //on Power and causes intermittent crashes on z/OS with xlC 2.1.1 diff --git a/compiler/control/OptimizationPlan.hpp b/compiler/control/OptimizationPlan.hpp index 0db9e8bd475..49830a1b9ea 100644 --- a/compiler/control/OptimizationPlan.hpp +++ b/compiler/control/OptimizationPlan.hpp @@ -39,7 +39,7 @@ namespace TR { class Recompilation; } namespace TR { class Monitor; } struct TR_MethodToBeCompiled; -#if defined(__IBMCPP__) +#if defined(__IBMCPP__) || defined(__open_xl__) && defined(__cplusplus) // GCC (and other compilers) may assume that operator new cannot return null // unless a nothrow specification is provided. For other reasons, we build // Testarossa with -qnoeh / -fnoeh to disable exceptions. This is all fine, diff --git a/compiler/cs2/bitmanip.h b/compiler/cs2/bitmanip.h index b721afe1964..e071153ae04 100644 --- a/compiler/cs2/bitmanip.h +++ b/compiler/cs2/bitmanip.h @@ -29,7 +29,7 @@ #ifndef CSBITMANIP_H #define CSBITMANIP_H -#if defined(__IBMCPP__) && defined (__PPC__) +#if (defined(__IBMCPP__) || defined(__open_xl__) && defined(__cplusplus)) && defined (__PPC__) // to __cntlz4 and related routines # include "builtins.h" #endif diff --git a/compiler/env/defines.h b/compiler/env/defines.h index 5b4d561bc32..8a7ca966f88 100644 --- a/compiler/env/defines.h +++ b/compiler/env/defines.h @@ -165,7 +165,7 @@ /* Compiler macros */ #if defined(__GNUC__) # define HOST_COMPILER COMPILER_GCC -#elif defined(__IBMC__) || defined(__IBMCPP__) +#elif defined(__IBMC__) || defined(__IBMCPP__) || defined(__open_xl__) # define HOST_COMPILER COMPILER_XLC #elif defined(_MSC_VER) # define HOST_COMPILER COMPILER_MSVC diff --git a/compiler/env/jittypes.h b/compiler/env/jittypes.h index 607e01900f3..3546b01b346 100644 --- a/compiler/env/jittypes.h +++ b/compiler/env/jittypes.h @@ -139,7 +139,7 @@ typedef struct TR_InlinedCallSite #define FLUSH_MEMORY(smp) #endif #else - #if defined(__IBMC__) || defined(__IBMCPP__) + #if defined(__IBMC__) || defined(__IBMCPP__) || defined(__open_xl__) #if defined(__cplusplus) #include #endif /* __cplusplus */ diff --git a/compiler/infra/Annotations.hpp b/compiler/infra/Annotations.hpp index 7bc9e08fe0b..c5d598a6cb0 100644 --- a/compiler/infra/Annotations.hpp +++ b/compiler/infra/Annotations.hpp @@ -64,7 +64,7 @@ #define OMR_NORETURN _declspec(noreturn) #elif defined(__GNUC__) #define OMR_NORETURN __attribute__ ((noreturn)) -#elif defined(__IBMCPP__) +#elif defined(__IBMCPP__) || defined(__open_xl__) && defined(__cplusplus) #define OMR_NORETURN __attribute__ ((noreturn)) #else #warning "Noreturn attribute undefined for this platform." diff --git a/compiler/p/runtime/PPCCodeSync.inc b/compiler/p/runtime/PPCCodeSync.inc index 93dd59955bd..0cf4a741654 100644 --- a/compiler/p/runtime/PPCCodeSync.inc +++ b/compiler/p/runtime/PPCCodeSync.inc @@ -25,7 +25,7 @@ extern "C" void *getCodeSync(); #if defined(TR_HOST_POWER) -#if defined(__IBMC__) || defined(__IBMCPP__) +#if defined(__IBMC__) || defined(__IBMCPP__) || defined(__open_xl__) #if defined(__cplusplus) #include @@ -35,7 +35,7 @@ extern "C" void *getCodeSync(); #define sync() __sync() #define isync() __isync() -#else /* defined(__IBMC__) || defined(__IBMCPP__) */ +#else /* defined(__IBMC__) || defined(__IBMCPP__) || defined(__open_xl__) */ static inline void dcbf(unsigned char *addr) { @@ -55,7 +55,7 @@ static inline void isync() __asm__("isync"); } -#endif /* defined(__IBMC__) || defined(__IBMCPP__) */ +#endif /* defined(__IBMC__) || defined(__IBMCPP__) || defined(__open_xl__) */ static inline void icbi(unsigned char *addr) { diff --git a/compiler/runtime/OMRRuntimeAssumptions.cpp b/compiler/runtime/OMRRuntimeAssumptions.cpp index 8709188a155..a7ff0248773 100644 --- a/compiler/runtime/OMRRuntimeAssumptions.cpp +++ b/compiler/runtime/OMRRuntimeAssumptions.cpp @@ -22,7 +22,7 @@ #include "runtime/OMRRuntimeAssumptions.hpp" #include "env/jittypes.h" -#if defined(__IBMCPP__) && !defined(AIXPPC) && !defined(LINUXPPC) +#if (defined(__IBMCPP__) || defined(__open_xl__) && defined(__cplusplus)) && !defined(AIXPPC) && !defined(LINUXPPC) #define ASM_CALL __cdecl #else #define ASM_CALL diff --git a/compiler/runtime/Runtime.cpp b/compiler/runtime/Runtime.cpp index ab0dfe842a9..1dfbd1297b8 100644 --- a/compiler/runtime/Runtime.cpp +++ b/compiler/runtime/Runtime.cpp @@ -23,7 +23,7 @@ TR_RuntimeHelperTable runtimeHelpers; -#if (defined(__IBMCPP__) || defined(__IBMC__) && !defined(MVS)) && !defined(LINUXPPC64) +#if (defined(__IBMCPP__) || defined(__IBMC__) && !defined(MVS)) && !defined(LINUXPPC64) || defined(__open_xl__) #if defined(AIXPPC) #define JIT_HELPER(x) extern "C" void *x #else diff --git a/include_core/omrcomp.h b/include_core/omrcomp.h index a4c6d44c7dc..b0b5a6bb373 100644 --- a/include_core/omrcomp.h +++ b/include_core/omrcomp.h @@ -603,7 +603,7 @@ typedef struct U_128 { #if defined(_MSC_VER) && (1900 > _MSC_VER) /* MSVC versions prior to Visual Studio 2015 (14.0) */ #define OMR_ALIGNOF(x) __alignof(x) -#elif defined(__IBMC__) || defined(__IBMCPP__) /* XL C/C++ versions prior to xlclang/xlclang++ */ +#elif defined(__IBMC__) || defined(__IBMCPP__) || defined(__open_xl__) /* XL C/C++ versions prior to xlclang/xlclang++ */ #define OMR_ALIGNOF(x) __alignof__(x) #else /* All other compilers that support C11 and C++11 */ #define OMR_ALIGNOF(x) alignof(x) diff --git a/third_party/gtest-1.8.0/include/gtest/internal/gtest-port.h b/third_party/gtest-1.8.0/include/gtest/internal/gtest-port.h index 79559f29b2e..21e72261efe 100644 --- a/third_party/gtest-1.8.0/include/gtest/internal/gtest-port.h +++ b/third_party/gtest-1.8.0/include/gtest/internal/gtest-port.h @@ -478,7 +478,7 @@ struct _RTL_CRITICAL_SECTION; // detecting whether they are enabled or not. Therefore, we assume that // they are enabled unless the user tells us otherwise. # define GTEST_HAS_EXCEPTIONS 1 -# elif defined(__IBMCPP__) && __EXCEPTIONS +# elif (defined(__IBMCPP__) || defined(__open_xl__) && defined(__cplusplus)) && __EXCEPTIONS // xlC defines __EXCEPTIONS to 1 iff exceptions are enabled. # define GTEST_HAS_EXCEPTIONS 1 # elif defined(__HP_aCC) @@ -570,7 +570,7 @@ struct _RTL_CRITICAL_SECTION; // 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) +# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900) || defined(__open_xl__) && defined(__cplusplus) # ifdef __RTTI_ALL__ # define GTEST_HAS_RTTI 1 @@ -821,7 +821,7 @@ using ::std::tuple_size; // Typed tests need and variadic macros, which GCC, VC++ 8.0, // Sun Pro CC, IBM Visual Age, and HP aCC support. #if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \ - defined(__IBMCPP__) || defined(__HP_aCC) + defined(__IBMCPP__) || defined(__HP_aCC) || defined(__open_xl__) && defined(__cplusplus) # define GTEST_HAS_TYPED_TEST 1 # define GTEST_HAS_TYPED_TEST_P 1 #endif @@ -2200,7 +2200,7 @@ GTEST_API_ size_t GetThreadCount(); // for objects passed through ellipsis (...), failing for uncopyable // objects. We define this to ensure that only POD is passed through // ellipsis on these systems. -#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC) +#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC) || defined(__open_xl__) && defined(__cplusplus) // We lose support for NULL detection where the compiler doesn't like // passing non-POD classes through ellipsis (...). # define GTEST_ELLIPSIS_NEEDS_POD_ 1 @@ -2212,7 +2212,7 @@ GTEST_API_ size_t GetThreadCount(); // const T& and const T* in a function template. These compilers // _can_ decide between class template specializations for T and T*, // so a tr1::type_traits-like is_pointer works. -#if defined(__SYMBIAN32__) || defined(__IBMCPP__) +#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__open_xl__) && defined(__cplusplus) # define GTEST_NEEDS_IS_POINTER_ 1 #endif