Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
coverage_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_COVERAGE_INFO_HPP_
6
#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PLATFORM_QUERIES_COVERAGE_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
// parasoft-begin-suppress AUTOSAR-A16_0_1-d-2 "Conditional defines permitted by A16-0-1 Permit #2"
16
// parasoft-begin-suppress AUTOSAR-A16_0_1-a-2 "Conditional defines permitted by A16-0-1 Permit #2"
17
18
/// @def ARENE_IS_GCOV
19
/// @brief A platform support query for testing if the current compilation is happening under gcov.
20
///
21
/// Usage:
22
/// @code{c++}
23
/// #if ARENE_IS_ON(ARENE_IS_GCOV)
24
/// @endcode
25
///
26
/// The value of this query is determined as follows, in order of precedence:
27
/// 1. If @c ARENE_IS_GCOV has been explicitly defined via a @c -D flag to the compiler or similar:
28
/// * @c ARENE_ON if it is truthy
29
/// * @c ARENE_OFF if it is not truthy
30
/// 1. If @c __GCOV__ is defined it is @c ARENE_ON_BY_DEFAULT
31
/// 1. Otherwise, it is @c ARENE_OFF_BY_DEFAULT
32
#if defined(ARENE_IS_GCOV)
33
#if (ARENE_IS_GCOV != 0)
34
#define ARENE_IS_GCOV_I_ ARENE_ON
35
#else
36
#define ARENE_IS_GCOV_I_ ARENE_OFF
37
#endif
38
#elif defined(__GCOV__)
39
#define ARENE_IS_GCOV_I_ ARENE_ON_BY_DEFAULT
40
#else
41
#define ARENE_IS_GCOV_I_ ARENE_OFF_BY_DEFAULT
42
#endif
43
44
#ifdef ARENE_DOC_GENERATION_RUNNING
// make this appear when running doxygen, as it won't otherwise.
45
#ifndef ARENE_IS_GCOV
46
#define ARENE_IS_GCOV
47
#endif
48
#endif
49
50
/// @def ARENE_IS_LLVMCOV
51
/// @brief A platform support query for testing if the current compilation is happening under LLVMCov.
52
///
53
/// Usage:
54
/// @code{c++}
55
/// #if ARENE_IS_ON(ARENE_IS_LLVMCOV)
56
/// @endcode
57
///
58
/// The value of this query is determined as follows, in order of precedence:
59
/// 1. If @c ARENE_IS_LLVMCOV has been explicitly defined via a @c -D flag to the compiler or similar:
60
/// * @c ARENE_ON if it is truthy
61
/// * @c ARENE_OFF if it is not truthy
62
/// 1. If @c __LLVM_INSTR_PROFILE_GENERATE is defined it is @c ARENE_ON_BY_DEFAULT
63
#if defined(ARENE_IS_LLVMCOV)
64
#if (ARENE_IS_LLVMCOV != 0)
65
#define ARENE_IS_LLVMCOV_I_ ARENE_ON
66
#else
67
#define ARENE_IS_LLVMCOV_I_ ARENE_OFF
68
#endif
69
#elif defined(__LLVM_INSTR_PROFILE_GENERATE)
70
#define ARENE_IS_LLVMCOV_I_ ARENE_ON_BY_DEFAULT
71
#else
72
#define ARENE_IS_LLVMCOV_I_ ARENE_OFF_BY_DEFAULT
73
#endif
74
75
#ifdef ARENE_DOC_GENERATION_RUNNING
// make this appear when running doxygen, as it won't otherwise.
76
#ifndef ARENE_IS_LLVMCOV
77
#define ARENE_IS_LLVMCOV
78
#endif
79
#endif
80
81
/// @def ARENE_IS_COVERAGE_COMPILATION
82
/// @brief A platform support query for testing if the current compilation is happening under a coverage tool such as
83
/// gcov or LLVMCov.
84
///
85
/// Usage:
86
/// @code{c++}
87
/// #if ARENE_IS_ON(ARENE_IS_COVERAGE_COMPILATION)
88
/// @endcode
89
///
90
/// The value of this query is determined as follows, in order of precedence:
91
/// 1. If @c ARENE_IS_COVERAGE_COMPILATION has been explicitly defined via a @c -D flag to the compiler or similar:
92
/// * @c ARENE_ON if it is truthy
93
/// * @c ARENE_OFF if it is not truthy
94
/// 1. If either @c ARENE_IS_ON(ARENE_IS_GCOV) or @c ARENE_IS_ON(ARENE_IS_LLVMCOV) returns @c true it is
95
/// @c ARENE_ON_BY_DEFAULT
96
#if defined(ARENE_IS_COVERAGE_COMPILATION)
97
#if (ARENE_IS_COVERAGE_COMPILATION != 0)
98
#define ARENE_IS_COVERAGE_COMPILATION_I_ ARENE_ON
99
#else
100
#define ARENE_IS_COVERAGE_COMPILATION_I_ ARENE_OFF
101
#endif
102
#elif defined(COVERAGE_ENABLED)
103
#if (COVERAGE_ENABLED != 0)
104
#define ARENE_IS_COVERAGE_COMPILATION_I_ ARENE_ON
105
#else
106
#define ARENE_IS_COVERAGE_COMPILATION_I_ ARENE_OFF
107
#endif
108
// parasoft-begin-suppress AUTOSAR-M16_0_7-a-2 "False positive: not used as a macro"
109
#elif ARENE_IS_ON(ARENE_IS_GCOV) || ARENE_IS_ON(ARENE_IS_LLVMCOV)
110
// parasoft-end-suppress AUTOSAR-M16_0_7-a-2
111
#define ARENE_IS_COVERAGE_COMPILATION_I_ ARENE_ON_BY_DEFAULT
112
#else
113
#define ARENE_IS_COVERAGE_COMPILATION_I_ ARENE_OFF_BY_DEFAULT
114
#endif
115
116
#ifdef ARENE_DOC_GENERATION_RUNNING
// make this appear when running doxygen, as it won't otherwise.
117
#ifndef ARENE_IS_COVERAGE_COMPILATION
118
#define ARENE_IS_COVERAGE_COMPILATION
119
#endif
120
#endif
121
122
// parasoft-end-suppress AUTOSAR-A16_0_1-d-2
123
// parasoft-end-suppress AUTOSAR-A16_0_1-a-2
124
125
#endif
// INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PLATFORM_QUERIES_COVERAGE_INFO_HPP_
define_configuration.hpp
arene
base
compiler_support
platform_queries
coverage_info.hpp
Generated by
1.13.2