From 6c80c6e3c06864d2e59b577f136df2131b00e51c Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Fri, 20 Jun 2025 07:42:07 +0200 Subject: [PATCH 1/2] Add compiler-agnostic function name helper --- modules/core/task/include/task.hpp | 12 ++++++------ modules/core/util/include/util.hpp | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/modules/core/task/include/task.hpp b/modules/core/task/include/task.hpp index 512bc9d6c..ec977ca62 100644 --- a/modules/core/task/include/task.hpp +++ b/modules/core/task/include/task.hpp @@ -109,16 +109,16 @@ class Task { /// @brief Validates input data and task attributes before execution. /// @return True if validation is successful. virtual bool Validation() final { - InternalOrderTest(__builtin_FUNCTION()); + InternalOrderTest(PPC_FUNC_NAME); return ValidationImpl(); } /// @brief Performs preprocessing on the input data. /// @return True if preprocessing is successful. virtual bool PreProcessing() final { - InternalOrderTest(__builtin_FUNCTION()); + InternalOrderTest(PPC_FUNC_NAME); if (state_of_testing_ == StateOfTesting::kFunc) { - InternalTimeTest(__builtin_FUNCTION()); + InternalTimeTest(PPC_FUNC_NAME); } return PreProcessingImpl(); } @@ -126,16 +126,16 @@ class Task { /// @brief Executes the main logic of the task. /// @return True if execution is successful. virtual bool Run() final { - InternalOrderTest(__builtin_FUNCTION()); + InternalOrderTest(PPC_FUNC_NAME); return RunImpl(); } /// @brief Performs postprocessing on the output data. /// @return True if postprocessing is successful. virtual bool PostProcessing() final { - InternalOrderTest(__builtin_FUNCTION()); + InternalOrderTest(PPC_FUNC_NAME); if (state_of_testing_ == StateOfTesting::kFunc) { - InternalTimeTest(__builtin_FUNCTION()); + InternalTimeTest(PPC_FUNC_NAME); } return PostProcessingImpl(); } diff --git a/modules/core/util/include/util.hpp b/modules/core/util/include/util.hpp index ef3112a34..5d94e6b28 100644 --- a/modules/core/util/include/util.hpp +++ b/modules/core/util/include/util.hpp @@ -30,6 +30,12 @@ using NlohmannJsonTypeError = nlohmann::json::type_error; // NOLINT(misc-includ #define INSTANTIATE_TEST_SUITE_P_NOLINT(n, t, g) INSTANTIATE_TEST_SUITE_P(n, t, g) // NOLINT // INSTANTIATE_TEST_SUITE_P | n, t, g, ng == name, test_case_name, generator, name_generator +#if defined(__clang__) || defined(__GNUC__) +#define PPC_FUNC_NAME __PRETTY_FUNCTION__ +#else +#define PPC_FUNC_NAME __func__ +#endif + namespace ppc::util { enum GTestParamIndex : uint8_t { kTaskGetter, kNameTest, kTestParams }; From 1fb91c1ec0949f9cc60bc7a725aedd7c714bb726 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Sat, 21 Jun 2025 15:53:57 +0200 Subject: [PATCH 2/2] Simplify --- modules/core/util/include/util.hpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/core/util/include/util.hpp b/modules/core/util/include/util.hpp index 5d94e6b28..2785084f0 100644 --- a/modules/core/util/include/util.hpp +++ b/modules/core/util/include/util.hpp @@ -6,6 +6,8 @@ #include #include +#define PPC_FUNC_NAME __func__ + #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable : 4459) @@ -30,12 +32,6 @@ using NlohmannJsonTypeError = nlohmann::json::type_error; // NOLINT(misc-includ #define INSTANTIATE_TEST_SUITE_P_NOLINT(n, t, g) INSTANTIATE_TEST_SUITE_P(n, t, g) // NOLINT // INSTANTIATE_TEST_SUITE_P | n, t, g, ng == name, test_case_name, generator, name_generator -#if defined(__clang__) || defined(__GNUC__) -#define PPC_FUNC_NAME __PRETTY_FUNCTION__ -#else -#define PPC_FUNC_NAME __func__ -#endif - namespace ppc::util { enum GTestParamIndex : uint8_t { kTaskGetter, kNameTest, kTestParams };