Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
has_builtin.hpp
Go to the documentation of this file.
1
// Copyright 2024, Toyota Motor Corporation
2
//
3
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5
#
ifndef
INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PLATFORM_QUERIES_HAS_BUILTIN_HPP_
6
#
define
INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PLATFORM_QUERIES_HAS_BUILTIN_HPP_
7
8
// IWYU pragma: private
9
// IWYU pragma: friend "arene/base/compiler_support/platform_queries/.*"
10
11
// NOLINTBEGIN(cppcoreguidelines-macro-usage) Explicitly providing compiler support macro functions
12
// parasoft-begin-suppress AUTOSAR-A16_0_1-d-2 "Conditional defines permitted by A16-0-1 Permit #2"
13
// parasoft-begin-suppress AUTOSAR-A16_0_1-a-2 "Conditional defines permitted by A16-0-1 Permit #2"
14
15
/// @def ARENE_HAS_BUILTIN
16
/// @brief A platform support query for testing if a supplied builtin is defined.
17
/// @param ... The name of the builtin to query for.
18
/// @return if @c __has_builtin is defined, the result of @c __has_builtin(__VA_ARGS__), otherwise @c 0 .
19
///
20
/// Example usage testing for @c __builtin_is_constant_evaluated :
21
/// @code{c++}
22
/// #if ARENE_HAS_BUILTIN(__builtin_is_constant_evaluated)
23
/// @endcode
24
///
25
26
#
if
!
defined
(
__QNX__
)
&&
defined
(
__has_builtin
)
27
#
define
ARENE_HAS_BUILTIN
(
...
)
__has_builtin
(
__VA_ARGS__
)
28
#
else
29
#
define
ARENE_HAS_BUILTIN
(
...
)
0
30
#
endif
// checking for __has_builtin
31
32
// NOLINTEND(cppcoreguidelines-macro-usage) Explicitly providing compiler support macro functions
33
// parasoft-end-suppress AUTOSAR-A16_0_1-d-2
34
// parasoft-end-suppress AUTOSAR-A16_0_1-a-2
35
36
#
endif
// INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PLATFORM_QUERIES_HAS_BUILTIN_HPP_
arene
base
compiler_support
platform_queries
has_builtin.hpp
Generated by
1.13.2