config: avoid using pretty function with gcc < 9 (see #396)

This commit is contained in:
Michele Caini
2020-01-25 00:57:52 +01:00
parent fc0432df8c
commit f32f3ab895
2 changed files with 14 additions and 5 deletions

View File

@@ -56,6 +56,10 @@
#ifndef ENTT_STANDARD_CPP
# if defined _MSC_VER
# define ENTT_PRETTY_FUNCTION __FUNCSIG__
# define ENTT_PRETTY_FUNCTION_CONSTEXPR ENTT_PRETTY_FUNCTION
# elif defined __clang__ || (defined __GNUC__ && __GNUC__ > 8)
# define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
# define ENTT_PRETTY_FUNCTION_CONSTEXPR ENTT_PRETTY_FUNCTION
# elif defined __GNUC__
# define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
# endif

View File

@@ -7,10 +7,10 @@
#include "hashed_string.hpp"
#ifdef ENTT_PRETTY_FUNCTION
# define ENTT_TYPE_ID_API
#else
#ifndef ENTT_PRETTY_FUNCTION
# define ENTT_TYPE_ID_API ENTT_API
#else
# define ENTT_TYPE_ID_API
#endif
@@ -55,9 +55,14 @@ struct ENTT_TYPE_ID_API type_info {
* @brief Returns the numeric representation of a given type.
* @return The numeric representation of the given type.
*/
#ifdef ENTT_PRETTY_FUNCTION
#if defined ENTT_PRETTY_FUNCTION_CONSTEXPR
static constexpr ENTT_ID_TYPE id() ENTT_NOEXCEPT {
constexpr auto value = entt::hashed_string::value(ENTT_PRETTY_FUNCTION);
constexpr auto value = entt::hashed_string::value(ENTT_PRETTY_FUNCTION_CONSTEXPR);
return value;
}
#elif defined ENTT_PRETTY_FUNCTION
static ENTT_ID_TYPE id() ENTT_NOEXCEPT {
static const auto value = entt::hashed_string::value(ENTT_PRETTY_FUNCTION);
return value;
}
#else