From d6c6b9bdb89b6297eecb5e3c2c09fbf71ab2dd00 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 19 Feb 2020 22:26:31 -0500 Subject: [PATCH] Gives function overloading a try. --- Analyser/Static/Macintosh/Target.hpp | 16 ++++++++++++++-- .../xcschemes/Clock Signal Kiosk.xcscheme | 1 + Reflection/Enum.h | 10 +++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Analyser/Static/Macintosh/Target.hpp b/Analyser/Static/Macintosh/Target.hpp index d1bb2d5be..eac46acb7 100644 --- a/Analyser/Static/Macintosh/Target.hpp +++ b/Analyser/Static/Macintosh/Target.hpp @@ -11,7 +11,6 @@ #include "../../../Reflection/Enum.h" -ReflectiveEnum(MacintoshModel, int, Mac128k, Mac512k, Mac128ke, MacPlus); namespace Analyser { namespace Static { @@ -19,11 +18,24 @@ namespace Macintosh { struct Target: public ::Analyser::Static::Target { - MacintoshModel model = MacintoshModel::MacPlus; + ReflectiveEnum(Model, int, Mac128k, Mac512k, Mac512ke, MacPlus); + + Target() { +// Model m; +// printf("%s\n", __declaration(m)); + printf("%zu\n", Reflection::Enum::size()); +// for(size_t c = 0; c < Reflection::Enum::size(); ++c) { +// const auto name = Reflection::Enum::toString(Model(c)); +// printf("%.*s\n", int(name.size()), name.data()); +// } + } + + Model model = Model::MacPlus; }; } } } + #endif /* Analyser_Static_Macintosh_Target_h */ diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal Kiosk.xcscheme b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal Kiosk.xcscheme index 6993d95b7..f84023923 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal Kiosk.xcscheme +++ b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal Kiosk.xcscheme @@ -34,6 +34,7 @@ buildConfiguration = "Release" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + enableThreadSanitizer = "YES" disableMainThreadChecker = "YES" launchStyle = "0" useCustomWorkingDirectory = "NO" diff --git a/Reflection/Enum.h b/Reflection/Enum.h index 0b7c329c9..49359c271 100644 --- a/Reflection/Enum.h +++ b/Reflection/Enum.h @@ -40,8 +40,8 @@ template struct Enum { @returns A vector of string_views naming the members of this enum in value order. */ static std::vector members() { - Enum m; - const char *const declaration = m.declaration(); + EnumType m; + const char *const declaration = __declaration(m); const char *d_ptr = declaration; std::vector result; @@ -60,10 +60,6 @@ template struct Enum { return result; } - - private: - constexpr const char *declaration(); - }; } @@ -75,6 +71,6 @@ template struct Enum { */ #define ReflectiveEnum(Name, Type, ...) \ enum class Name: Type { __VA_ARGS__ }; \ - template <> constexpr const char *::Reflection::Enum::declaration() { return #__VA_ARGS__; }; + constexpr const char *__declaration(Name) { return #__VA_ARGS__; } #endif /* Enum_h */