Remove (some) explicit warning suppressions

Fix C++ standard setting in CI
This commit is contained in:
Elias Kosunen 2018-05-22 09:10:01 +03:00
parent 194616e8c5
commit 584a99c934
6 changed files with 19 additions and 55 deletions

View File

@ -120,7 +120,7 @@ matrix:
# Errors
- env: CXX_COMPILER=g++-4.8 BUILD=Debug STANDARD=11
compiler: gcc
- env: CXX_COMPILER=g++-4.4 BUILD=Debug STANDARD=0x
- env: CXX_COMPILER=g++-4.4 BUILD=Debug STANDARD=11
compiler: gcc
before_script:

View File

@ -35,6 +35,14 @@ option(FMT_INSTALL "Generate the install target." ${MASTER_PROJECT})
option(FMT_TEST "Generate the test target." ${MASTER_PROJECT})
option(FMT_USE_CPP14 "Enable the addition of C++14 compiler flags." ON)
if (NOT CMAKE_CXX_STANDARD)
if (FMT_USE_CPP14)
set(CMAKE_CXX_STANDARD 14)
else ()
set(CMAKE_CXX_STANDARD 11)
endif()
endif()
project(FMT)
# Get version from core.h
@ -67,7 +75,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
-Wcast-align -Wnon-virtual-dtor
-Wctor-dtor-privacy -Wdisabled-optimization
-Winvalid-pch -Wmissing-declarations -Woverloaded-virtual
-Wno-sign-conversion -Wno-shadow)
-Wno-sign-conversion -Wno-shadow -Wno-format-nonliteral
-Wno-dangling-else)
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wnoexcept)
endif ()
@ -90,7 +99,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-reserved-id-macro
-Wno-global-constructors -Wno-disabled-macro-expansion
-Wno-switch-enum -Wno-documentation-unknown-command
-Wno-gnu-string-literal-operator-template)
-Wno-gnu-string-literal-operator-template -Wno-unused-member-function
-Wno-format-nonliteral -Wno-missing-noreturn -Wno-undefined-func-template)
set(WERROR_FLAG -Werror)
endif ()

View File

@ -566,7 +566,7 @@ FMT_MAKE_VALUE(bool_type, bool, int)
FMT_MAKE_VALUE(int_type, short, int)
FMT_MAKE_VALUE(uint_type, unsigned short, unsigned)
FMT_MAKE_VALUE_SAME(int_type, int)
FMT_MAKE_VALUE(uint_type, unsigned, unsigned)
FMT_MAKE_VALUE_SAME(uint_type, unsigned)
// To minimize the number of types we need to deal with, long is translated
// either to int or to long long depending on its size.
@ -581,7 +581,7 @@ FMT_MAKE_VALUE(
unsigned long, ulong_type)
FMT_MAKE_VALUE_SAME(long_long_type, long long)
FMT_MAKE_VALUE(ulong_long_type, unsigned long long, unsigned long long)
FMT_MAKE_VALUE_SAME(ulong_long_type, unsigned long long)
FMT_MAKE_VALUE(int_type, signed char, int)
FMT_MAKE_VALUE(uint_type, unsigned char, unsigned)
FMT_MAKE_VALUE(char_type, char, int)

View File

