Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
stringize.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_PREPROCESSOR_STRINGIZE_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PREPROCESSOR_STRINGIZE_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 safely convert a macro
18// argument to a string literal, for use in supporting other basic facilities
19// such as the contract checking.
20
21// NOLINTBEGIN(cppcoreguidelines-macro-usage)
22// parasoft-begin-suppress AUTOSAR-A16_0_1-d-2 "Function-like macro permitted by A16-0-1 Permit #1"
23
24/// Internal macro for actually converting a macro argument to a string literal.
25/// DO NOT CALL DIRECTLY.
26/// @param ... the macro argument to convert.
27// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
28#define ARENE_STRINGIZE_INTERNAL(...) #__VA_ARGS__
29/// Macro for actually converting a macro argument to a string literal.
30/// @param ... the macro argument to convert.
31// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
32#define ARENE_STRINGIZE(...) ARENE_STRINGIZE_INTERNAL(__VA_ARGS__)
33
34// NOLINTEND(cppcoreguidelines-macro-usage)
35// parasoft-end-suppress AUTOSAR-A16_0_1-d-2
36
37#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_PREPROCESSOR_STRINGIZE_HPP_