Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene_debug.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_ARENE_DEBUG_HPP_
6
#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PLATFORM_QUERIES_ARENE_DEBUG_HPP_
7
8
// IWYU pragma: private, include "arene/base/compiler_support/platform_queries.hpp"
9
// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
10
11
// parasoft-begin-suppress AUTOSAR-A16_2_2-a-2 "Arene Base aggregate headers permitted by A16-2-2 Permit #1"
12
#include "
arene/base/compiler_support/platform_queries/compiler_info.hpp
"
13
#include "
arene/base/compiler_support/preprocessor/define_configuration.hpp
"
14
// parasoft-end-suppress AUTOSAR-A16_2_2-a-2
15
16
// NOLINTBEGIN(cppcoreguidelines-macro-usage) Explicitly providing compiler support macro functions
17
// parasoft-begin-suppress AUTOSAR-A16_0_1-d-2 "Conditional defines permitted by A16-0-1 Permit #2"
18
// parasoft-begin-suppress AUTOSAR-A16_0_1-a-2 "Conditional defines permitted by A16-0-1 Permit #2"
19
20
/// @def ARENE_DEBUG
21
/// @brief A compile-time configuration flag for testing if "debug" has been configured.
22
///
23
/// Usage:
24
/// @code{c++}
25
/// #if ARENE_IS_ON(ARENE_DEBUG)
26
/// @endcode
27
///
28
/// The value of this query is determined as follows, in order of precedence:
29
/// 1. If @c ARENE_DEBUG has been explicitly defined via a @c -D flag to the compiler or similar:
30
/// * @c ARENE_ON if it is truthy
31
/// * @c ARENE_OFF if it is not truthy.
32
/// 1. If @c NDEBUG is defined, it is @c ARENE_OFF_BY_DEFAULT
33
/// 1. If @c ARENE_COMPILER_CLANG or @c ARENE_COMPILER_GCC are on, and @c __OPTIMIZE__ is defined, it is
34
/// @c ARENE_OFF_BY_DEFAULT
35
/// 1. Otherwise, it is @c ARENE_ON_BY_DEFAULT
36
37
#if defined(ARENE_DEBUG)
38
#if (ARENE_DEBUG != 0)
39
#define ARENE_DEBUG_I_ ARENE_ON
40
#else
41
#define ARENE_DEBUG_I_ ARENE_OFF
42
#endif
43
#elif defined(NDEBUG)
44
#define ARENE_DEBUG_I_ ARENE_OFF_BY_DEFAULT
45
#elif (ARENE_IS_ON(ARENE_COMPILER_CLANG) || ARENE_IS_ON(ARENE_COMPILER_GCC)) && defined(__OPTIMIZE__)
46
#define ARENE_DEBUG_I_ ARENE_OFF_BY_DEFAULT
47
#else
48
#define ARENE_DEBUG_I_ ARENE_ON_BY_DEFAULT
49
#endif
50
51
#ifdef ARENE_DOC_GENERATION_RUNNING
// make this appear when running doxygen, as it won't otherwise.
52
#ifndef ARENE_DEBUG
53
#define ARENE_DEBUG
54
#endif
55
#endif
56
57
// NOLINTEND(cppcoreguidelines-macro-usage) Explicitly providing compiler support macro functions
58
// parasoft-end-suppress AUTOSAR-A16_0_1-d-2
59
// parasoft-end-suppress AUTOSAR-A16_0_1-a-2
60
61
#endif
// INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PLATFORM_QUERIES_ARENE_DEBUG_HPP_
compiler_info.hpp
define_configuration.hpp
arene
base
compiler_support
platform_queries
arene_debug.hpp
Generated by
1.13.2