From 07f8ffc44f6de62f4fbdd2faf59244997c3bf2e0 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 21 Aug 2017 06:50:57 -0700 Subject: [PATCH] Suppress shadowing warnings --- fmt/format.cc | 4 ++++ fmt/format.h | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/fmt/format.cc b/fmt/format.cc index 339138f8..266f8702 100644 --- a/fmt/format.cc +++ b/fmt/format.cc @@ -58,6 +58,10 @@ # define FMT_CATCH(x) if (false) #endif +// Disable the warning about declaration shadowing because it affects too +// many valid cases. +#pragma GCC diagnostic ignored "-Wshadow" + #ifdef _MSC_VER # pragma warning(push) # pragma warning(disable: 4127) // conditional expression is constant diff --git a/fmt/format.h b/fmt/format.h index 6c32ecc1..b2f3e56a 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -3766,6 +3766,13 @@ operator"" _a(const wchar_t *s, std::size_t) { return {s}; } } // namespace fmt #endif // FMT_USE_USER_DEFINED_LITERALS +#ifdef FMT_HEADER_ONLY +# define FMT_FUNC inline +# include "format.cc" +#else +# define FMT_FUNC +#endif + // Restore warnings. #if FMT_GCC_VERSION >= 406 # pragma GCC diagnostic pop @@ -3775,11 +3782,4 @@ operator"" _a(const wchar_t *s, std::size_t) { return {s}; } # pragma clang diagnostic pop #endif -#ifdef FMT_HEADER_ONLY -# define FMT_FUNC inline -# include "format.cc" -#else -# define FMT_FUNC -#endif - #endif // FMT_FORMAT_H_