CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
75 lines
2.5 KiB
C++
75 lines
2.5 KiB
C++
//===--------- compiler.h - Compiler abstraction support --------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file is a part of the ORC runtime support library.
|
|
//
|
|
// Most functionality in this file was swiped from llvm/Support/Compiler.h.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef ORC_RT_COMPILER_H
|
|
#define ORC_RT_COMPILER_H
|
|
|
|
#if defined(_WIN32)
|
|
#define ORC_RT_INTERFACE extern "C"
|
|
#define ORC_RT_HIDDEN
|
|
#define ORC_RT_IMPORT extern "C" __declspec(dllimport)
|
|
#else
|
|
#define ORC_RT_INTERFACE extern "C" __attribute__((visibility("default")))
|
|
#define ORC_RT_HIDDEN __attribute__((visibility("hidden")))
|
|
#define ORC_RT_IMPORT extern "C"
|
|
#endif
|
|
|
|
#ifndef __has_builtin
|
|
# define __has_builtin(x) 0
|
|
#endif
|
|
|
|
// Only use __has_cpp_attribute in C++ mode. GCC defines __has_cpp_attribute in
|
|
// C mode, but the :: in __has_cpp_attribute(scoped::attribute) is invalid.
|
|
#ifndef ORC_RT_HAS_CPP_ATTRIBUTE
|
|
#if defined(__cplusplus) && defined(__has_cpp_attribute)
|
|
#define ORC_RT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
|
|
#else
|
|
#define ORC_RT_HAS_CPP_ATTRIBUTE(x) 0
|
|
#endif
|
|
#endif
|
|
|
|
// Use the 'nodiscard' attribute in C++17 or newer mode.
|
|
#if defined(__cplusplus) && __cplusplus > 201402L && \
|
|
ORC_RT_HAS_CPP_ATTRIBUTE(nodiscard)
|
|
#define ORC_RT_NODISCARD [[nodiscard]]
|
|
#elif ORC_RT_HAS_CPP_ATTRIBUTE(clang::warn_unused_result)
|
|
#define ORC_RT_NODISCARD [[clang::warn_unused_result]]
|
|
// Clang in C++14 mode claims that it has the 'nodiscard' attribute, but also
|
|
// warns in the pedantic mode that 'nodiscard' is a C++17 extension (PR33518).
|
|
// Use the 'nodiscard' attribute in C++14 mode only with GCC.
|
|
// TODO: remove this workaround when PR33518 is resolved.
|
|
#elif defined(__GNUC__) && ORC_RT_HAS_CPP_ATTRIBUTE(nodiscard)
|
|
#define ORC_RT_NODISCARD [[nodiscard]]
|
|
#else
|
|
#define ORC_RT_NODISCARD
|
|
#endif
|
|
|
|
#if __has_builtin(__builtin_expect)
|
|
#define ORC_RT_LIKELY(EXPR) __builtin_expect((bool)(EXPR), true)
|
|
#define ORC_RT_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false)
|
|
#else
|
|
#define ORC_RT_LIKELY(EXPR) (EXPR)
|
|
#define ORC_RT_UNLIKELY(EXPR) (EXPR)
|
|
#endif
|
|
|
|
#if defined(__APPLE__)
|
|
#define ORC_RT_WEAK_IMPORT __attribute__((weak_import))
|
|
#elif defined(_WIN32)
|
|
#define ORC_RT_WEAK_IMPORT
|
|
#else
|
|
#define ORC_RT_WEAK_IMPORT __attribute__((weak))
|
|
#endif
|
|
|
|
#endif // ORC_RT_COMPILER_H
|