From 0affb235606e9fc6cb1238b0143fed32463289ef Mon Sep 17 00:00:00 2001 From: Radu Popescu Date: Tue, 4 Aug 2015 12:52:44 +0200 Subject: [PATCH] fixed #190 Argument shadowing and Clang pedantic support --- CMakeLists.txt | 3 +++ format.cc | 4 ++-- format.h | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b48b183a..8c95fd70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,9 @@ if (FMT_PEDANTIC AND CMAKE_COMPILER_IS_GNUCXX) set_target_properties(cppformat PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Wshadow -pedantic") endif () +if (FMT_PEDANTIC AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wshadow -pedantic") +endif () # If FMT_PEDANTIC is TRUE, then test compilation with both -std=c++11 # and the default flags. Otherwise use only the default flags. diff --git a/format.cc b/format.cc index 6dd52b87..8b0e763c 100644 --- a/format.cc +++ b/format.cc @@ -205,8 +205,8 @@ int safe_strerror( } public: - StrError(int error_code, char *&buffer, std::size_t buffer_size) - : error_code_(error_code), buffer_(buffer), buffer_size_(buffer_size) {} + StrError(int err_code, char *&buf, std::size_t buf_size) + : error_code_(err_code), buffer_(buf), buffer_size_(buf_size) {} int run() { strerror_r(0, 0, ""); // Suppress a warning about unused strerror_r. diff --git a/format.h b/format.h index 2a985f16..d384cfef 100644 --- a/format.h +++ b/format.h @@ -1046,8 +1046,8 @@ struct NamedArg : Arg { BasicStringRef name; template - NamedArg(BasicStringRef name, const T &value) - : name(name), Arg(MakeValue(value)) { + NamedArg(BasicStringRef argname, const T &value) + : name(argname), Arg(MakeValue(value)) { type = static_cast(MakeValue::type(value)); } };