Skip to content

Commit

Permalink
-Wattributes visibility warning with some GCC versions (#1975)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexezeder authored Nov 5, 2020
1 parent cba5970 commit 6a2495c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@
# define FMT_NOINLINE
#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 defined(__INTEL_COMPILER) || defined(__PGI)
# define FMT_FALLTHROUGH
Expand Down Expand Up @@ -3200,8 +3207,10 @@ FMT_CONSTEXPR basic_string_view<Char> compile_string_to_view(

#define FMT_STRING_IMPL(s, base) \
[] { \
/* Use a hidden visibility as workaround for some GCC, see */ \
/* https://github.com/fmtlib/fmt/issues/1973 for details */ \
/* Use a macro-like name to avoid shadowing warnings. */ \
struct FMT_COMPILE_STRING : base { \
struct FMT_GCC_VISIBILITY_HIDDEN FMT_COMPILE_STRING : base { \
using char_type = fmt::remove_cvref_t<decltype(s[0])>; \
FMT_MAYBE_UNUSED FMT_CONSTEXPR \
operator fmt::basic_string_view<char_type>() const { \
Expand Down

0 comments on commit 6a2495c

Please sign in to comment.