From d9929edbc1540beac2a48a10740c27bf6d00f4c8 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Tue, 23 Jun 2020 13:44:25 -0700 Subject: [PATCH] Run -Weffc++ in CI --- cmake/simdjson-flags.cmake | 6 ++---- include/simdjson/common_defs.h | 1 + tools/json2json.cpp | 3 +++ tools/jsonstats.cpp | 3 +++ tools/minify.cpp | 3 +++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cmake/simdjson-flags.cmake b/cmake/simdjson-flags.cmake index e040accb..0ea36b1e 100644 --- a/cmake/simdjson-flags.cmake +++ b/cmake/simdjson-flags.cmake @@ -60,10 +60,8 @@ if(MSVC) target_compile_options(simdjson-internal-flags INTERFACE /WX /W3 /sdl) else() target_compile_options(simdjson-internal-flags INTERFACE -fPIC) - if (NOT SIMDJSON_GOOGLE_BENCHMARKS) # Google Benchmark can't be compiled without warnings with -Weffc++ - target_compile_options(simdjson-internal-flags INTERFACE -Weffc++) - endif() - target_compile_options(simdjson-internal-flags INTERFACE -Werror -Wall -Wextra -Wsign-compare -Wshadow -Wwrite-strings -Wpointer-arith -Winit-self -Wconversion -Wno-sign-conversion) + target_compile_options(simdjson-internal-flags INTERFACE -Werror -Wall -Wextra -Weffc++) + target_compile_options(simdjson-internal-flags INTERFACE -Wsign-compare -Wshadow -Wwrite-strings -Wpointer-arith -Winit-self -Wconversion -Wno-sign-conversion) endif() # Optional flags diff --git a/include/simdjson/common_defs.h b/include/simdjson/common_defs.h index 7f5417f9..c6c2b7f9 100644 --- a/include/simdjson/common_defs.h +++ b/include/simdjson/common_defs.h @@ -117,6 +117,7 @@ constexpr size_t DEFAULT_MAX_DEPTH = 1024; SIMDJSON_DISABLE_GCC_WARNING(-Wextra) \ SIMDJSON_DISABLE_GCC_WARNING(-Wattributes) \ SIMDJSON_DISABLE_GCC_WARNING(-Wimplicit-fallthrough) \ + SIMDJSON_DISABLE_GCC_WARNING(-Wnon-virtual-dtor) \ SIMDJSON_DISABLE_GCC_WARNING(-Wreturn-type) \ SIMDJSON_DISABLE_GCC_WARNING(-Wshadow) \ SIMDJSON_DISABLE_GCC_WARNING(-Wunused-parameter) \ diff --git a/tools/json2json.cpp b/tools/json2json.cpp index 084ad3ca..8b62299f 100644 --- a/tools/json2json.cpp +++ b/tools/json2json.cpp @@ -1,10 +1,13 @@ #include #include #include "simdjson.h" + +SIMDJSON_PUSH_DISABLE_ALL_WARNINGS #ifndef __cpp_exceptions #define CXXOPTS_NO_EXCEPTIONS #endif #include "cxxopts.hpp" +SIMDJSON_POP_DISABLE_WARNINGS int main(int argc, char *argv[]) { #ifdef __cpp_exceptions diff --git a/tools/jsonstats.cpp b/tools/jsonstats.cpp index 977d6a48..b7b27a27 100644 --- a/tools/jsonstats.cpp +++ b/tools/jsonstats.cpp @@ -2,10 +2,13 @@ #include #include "simdjson.h" + +SIMDJSON_PUSH_DISABLE_ALL_WARNINGS #ifndef __cpp_exceptions #define CXXOPTS_NO_EXCEPTIONS #endif #include "cxxopts.hpp" +SIMDJSON_POP_DISABLE_WARNINGS size_t count_nonasciibytes(const uint8_t *input, size_t length) { size_t count = 0; diff --git a/tools/minify.cpp b/tools/minify.cpp index 2e2acebd..458a9ac2 100644 --- a/tools/minify.cpp +++ b/tools/minify.cpp @@ -5,10 +5,13 @@ #include #include "simdjson.h" + +SIMDJSON_PUSH_DISABLE_ALL_WARNINGS #ifndef __cpp_exceptions #define CXXOPTS_NO_EXCEPTIONS #endif #include "cxxopts.hpp" +SIMDJSON_POP_DISABLE_WARNINGS cxxopts::Options options("minify", "Runs the parser against the given json files in a loop, measuring speed and other statistics.");