From 02aeb79cdcecff46e4f7c25b5cc18d61ba8a48b6 Mon Sep 17 00:00:00 2001 From: carterl Date: Sun, 15 Feb 2015 09:36:36 +0100 Subject: [PATCH] Silence "warning: declaration of '*' shadows a member of 'this' [-Wshadow]" on mingw-gcc --- format.cc | 9 +++++++++ posix.cc | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/format.cc b/format.cc index 1a6e4e22..124d552f 100644 --- a/format.cc +++ b/format.cc @@ -487,6 +487,11 @@ FMT_FUNC int fmt::internal::UTF16ToUTF8::convert(fmt::WStringRef s) { return 0; } +# ifdef __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wshadow" +# endif + FMT_FUNC void fmt::WindowsError::init( int error_code, StringRef format_str, ArgList args) { error_code_ = error_code; @@ -496,6 +501,10 @@ FMT_FUNC void fmt::WindowsError::init( base = std::runtime_error(w.str()); } +# ifdef __GNUC__ +# pragma GCC diagnostic pop +# endif + #endif FMT_FUNC void fmt::internal::format_system_error( diff --git a/posix.cc b/posix.cc index b4893cd6..f0b1bece 100644 --- a/posix.cc +++ b/posix.cc @@ -134,13 +134,13 @@ void fmt::File::close() { fmt::LongLong fmt::File::size() const { #ifdef _WIN32 - LARGE_INTEGER size = {}; + LARGE_INTEGER filesize = {}; HANDLE handle = reinterpret_cast(_get_osfhandle(fd_)); - if (!FMT_SYSTEM(GetFileSizeEx(handle, &size))) + if (!FMT_SYSTEM(GetFileSizeEx(handle, &filesize))) throw WindowsError(GetLastError(), "cannot get file size"); - FMT_STATIC_ASSERT(sizeof(fmt::LongLong) >= sizeof(size.QuadPart), + FMT_STATIC_ASSERT(sizeof(fmt::LongLong) >= sizeof(filesize.QuadPart), "return type of File::size is not large enough"); - return size.QuadPart; + return filesize.QuadPart; #else typedef struct stat Stat; Stat file_stat = Stat();