Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed #190 Argument shadowing and Clang pedantic support #191

Merged
merged 1 commit into from
Aug 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions format.h
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,8 @@ struct NamedArg : Arg {
BasicStringRef<Char> name;

template <typename T>
NamedArg(BasicStringRef<Char> name, const T &value)
: name(name), Arg(MakeValue<Char>(value)) {
NamedArg(BasicStringRef<Char> argname, const T &value)
: name(argname), Arg(MakeValue<Char>(value)) {
type = static_cast<internal::Arg::Type>(MakeValue<Char>::type(value));
}
};
Expand Down