Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
stdlib_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_STDLIB_INFO_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PLATFORM_QUERIES_STDLIB_INFO_HPP_
7
8// IWYU pragma: private
9// IWYU pragma: friend "arene/base/compiler_support/platform_queries/.*"
10
11// parasoft-begin-suppress AUTOSAR-A16_2_2-a-2 "Arene Base aggregate headers permitted by A16-2-2 Permit #1"
12
13#include "arene/base/compiler_support/preprocessor.hpp"
14// parasoft-end-suppress AUTOSAR-A16_2_2-a-2
15
16#include "arene/base/stdlib_choice/cstddef.hpp"
17// IWYU pragma: no_include <__configuration/language.h>
18
19// NOLINTBEGIN(cppcoreguidelines-macro-usage) Explicitly providing compiler support macro functions
20// parasoft-begin-suppress AUTOSAR-A16_0_1-d-2 "Conditional defines permitted by A16-0-1 Permit #2"
21// parasoft-begin-suppress AUTOSAR-A16_0_1-a-2 "Conditional defines permitted by A16-0-1 Permit #2"
22
23/// @def ARENE_STDLIB_LIBCXX
24/// @brief A platform support query for testing if the current stdlib is @c libc++ .
25///
26/// Usage:
27/// @code{c++}
28/// #if ARENE_IS_ON(ARENE_STDLIB_LIBCXX)
29/// @endcode
30///
31/// The value of this query is determined as follows, in order of precedence:
32/// 1. If @c ARENE_STDLIB_LIBCXX has been explicitly defined via a @c -D flag to the compiler or similar:
33/// * @c ARENE_ON if it is truthy
34/// * @c ARENE_OFF if it is not truthy
35/// 1. If @c _LIBCPP_STD_VER is defined it is @c ARENE_ON_BY_DEFAULT
36/// 1. Otherwise, it is @c ARENE_OFF_BY_DEFAULT
37
38#if defined(ARENE_STDLIB_LIBCXX)
39#if (ARENE_STDLIB_LIBCXX != 0)
40#define ARENE_STDLIB_LIBCXX_I_ ARENE_ON
41#else
42#define ARENE_STDLIB_LIBCXX_I_ ARENE_OFF
43#endif
44#elif defined(_LIBCPP_STD_VER)
45#define ARENE_STDLIB_LIBCXX_I_ ARENE_ON_BY_DEFAULT
46#else
47#define ARENE_STDLIB_LIBCXX_I_ ARENE_OFF_BY_DEFAULT
48#endif
49
50#ifdef ARENE_DOC_GENERATION_RUNNING // make this appear when running doxygen, as it won't otherwise.
51#ifndef ARENE_STDLIB_LIBCXX
52#define ARENE_STDLIB_LIBCXX
53#endif
54#endif
55
56/// @def ARENE_STDLIB_LIBSTDCXX
57/// @brief A platform support query for testing if the current stdlib is @c libstdc++ .
58///
59/// Usage:
60/// @code{c++}
61/// #if ARENE_IS_ON(ARENE_STDLIB_LIBSTDCXX)
62/// @endcode
63///
64/// The value of this query is determined as follows, in order of precedence:
65/// 1. If @c ARENE_STDLIB_LIBSTDCXX has been explicitly defined via a @c -D flag to the compiler or similar:
66/// * @c ARENE_ON if it is truthy
67/// * @c ARENE_OFF if it is not truthy
68/// 1. If @c __GLIBCXX__ or @c __GLIBCPP__ are defined it is @c ARENE_ON_BY_DEFAULT
69/// 1. Otherwise, it is @c ARENE_OFF_BY_DEFAULT
70
71#if defined(ARENE_STDLIB_LIBSTDCXX)
72#if (ARENE_STDLIB_LIBSTDCXX != 0)
73#define ARENE_STDLIB_LIBSTDCXX_I_ ARENE_ON
74#else
75#define ARENE_STDLIB_LIBSTDCXX_I_ ARENE_OFF
76#endif
77#elif defined(__GLIBCXX__) || defined(__GLIBCPP__)
78#define ARENE_STDLIB_LIBSTDCXX_I_ ARENE_ON_BY_DEFAULT
79#else
80#define ARENE_STDLIB_LIBSTDCXX_I_ ARENE_OFF_BY_DEFAULT
81#endif
82
83#ifdef ARENE_DOC_GENERATION_RUNNING // make this appear when running doxygen, as it won't otherwise.
84#ifndef ARENE_STDLIB_LIBSTDCXX
85#define ARENE_STDLIB_LIBSTDCXX
86#endif
87#endif
88
89/// @def ARENE_STDLIB_LIBARENECXX
90/// @brief A platform support query for testing if the current stdlib is the internal arene_base C++ standard library.
91///
92/// Usage:
93/// @code{c++}
94/// #if ARENE_IS_ON(ARENE_STDLIB_LIBARENECXX)
95/// @endcode
96///
97/// The value of this query is determined as follows, in order of precedence:
98/// 1. If @c ARENE_STDLIB_LIBARENECXX has been explicitly defined via a @c -D flag to the compiler or similar:
99/// * @c ARENE_ON if it is truthy
100/// * @c ARENE_OFF if it is not truthy
101/// 1. If the inclusion of @c <cstddef> results in detection of internal stdlib defines known to be in that header, it
102/// is @c ARENE_ON_BY_DEFAULT
103/// 1. Otherwise, it is @c ARENE_OFF_BY_DEFAULT
104
105#if defined(ARENE_STDLIB_LIBARENECXX)
106#if (ARENE_STDLIB_LIBARENECXX != 0)
107#define ARENE_STDLIB_LIBARENECXX_I_ ARENE_ON
108#else
109#define ARENE_STDLIB_LIBARENECXX_I_ ARENE_OFF
110#endif
111#elif defined(INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_CSTDDEF_HPP_)
112#define ARENE_STDLIB_LIBARENECXX_I_ ARENE_ON_BY_DEFAULT
113#else
114#define ARENE_STDLIB_LIBARENECXX_I_ ARENE_OFF_BY_DEFAULT
115#endif
116
117#ifdef ARENE_DOC_GENERATION_RUNNING // make this appear when running doxygen, as it won't otherwise.
118#ifndef ARENE_STDLIB_LIBARENECXX
119#define ARENE_STDLIB_LIBARENECXX
120#endif
121#endif
122
123// NOLINTEND(cppcoreguidelines-macro-usage) Explicitly providing compiler support macro functions
124// parasoft-end-suppress AUTOSAR-A16_0_1-d-2
125// parasoft-end-suppress AUTOSAR-A16_0_1-a-2
126
127#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PLATFORM_QUERIES_STDLIB_INFO_HPP_