Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
static_assertions_config.hpp
Go to the documentation of this file.
1// Copyright 2026, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5///
6/// @file static_assertions_config.hpp
7/// @brief Compile time configuration for the static assertions macros
8///
9
10#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TESTING_GTEST_STATIC_ASSERTIONS_CONFIG_HPP_
11#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TESTING_GTEST_STATIC_ASSERTIONS_CONFIG_HPP_
12
13// IWYU pragma: private
14// IWYU pragma: friend "arene/base/testing/gtest/.*"
15
16// parasoft-begin-suppress AUTOSAR-A16_2_2-a-2 "Arene Base aggregate headers permitted by A16-2-2 Permit #1"
17#include "arene/base/compiler_support/preprocessor.hpp"
18// parasoft-end-suppress AUTOSAR-A16_2_2-a-2
19
20// parasoft-begin-suppress AUTOSAR-A16_0_1-d-2 "Defines macros for configuration"
21// parasoft-begin-suppress AUTOSAR-A16_0_1-a-2 "Conditional defines for tool support and configuration detection"
22
23/// @def ARENE_GTEST_STATIC_ASSERTIONS
24/// @brief A compile time configuration query for testing if static assertion macros should actually static assert
25///
26/// Usage:
27/// @code{c++}
28/// #if ARENE_IS_ON(ARENE_GTEST_STATIC_ASSERTIONS)
29/// @endcode
30///
31/// The value of this query is determined as follows, in order of precedence:
32/// 1. If @c ARENE_GTEST_STATIC_ASSERTIONS 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. Otherwise, it is @c ARENE_ON_BY_DEFAULT
36#if defined(ARENE_GTEST_STATIC_ASSERTIONS)
37#if (ARENE_GTEST_STATIC_ASSERTIONS != 0)
38#define ARENE_GTEST_STATIC_ASSERTIONS_I_ ARENE_ON
39#else
40#define ARENE_GTEST_STATIC_ASSERTIONS_I_ ARENE_OFF
41#endif
42#else
43#define ARENE_GTEST_STATIC_ASSERTIONS_I_ ARENE_ON_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_GTEST_STATIC_ASSERTIONS
48#define ARENE_GTEST_STATIC_ASSERTIONS
49#endif
50#endif
51
52#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TESTING_GTEST_STATIC_ASSERTIONS_CONFIG_HPP_