alpaka
Abstraction Library for Parallel Kernel Acceleration
Unreachable.hpp
Go to the documentation of this file.
1
/* Copyright 2022 Jan Stephan, Jeffrey Kelling
2
* SPDX-License-Identifier: MPL-2.0
3
*/
4
5
#pragma once
6
7
#include "
alpaka/core/BoostPredef.hpp
"
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
# if BOOST_LANG_CUDA >= BOOST_VERSION_NUMBER(11, 3, 0)
15
# define ALPAKA_UNREACHABLE(...) __builtin_unreachable()
16
# else
17
# define ALPAKA_UNREACHABLE(...) return __VA_ARGS__
18
# endif
19
#elif BOOST_COMP_MSVC
20
# define ALPAKA_UNREACHABLE(...) __assume(false)
21
#elif BOOST_COMP_GNUC || BOOST_COMP_CLANG
22
# define ALPAKA_UNREACHABLE(...) __builtin_unreachable()
23
#else
24
# define ALPAKA_UNREACHABLE(...)
25
#endif
BoostPredef.hpp
include
alpaka
core
Unreachable.hpp
Generated on Thu Dec 12 2024 11:51:45 for alpaka by
1.9.1