From fe11777d7873ab2c73fcaf91536cdb9edfafea20 Mon Sep 17 00:00:00 2001 From: Alexey Ochapov Date: Wed, 4 Nov 2020 01:04:12 +0300 Subject: [PATCH] actual fix to eliminate warnings --- include/fmt/format.h | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index ea45429f..87c62fed 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3198,17 +3198,24 @@ FMT_CONSTEXPR basic_string_view compile_string_to_view( return {s.data(), s.size()}; } -#define FMT_STRING_IMPL(s, base) \ - [] { \ - /* Use a macro-like name to avoid shadowing warnings. */ \ - struct FMT_COMPILE_STRING : base { \ - using char_type = fmt::remove_cvref_t; \ - FMT_MAYBE_UNUSED FMT_CONSTEXPR \ - operator fmt::basic_string_view() const { \ - return fmt::detail::compile_string_to_view(s); \ - } \ - }; \ - return FMT_COMPILE_STRING(); \ +#if defined(FMT_GCC_VERSION) && FMT_GCC_VERSION >= 400 +# define FMT_COMPILE_STRING_VISIBILITY_ATTRIBUTE \ + __attribute__((visibility("hidden"))) +#else +# define FMT_COMPILE_STRING_VISIBILITY_ATTRIBUTE +#endif + +#define FMT_STRING_IMPL(s, base) \ + [] { \ + /* Use a macro-like name to avoid shadowing warnings. */ \ + struct FMT_COMPILE_STRING_VISIBILITY_ATTRIBUTE FMT_COMPILE_STRING : base { \ + using char_type = fmt::remove_cvref_t; \ + FMT_MAYBE_UNUSED FMT_CONSTEXPR \ + operator fmt::basic_string_view() const { \ + return fmt::detail::compile_string_to_view(s); \ + } \ + }; \ + return FMT_COMPILE_STRING(); \ }() /**