From 5e2125aeb119df92acd362a22fa4829ef0042eec Mon Sep 17 00:00:00 2001 From: Tao He Date: Tue, 7 Sep 2021 11:03:21 +0800 Subject: [PATCH] Enable constexpr __PRETTY_FUNCTION__ only for gcc >= 9.1.0. (#492) See also: https://github.com/Manu343726/ctti/issues/35 Signed-off-by: Tao He --- src/common/util/typename.h | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/common/util/typename.h b/src/common/util/typename.h index 35e037fc9..b84deba88 100644 --- a/src/common/util/typename.h +++ b/src/common/util/typename.h @@ -50,8 +50,7 @@ inline const std::string typename_unpack_args() { return type_name() + "," + typename_unpack_args(); } -#if defined(__VINEYARD_GCC_VERSION) && \ - (__VINEYARD_GCC_VERSION <= 50100 || __VINEYARD_GCC_VERSION >= 70200) +#if defined(__VINEYARD_GCC_VERSION) && __VINEYARD_GCC_VERSION <= 90100 #if defined(__clang__) #define __TYPENAME_FROM_FUNCTION_PREFIX \ @@ -80,18 +79,24 @@ inline const std::string __typename_from_function() { template inline const std::string typename_impl(T const&) { -#if defined(__VINEYARD_GCC_VERSION) && \ - (__VINEYARD_GCC_VERSION <= 50100 || __VINEYARD_GCC_VERSION >= 70200) - return ctti::nameof().cppstring(); -#else +#if defined(__VINEYARD_GCC_VERSION) && __VINEYARD_GCC_VERSION <= 90100 return __typename_from_function(); +#else + return ctti::nameof().cppstring(); #endif } template