Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
concatenate.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
#
ifndef
INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PREPROCESSOR_CONCATENATE_HPP_
6
#
define
INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PREPROCESSOR_CONCATENATE_HPP_
7
8
// IWYU pragma: private, include "arene/base/compiler_support/preprocessor.hpp"
9
10
// AUTOSAR exceptions:
11
// A16-0-1 The pre-processor shall only be used for unconditional and
12
// conditional file inclusion and include guards, and using the following
13
// directives: (1) #ifndef, (2) #ifdef, (3) #if, (4) #if defined, (5) #elif, (6)
14
// #else, (7) #define, (8) #endif, (9) #include.
15
//
16
// Exception Rationale: The code below is used to concatenate __FILE__ and __LINE__ with other tokens, which is needed
17
// to generate unique identifiers for macro-based libraries like Google Test.
18
19
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
20
// parasoft-begin-suppress AUTOSAR-A16_0_1-d-2 "Function-like macro permitted by A16-0-1 Permit #1"
21
// parasoft-begin-suppress CERT_C-PRE30-a "Token concatenation is necessary because Google Test does it too"
22
// parasoft-begin-suppress AUTOSAR-M16_0_6-a "The purpose of these macros is to concatenate tokens, not generate code"
23
24
/// @brief Concatenate two preprocessor tokens together.
25
/// This has to be nested inside another macro in order to avoid the ## taking precedence over evaluating __LINE__.
26
/// @param left The left token to concatenate
27
/// @param right The right token to concatenate
28
#
define
ARENE_CONCATENATE_IMPL
(
left
,
right
)
left
##
right
29
30
/// @brief Concatenate two tokens together, similar to ## except that arguments are replaced before concatenation.
31
/// @param left The left token to concatenate
32
/// @param right The right token to concatenate
33
#
define
ARENE_CONCATENATE
(
left
,
right
)
ARENE_CONCATENATE_IMPL
(
left
,
right
)
34
35
// parasoft-end-suppress AUTOSAR-M16_0_6-a
36
// parasoft-end-suppress CERT_C-PRE30-a
37
// parasoft-end-suppress AUTOSAR-A16_0_1-d-2
38
// NOLINTEND(cppcoreguidelines-macro-usage)
39
40
#
endif
// INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PREPROCESSOR_CONCATENATE_HPP_
ARENE_CONCATENATE_IMPL
#define ARENE_CONCATENATE_IMPL(left, right)
Concatenate two preprocessor tokens together. This has to be nested inside another macro in order to ...
Definition
concatenate.hpp:28
arene
base
compiler_support
preprocessor
concatenate.hpp
Generated by
1.13.2