FMT_COMPILE_STRING_VISIBILITY_ATTRIBUTE -> FMT_GCC_VISIBILITY_HIDDEN, add comments

This commit is contained in:
Alexey Ochapov 2020-11-04 23:47:25 +03:00
parent f480d30ea6
commit f74736dd14
No known key found for this signature in database
GPG Key ID: 9DC52E8F031B8DA8

View File

@ -69,6 +69,13 @@
# define FMT_NOINLINE # define FMT_NOINLINE
#endif #endif
// Special definition specific to GCC only
#if FMT_GCC_VERSION
# define FMT_GCC_VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
#else
# define FMT_GCC_VISIBILITY_HIDDEN
#endif
#if __cplusplus == 201103L || __cplusplus == 201402L #if __cplusplus == 201103L || __cplusplus == 201402L
# if defined(__INTEL_COMPILER) || defined(__PGI) # if defined(__INTEL_COMPILER) || defined(__PGI)
# define FMT_FALLTHROUGH # define FMT_FALLTHROUGH
@ -3198,24 +3205,19 @@ FMT_CONSTEXPR basic_string_view<Char> compile_string_to_view(
return {s.data(), s.size()}; return {s.data(), s.size()};
} }
#if FMT_GCC_VERSION #define FMT_STRING_IMPL(s, base) \
# define FMT_COMPILE_STRING_VISIBILITY_ATTRIBUTE \ [] { \
__attribute__((visibility("hidden"))) /* Use a hidden visibility as workaround for some GCC, see */ \
#else /* https://github.com/fmtlib/fmt/issues/1973 for details */ \
# define FMT_COMPILE_STRING_VISIBILITY_ATTRIBUTE /* Use a macro-like name to avoid shadowing warnings. */ \
#endif struct FMT_GCC_VISIBILITY_HIDDEN FMT_COMPILE_STRING : base { \
using char_type = fmt::remove_cvref_t<decltype(s[0])>; \
#define FMT_STRING_IMPL(s, base) \ FMT_MAYBE_UNUSED FMT_CONSTEXPR \
[] { \ operator fmt::basic_string_view<char_type>() const { \
/* Use a macro-like name to avoid shadowing warnings. */ \ return fmt::detail::compile_string_to_view<char_type>(s); \
struct FMT_COMPILE_STRING_VISIBILITY_ATTRIBUTE FMT_COMPILE_STRING : base { \ } \
using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ }; \
FMT_MAYBE_UNUSED FMT_CONSTEXPR \ return FMT_COMPILE_STRING(); \
operator fmt::basic_string_view<char_type>() const { \
return fmt::detail::compile_string_to_view<char_type>(s); \
} \
}; \
return FMT_COMPILE_STRING(); \
}() }()
/** /**