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