alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
Unreachable.hpp
Go to the documentation of this file.
1/* Copyright 2025 Jan Stephan, Jeffrey Kelling, Andrea Bocci
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
8
9//! Before CUDA 11.5 nvcc is unable to correctly identify return statements in 'if constexpr' branches. It will issue
10//! a false warning about a missing return statement unless it is told that the following code section is unreachable.
11//!
12//! \param x A dummy value for the expected return type of the calling function.
13#if(BOOST_COMP_NVCC && BOOST_ARCH_PTX)
14# define ALPAKA_UNREACHABLE(...) __builtin_unreachable()
15#elif BOOST_COMP_MSVC
16# define ALPAKA_UNREACHABLE(...) __assume(false)
17#elif BOOST_COMP_GNUC || BOOST_COMP_CLANG
18# define ALPAKA_UNREACHABLE(...) __builtin_unreachable()
19#else
20# define ALPAKA_UNREACHABLE(...)
21#endif