From 4a8bd7772084d0154279e6797feff821c1742d81 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 21 Dec 2020 14:21:29 +0000 Subject: Don't generate static macros Moves FORWARD_ENUM into impl header --- slicer/slicer/modelPartsTypes.impl.h | 6 ++++++ slicer/tool/parser.cpp | 14 -------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h index 346a894..ba30abe 100644 --- a/slicer/slicer/modelPartsTypes.impl.h +++ b/slicer/slicer/modelPartsTypes.impl.h @@ -78,6 +78,12 @@ } \ } +#ifdef ICE_CPP11_MAPPING // C++11 mapping +# define FORWARD_ENUM(name) enum class ICE_CLASS(JAM_DLL_PUBLIC) name : unsigned char; +#else // C++98 mapping +# define FORWARD_ENUM(name) enum ICE_CLASS(JAM_DLL_PUBLIC) name; +#endif + #ifdef __clang__ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wundefined-var-template" diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp index 7759ebc..91407bc 100644 --- a/slicer/tool/parser.cpp +++ b/slicer/tool/parser.cpp @@ -42,20 +42,6 @@ namespace Slicer { public: ForwardDeclare(FILE * c, const Count & cnt) : cpp(c), count(cnt) { } - bool - visitUnitStart(const Slice::UnitPtr &) override - { - if (count.enums) { - fprintbf(cpp, "#ifdef ICE_CPP11_MAPPING // C++11 mapping\n"); - fprintbf( - cpp, "#define FORWARD_ENUM(name) enum class ICE_CLASS(JAM_DLL_PUBLIC) name : unsigned char;\n"); - fprintbf(cpp, "#else // C++98 mapping\n"); - fprintbf(cpp, "#define FORWARD_ENUM(name) enum ICE_CLASS(JAM_DLL_PUBLIC) name;\n"); - fprintbf(cpp, "#endif\n\n"); - } - return true; - } - bool visitModuleStart(const Slice::ModulePtr & m) override { -- cgit v1.2.3