@ -113,11 +113,6 @@ int safe_strerror(
// A noop assignment operator to avoid bogus warnings.
void operator=(const StrError &) {}
#if FMT_CLANG_VERSION
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunused-member-function"
#endif
// Handle the result of XSI-compliant version of strerror_r.
int handle(int result) {
// glibc versions before 2.13 return result in errno.
@ -152,10 +147,6 @@ int safe_strerror(
return errno;
}
#if FMT_CLANG_VERSION
# pragma clang diagnostic pop
#endif
public:
StrError(int err_code, char *&buf, std::size_t buf_size)
: error_code_(err_code), buffer_(buf), buffer_size_(buf_size) {}
@ -221,11 +212,6 @@ FMT_FUNC void system_error::init(
}
namespace internal {
#if FMT_GCC_VERSION >= 406 || FMT_CLANG_VERSION
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
template <typename T>
int char_traits<char>::format_float(
char *buffer, std::size_t size, const char *format,
@ -254,10 +240,6 @@ int char_traits<wchar_t>::format_float(
FMT_SWPRINTF(buffer, size, format, width, precision, value);
}
#if FMT_GCC_VERSION >= 406 || FMT_CLANG_VERSION
# pragma GCC diagnostic pop
#endif
template <typename T>
const char basic_data<T>::DIGITS[] =
"0001020304050607080910111213141516171819"
@ -477,16 +459,9 @@ void basic_fixed_buffer<Char>::grow(std::size_t) {
FMT_THROW(std::runtime_error("buffer overflow"));
}
#if FMT_CLANG_VERSION
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wmissing-noreturn"
#endif
FMT_FUNC void internal::error_handler::on_error(const char *message) {
FMT_THROW(format_error(message));
}
#if FMT_CLANG_VERSION
# pragma clang diagnostic pop
#endif
FMT_FUNC void report_system_error(
int error_code, fmt::string_view message) FMT_NOEXCEPT {

View File

@ -70,18 +70,6 @@
# pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
#if FMT_CLANG_VERSION && !FMT_ICC_VERSION
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wswitch-enum"
# pragma clang diagnostic ignored "-Wweak-vtables"
# pragma clang diagnostic ignored "-Wpadded"
# pragma clang diagnostic ignored "-Wgnu-statement-expression"
# pragma clang diagnostic ignored "-Wglobal-constructors"
# pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
# pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
# pragma clang diagnostic ignored "-Wgnu-string-literal-operator-template"
#endif
#include "core.h"
#ifdef _SECURE_SCL
@ -1617,6 +1605,8 @@ FMT_CONSTEXPR unsigned parse_nonnegative_int(Iterator &it, ErrorHandler &&eh) {
}
#if FMT_MSC_VER
// Warns that the compiler cannot generate an assignment operator
// The class has a reference member variable, so this is obviously the case
# pragma warning(push)
# pragma warning(disable: 4512)
#endif
@ -2563,18 +2553,11 @@ class basic_writer {
};
void on_num() {
#if FMT_CLANG_VERSION
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wundefined-func-template"
#endif
unsigned num_digits = internal::count_digits(abs_value);
char_type sep = internal::thousands_sep<char_type>(writer.locale_.get());
unsigned size = num_digits + SEP_SIZE * ((num_digits - 1) / 3);
writer.write_int(size, get_prefix(), spec,
num_writer{abs_value, size, sep});
#if FMT_CLANG_VERSION
# pragma clang diagnostic pop
#endif
}
void on_error() {
@ -3693,8 +3676,4 @@ FMT_END_NAMESPACE
# pragma GCC diagnostic pop
#endif
#if FMT_CLANG_VERSION && !defined(FMT_ICC_VERSION)
# pragma clang diagnostic pop
#endif
#endif // FMT_FORMAT_H_

View File

@ -90,7 +90,7 @@ common_cmake_flags = [
]
extra_cmake_flags = []
if standard != '14':
extra_cmake_flags = ['-DCMAKE_CXX_FLAGS=-std=c++' + standard]
extra_cmake_flags = ['-DCMAKE_CXX_STANDARD=' + standard]
check_call(['cmake', '-DFMT_DOC=OFF', '-DFMT_PEDANTIC=ON', '-DFMT_WERROR=ON', fmt_dir] +
common_cmake_flags + extra_cmake_flags, cwd=build_dir)
@ -110,7 +110,7 @@ check_call(['make', 'install'], cwd=build_dir)
# Test installation.
makedirs_if_not_exist(test_build_dir)
check_call(['cmake', '-DCMAKE_CXX_FLAGS=-std=c++' + standard,
check_call(['cmake', '-DCMAKE_CXX_STANDARD=' + standard,
os.path.join(fmt_dir, "test", "find-package-test")] +
common_cmake_flags, cwd=test_build_dir)
check_call(['make', '-j4'], cwd=test_build_dir)