From eaa715362cbb291414aeea0eb7089bcc7c53ad3a Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Sun, 3 Mar 2024 11:08:29 +0100 Subject: [PATCH] Added explanatory notes for clang on windows --- README.md | 1 - include/rfl/internal/enums/get_enum_names.hpp | 4 +++- include/rfl/internal/get_field_names.hpp | 2 ++ include/rfl/internal/get_type_name.hpp | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 10304129..402705e7 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ Design principles for reflect-cpp include: - Simple installation: If no JSON support is required, reflect-cpp is header-only. For JSON support, only a single source file needs to be compiled. - Simple extendability to other serialization formats - Simple extendability to custom classes -- Standard C++ only, no compiler-specific macros ## Serialization formats diff --git a/include/rfl/internal/enums/get_enum_names.hpp b/include/rfl/internal/enums/get_enum_names.hpp index b89e5ef9..0dd08d70 100644 --- a/include/rfl/internal/enums/get_enum_names.hpp +++ b/include/rfl/internal/enums/get_enum_names.hpp @@ -7,9 +7,9 @@ #include "../../Literal.hpp" #include "../../define_literal.hpp" +#include "../../internal/remove_namespaces.hpp" #include "Names.hpp" #include "is_scoped_enum.hpp" -#include "../../internal/remove_namespaces.hpp" // https://en.cppreference.com/w/cpp/language/static_cast: @@ -41,6 +41,8 @@ namespace enums { template consteval auto get_enum_name_str_view() { + // Unfortunately, we cannot avoid the use of a compiler-specific macro for + // Clang on Windows. For all other compilers, function_name works as intended. #if defined(__clang__) && defined(_MSC_VER) const auto func_name = std::string_view{__PRETTY_FUNCTION__}; #else diff --git a/include/rfl/internal/get_field_names.hpp b/include/rfl/internal/get_field_names.hpp index 347e2865..01e743e2 100644 --- a/include/rfl/internal/get_field_names.hpp +++ b/include/rfl/internal/get_field_names.hpp @@ -43,6 +43,8 @@ constexpr auto wrap(const T& arg) noexcept { template consteval auto get_field_name_str_view() { + // Unfortunately, we cannot avoid the use of a compiler-specific macro for + // Clang on Windows. For all other compilers, function_name works as intended. #if defined(__clang__) && defined(_MSC_VER) const auto func_name = std::string_view{__PRETTY_FUNCTION__}; #else diff --git a/include/rfl/internal/get_type_name.hpp b/include/rfl/internal/get_type_name.hpp index 5e861f3b..a35aa8a8 100644 --- a/include/rfl/internal/get_type_name.hpp +++ b/include/rfl/internal/get_type_name.hpp @@ -10,6 +10,8 @@ namespace internal { template consteval auto get_type_name_str_view() { + // Unfortunately, we cannot avoid the use of a compiler-specific macro for + // Clang on Windows. For all other compilers, function_name works as intended. #if defined(__clang__) && defined(_MSC_VER) const auto func_name = std::string_view{__PRETTY_FUNCTION__}; #else