Adding warning and fixing related warning on code

Adding Wshadow in the list of warnings as it might be useful to debug some hardly debuggable issues
Adding Werror in the list of warnings as the project doesn't raise any warning for now, it might be useful to keep it that way
Sorting warnings by alphabetetical order
Fixing Wshadow warning
pull/1626/head
Buissart-Dubois, Julien 5 years ago
parent ae02fba141
commit 2bcc1397d9

@ -29,21 +29,27 @@ endfunction()
function(spdlog_enable_warnings target_name)
if(SPDLOG_BUILD_WARNINGS)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
list(APPEND MSVC_OPTIONS "/W3")
list(APPEND WARNING_OPTIONS "/W3")
if(MSVC_VERSION GREATER 1900) # Allow non fatal security warnings for msvc 2015
list(APPEND MSVC_OPTIONS "/WX")
list(APPEND WARNING_OPTIONS "/WX")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL ".*Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
list(APPEND WARNING_OPTIONS
-Wall
-Wconversion
-Werror
-Wextra
-Wfatal-errors
-Wpedantic
-Wshadow
)
endif()
target_compile_options(
${target_name}
PRIVATE $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall
-Wextra
-Wconversion
-pedantic
-Wfatal-errors>
$<$<CXX_COMPILER_ID:MSVC>:${MSVC_OPTIONS}>)
PRIVATE
${WARNING_OPTIONS}
)
endif()
endfunction()

@ -1252,10 +1252,10 @@ class dynamic_arg_list {
public:
template <typename T, typename Arg> const T& push(const Arg& arg) {
auto node = std::unique_ptr<typed_node<T>>(new typed_node<T>(arg));
auto& value = node->value;
node->next = std::move(head_);
head_ = std::move(node);
auto node_ptr = std::unique_ptr<typed_node<T>>(new typed_node<T>(arg));
auto& value = node_ptr->value;
node_ptr->next = std::move(head_);
head_ = std::move(node_ptr);
return value;
}
};

@ -3244,9 +3244,9 @@ template <> struct formatter<bytes> {
specs_.precision, specs_.precision_ref, ctx);
using range_type =
internal::output_range<typename FormatContext::iterator, char>;
internal::basic_writer<range_type> writer(range_type(ctx.out()));
writer.write_bytes(b.data_, specs_);
return writer.out();
internal::basic_writer<range_type> format_writer(range_type(ctx.out()));
format_writer.write_bytes(b.data_, specs_);
return format_writer.out();
}
private:

Loading…
Cancel
Save