diff options
Diffstat (limited to 'options')
-rw-r--r-- | options/metatype.cpp | 17 | ||||
-rw-r--r-- | options/metatype.hpp | 2 |
2 files changed, 8 insertions, 11 deletions
diff --git a/options/metatype.cpp b/options/metatype.cpp index 3b8ec690..4db0b3fd 100644 --- a/options/metatype.cpp +++ b/options/metatype.cpp @@ -4,25 +4,22 @@ namespace options::detail { template<typename t> -int declare_metatype_for_type(const char* str) +void declare_metatype_for_type(const char* str) { qRegisterMetaType<t>(str); qRegisterMetaTypeStreamOperators<t>(); - - return -1; } } // ns options::detail -#define OPENTRACK_DEFINE_METATYPE2(t, sym) \ - class sym { /* NOLINT */ \ - static const int dribble; \ - }; /* NOLINT */ \ - static sym sym; \ - const int sym :: dribble = ::options::detail::declare_metatype_for_type<t>(#t); +#define OPENTRACK_DEFINE_METATYPE2(t, ctr) \ + namespace { /* NOLINT(cert-dcl59-cpp) */ \ + static const char ctr = /* NOLINT(misc-definitions-in-headers) */ \ + (::options::detail::declare_metatype_for_type<t>(#t), 0); \ + } // anon ns #define OPENTRACK_DEFINE_METATYPE(t) \ - OPENTRACK_DEFINE_METATYPE2(t, PP_CAT(init, __COUNTER__)) + OPENTRACK_DEFINE_METATYPE2(t, PP_CAT(kipple_, __COUNTER__)) #define OPENTRACK_METATYPE_(x) OPENTRACK_DEFINE_METATYPE(x) #include "metatype.hpp" diff --git a/options/metatype.hpp b/options/metatype.hpp index bf149200..ca0947fb 100644 --- a/options/metatype.hpp +++ b/options/metatype.hpp @@ -10,7 +10,7 @@ #include <QMetaType> -#if !defined OPENTRACK_METATYPE_ || defined Q_CREATOR_RUN || defined __clang_analyzer__ +#if !defined OPENTRACK_METATYPE_ # define OPENTRACK_METATYPE(x) Q_DECLARE_METATYPE(x) #else # define OPENTRACK_METATYPE(x) Q_DECLARE_METATYPE(x) OPENTRACK_METATYPE_(x) |