From a2333ca9f8f931c3b811068733beb25152ff400c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 25 Jun 2025 14:34:30 +0100 Subject: [PATCH] Revert "Small refactor of VSG_type_name macro to make it possible to depracate EVSG_type_name macro." --- include/vsg/core/type_name.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/vsg/core/type_name.h b/include/vsg/core/type_name.h index 428de8ef78..babcff048c 100644 --- a/include/vsg/core/type_name.h +++ b/include/vsg/core/type_name.h @@ -38,15 +38,17 @@ namespace vsg template<> constexpr const char* type_name() noexcept { return "float"; } template<> constexpr const char* type_name() noexcept { return "double"; } - /// Helper macro for defining the type_name() for a type, if used within vsg namespace you can put in alongside the class. - /// If adding type name for a class in another namespace you must put the macro in the global scope rather than within the namespace, otherwise you'll get a namespace related compile error. + // helper define for defining the type_name() for a type within the vsg namespace. #define VSG_type_name(T) \ + template<> constexpr const char* type_name() noexcept { return #T; } \ + template<> constexpr const char* type_name() noexcept { return "const "#T; } + + + // helper define for defining the type_name() for a type in a namespace other than vsg, note must be placed in global namespace. + #define EVSG_type_name(T) \ template<> constexpr const char* vsg::type_name() noexcept { return #T; } \ template<> constexpr const char* vsg::type_name() noexcept { return "const "#T; } - /// deprecated, it's now possible to use the VSG_type_name() directly. - #define EVSG_type_name(T) VSG_type_name(T) - // clang-format on } // namespace vsg