Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
compiler_info.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_COMPILER_INFO_HPP_
6
#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PLATFORM_QUERIES_COMPILER_INFO_HPP_
7
8
#include "
arene/base/compiler_support/preprocessor/define_configuration.hpp
"
9
// IWYU pragma: private, include "arene/base/compiler_support/platform_queries.hpp"
10
// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
11
12
// parasoft-begin-suppress AUTOSAR-A16_2_2-a-2 "Arene Base aggregate headers permitted by A16-2-2 Permit #1"
13
// parasoft-end-suppress AUTOSAR-A16_2_2-a-2
14
15
// NOLINTBEGIN(cppcoreguidelines-macro-usage) Explicitly providing compiler support macro functions
16
// parasoft-begin-suppress AUTOSAR-A16_0_1-d-2 "Conditional defines permitted by A16-0-1 Permit #2"
17
// parasoft-begin-suppress AUTOSAR-A16_0_1-a-2 "Conditional defines permitted by A16-0-1 Permit #2"
18
19
/// @def ARENE_COMPILER_CLANG
20
/// @brief A compile-time configuration flag for testing if the current compiler is @c clang
21
///
22
/// Usage:
23
/// @code{c++}
24
/// #if ARENE_IS_ON(ARENE_COMPILER_CLANG)
25
/// @endcode
26
///
27
/// The value of this query is determined as follows, in order of precedence:
28
/// 1. If @c ARENE_COMPILER_CLANG has been explicitly defined via a @c -D flag to the compiler or similar:
29
/// * @c ARENE_ON if it is truthy
30
/// * @c ARENE_OFF if it is not truthy.
31
/// 1. If @c __clang__ is defined, it is @c ARENE_ON_BY_DEFAULT
32
/// 1. Otherwise, it is @c ARENE_OFF_BY_DEFAULT
33
34
#if defined(ARENE_COMPILER_ARMCLANG)
35
#if (ARENE_COMPILER_ARMCLANG != 0)
36
#define ARENE_COMPILER_ARMCLANG_I_ ARENE_ON
37
#else
38
#define ARENE_COMPILER_ARMCLANG_I_ ARENE_OFF
39
#endif
40
#elif defined(__ARMCOMPILER_VERSION)
41
#define ARENE_COMPILER_ARMCLANG_I_ ARENE_ON_BY_DEFAULT
42
#else
43
#define ARENE_COMPILER_ARMCLANG_I_ ARENE_OFF_BY_DEFAULT
44
#endif
45
46
#ifdef ARENE_DOC_GENERATION_RUNNING
// make this appear when running doxygen, as it won't otherwise.
47
#ifndef ARENE_COMPILER_ARMCLANG
48
#define ARENE_COMPILER_ARMCLANG
49
#endif
50
#endif
51
52
#if defined(ARENE_COMPILER_CLANG)
53
#if (ARENE_COMPILER_CLANG != 0)
54
#define ARENE_COMPILER_CLANG_I_ ARENE_ON
55
#else
56
#define ARENE_COMPILER_CLANG_I_ ARENE_OFF
57
#endif
58
// parasoft-begin-suppress AUTOSAR-M16_0_7-a-2 "False positive: not used as a macro"
59
#elif ARENE_IS_OFF(ARENE_COMPILER_ARMCLANG) && defined(__clang__)
60
// parasoft-end-suppress AUTOSAR-M16_0_7-a-2
61
#define ARENE_COMPILER_CLANG_I_ ARENE_ON_BY_DEFAULT
62
#else
63
#define ARENE_COMPILER_CLANG_I_ ARENE_OFF_BY_DEFAULT
64
#endif
65
66
#ifdef ARENE_DOC_GENERATION_RUNNING
// make this appear when running doxygen, as it won't otherwise.
67
#ifndef ARENE_COMPILER_CLANG
68
#define ARENE_COMPILER_CLANG
69
#endif
70
#endif
71
72
/// @def ARENE_COMPILER_GCC
73
/// @brief A compile-time configuration flag for testing if the current compiler is @c gcc
74
///
75
/// Usage:
76
/// @code{c++}
77
/// #if ARENE_IS_ON(ARENE_COMPILER_GCC)
78
/// @endcode
79
///
80
/// The value of this query is determined as follows, in order of precedence:
81
/// 1. If @c ARENE_COMPILER_GCC has been explicitly defined via a @c -D flag to the compiler or similar:
82
/// * @c ARENE_ON if it is truthy
83
/// * @c ARENE_OFF if it is not truthy.
84
/// 1. If @c ARENE_IS_OFF(ARENE_COMPILER_CLANG) , and all of @c __GNUC__ , @c __GNUC_MINOR__ and @c __GNUC_PATCH_LEVEL
85
/// are defined, it is @c ARENE_ON_BY_DEFAULT
86
/// 1. Otherwise, it is @c ARENE_OFF_BY_DEFAULT
87
88
#if defined(ARENE_COMPILER_GCC)
89
#if (ARENE_COMPILER_GCC != 0)
90
#define ARENE_COMPILER_GCC_I_ ARENE_ON
91
#else
92
#define ARENE_COMPILER_GCC_I_ ARENE_OFF
93
#endif
94
// parasoft-begin-suppress AUTOSAR-M16_0_7-a-2 "False positive: not used as a macro"
95
#elif ARENE_IS_OFF(ARENE_COMPILER_ARMCLANG) && ARENE_IS_OFF(ARENE_COMPILER_CLANG) && \
96
(defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__))
97
// parasoft-end-suppress AUTOSAR-M16_0_7-a-2
98
#define ARENE_COMPILER_GCC_I_ ARENE_ON_BY_DEFAULT
99
#else
100
#define ARENE_COMPILER_GCC_I_ ARENE_OFF_BY_DEFAULT
101
#endif
102
103
#ifdef ARENE_DOC_GENERATION_RUNNING
// make this appear when running doxygen, as it won't otherwise.
104
#ifndef ARENE_COMPILER_GCC
105
#define ARENE_COMPILER_GCC
106
#endif
107
#endif
108
109
// NOLINTEND(cppcoreguidelines-macro-usage) Explicitly providing compiler support macro functions
110
// parasoft-end-suppress AUTOSAR-A16_0_1-d-2
111
// parasoft-end-suppress AUTOSAR-A16_0_1-a-2
112
113
#endif
// INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PLATFORM_QUERIES_COMPILER_INFO_HPP_
define_configuration.hpp
arene
base
compiler_support
platform_queries
compiler_info.hpp
Generated by
1.13.2