Skip to content

Commit 5cc9422

Browse files
authored
Add portable function name helper (#446)
- Add `PPC_FUNC_NAME` macro providing compiler agnostic pure function name - Replace `__builtin_FUNCTION()` with `PPC_FUNC_NAME` macro in `task.hpp`
1 parent 4ed7bb6 commit 5cc9422

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

modules/core/task/include/task.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,33 +107,33 @@ class Task {
107107
/// @brief Validates input data and task attributes before execution.
108108
/// @return True if validation is successful.
109109
virtual bool Validation() final {
110-
InternalOrderTest(__builtin_FUNCTION());
110+
InternalOrderTest(PPC_FUNC_NAME);
111111
return ValidationImpl();
112112
}
113113

114114
/// @brief Performs preprocessing on the input data.
115115
/// @return True if preprocessing is successful.
116116
virtual bool PreProcessing() final {
117-
InternalOrderTest(__builtin_FUNCTION());
117+
InternalOrderTest(PPC_FUNC_NAME);
118118
if (state_of_testing_ == StateOfTesting::kFunc) {
119-
InternalTimeTest(__builtin_FUNCTION());
119+
InternalTimeTest(PPC_FUNC_NAME);
120120
}
121121
return PreProcessingImpl();
122122
}
123123

124124
/// @brief Executes the main logic of the task.
125125
/// @return True if execution is successful.
126126
virtual bool Run() final {
127-
InternalOrderTest(__builtin_FUNCTION());
127+
InternalOrderTest(PPC_FUNC_NAME);
128128
return RunImpl();
129129
}
130130

131131
/// @brief Performs postprocessing on the output data.
132132
/// @return True if postprocessing is successful.
133133
virtual bool PostProcessing() final {
134-
InternalOrderTest(__builtin_FUNCTION());
134+
InternalOrderTest(PPC_FUNC_NAME);
135135
if (state_of_testing_ == StateOfTesting::kFunc) {
136-
InternalTimeTest(__builtin_FUNCTION());
136+
InternalTimeTest(PPC_FUNC_NAME);
137137
}
138138
return PostProcessingImpl();
139139
}

modules/core/util/include/util.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <string>
77
#include <string_view>
88

9+
#define PPC_FUNC_NAME __func__
10+
911
#ifdef _MSC_VER
1012
#pragma warning(push)
1113
#pragma warning(disable : 4459)

0 commit comments

Comments
 (0)