diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 25fe61a5aa2ca0b584765781a56c22739baa25df..ffb042b08cee789ab4f19ab82d727946abb16c00 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,7 +51,6 @@ include: - local: '/scripts/ci/jobs/build-docs.yml' - local: '/scripts/ci/jobs/build-win.yml' - local: '/scripts/ci/jobs/build-mac.yml' - - local: '/scripts/ci/jobs/checks.yml' # - template: 'Code-Quality.gitlab-ci.yml' # see !3053 - local: '/scripts/ci/jobs/code-quality.yml' - local: '/scripts/ci/jobs/code-coverage.yml' diff --git a/Applications/FileIO/GocadIO/GocadAsciiReader.cpp b/Applications/FileIO/GocadIO/GocadAsciiReader.cpp index 8bd2cd2b749fd9eb4dbd8d1426659fad226a437d..1b86fed65e4ba9d3d584eab2b4ba06be44a13e25 100644 --- a/Applications/FileIO/GocadIO/GocadAsciiReader.cpp +++ b/Applications/FileIO/GocadIO/GocadAsciiReader.cpp @@ -121,7 +121,7 @@ DataType datasetFound(std::ifstream& in) /// Checks if current line is a designated keyword for a GoCAD data set void checkLineEndings(std::string const& file_name) { - #ifndef _WIN32 +#ifndef _WIN32 std::ifstream in(file_name); if (in.is_open()) { @@ -136,7 +136,7 @@ void checkLineEndings(std::string const& file_name) file_name); } } - #endif _WIN32 +#endif } /// Parses the HEADER section (everything except the name is ignored right now) diff --git a/MathLib/Nonlinear/Root1D.h b/MathLib/Nonlinear/Root1D.h index 10e81e5fcbefccb00e4768de9c85d081f4d9da58..05db6ee99a3ed4655065d4e992c73bb882fa1a05 100644 --- a/MathLib/Nonlinear/Root1D.h +++ b/MathLib/Nonlinear/Root1D.h @@ -14,6 +14,8 @@ #include <cmath> #include <limits> #include <type_traits> +#include <utility> + #include "BaseLib/Error.h" namespace MathLib @@ -48,7 +50,7 @@ class RegulaFalsi public: //! Initializes finding a root of the \c Function \c f in the interval //! [\c a, \c b]. - RegulaFalsi(Function const& f, double a, double b) + RegulaFalsi(Function&& f, double a, double b) : _f(f), _a(a), _b(b), _fa(f(a)), _fb(f(b)) { static_assert(std::is_same_v<double, decltype(f(0.0))>, @@ -114,7 +116,7 @@ public: double getRange() const { return std::abs(_a - _b); } private: - Function const& _f; + Function _f; double _a, _b, _fa, _fb; }; @@ -124,11 +126,12 @@ private: * * \see https://en.wikipedia.org/wiki/False_position_method#Improvements_in_regula_falsi */ -template<typename SubType, typename Function> -RegulaFalsi<SubType, Function> -makeRegulaFalsi(Function const& f, double const a, double const b) +template <typename SubType, typename Function> +RegulaFalsi<SubType, Function> makeRegulaFalsi(Function&& f, + double const a, + double const b) { - return RegulaFalsi<SubType, Function>(f, a, b); + return RegulaFalsi<SubType, Function>(std::forward<Function>(f), a, b); } diff --git a/ProcessLib/Output/CreateOutput.cpp b/ProcessLib/Output/CreateOutput.cpp index 7e403d9000d703f718ef4334273f5c49a073fcd1..f3e44068b5eed2692f82aa0142f96ce0e91f01fb 100644 --- a/ProcessLib/Output/CreateOutput.cpp +++ b/ProcessLib/Output/CreateOutput.cpp @@ -40,7 +40,7 @@ std::unique_ptr<Output> createOutput( return type; } - catch (std::out_of_range& e) + catch (std::out_of_range&) { OGS_FATAL("No supported file type provided. Read `{:s}' from <output><type> \ in prj File. Supported: VTK, XDMF.", diff --git a/ProcessLib/Output/Output.cpp b/ProcessLib/Output/Output.cpp index 6b55adc42106b2431cb09f8ad9132523ae90e380..cdcb7990876e26f2710c2d8aabe25b338977d784 100644 --- a/ProcessLib/Output/Output.cpp +++ b/ProcessLib/Output/Output.cpp @@ -219,7 +219,7 @@ struct Output::OutputFile timestep, t, iteration) + "." + extension; } - catch (std::out_of_range& e) + catch (std::out_of_range&) { OGS_FATAL( "No supported file type provided. Read `{:s}' from <output><type> \ diff --git a/scripts/ci/extends/template-build-linux.yml b/scripts/ci/extends/template-build-linux.yml index 0654504d5515c61c08c42abdcd0ba7093fd4565e..e39b5e74b1a9e70a2035a9a5d0f639d871b4ec46 100644 --- a/scripts/ci/extends/template-build-linux.yml +++ b/scripts/ci/extends/template-build-linux.yml @@ -29,3 +29,7 @@ else $BUILD_CMD_PREFIX cmake --build . --target ${TARGETS} > >(tee make.output) fi + - | + if [[ "$CHECK_WARNINGS" = true ]] ; then + if [[ $(cat make.output | grep warning -i) ]]; then printf 'There were compiler warnings:\n\n'; cat make.output | grep warning -i; exit 1; fi + fi diff --git a/scripts/ci/extends/template-build-win.yml b/scripts/ci/extends/template-build-win.yml index cba0eb9f2bf02cd79dfa12426cad7eb9ec3dd754..fb18920ddf24c296326e00b13096ac7720037c4e 100644 --- a/scripts/ci/extends/template-build-win.yml +++ b/scripts/ci/extends/template-build-win.yml @@ -25,3 +25,10 @@ - if($env:BUILD_TESTS -eq "true") { cmake --build . --target tests } - if($env:BUILD_CTEST -eq "true") { cmake --build . --target ctest } - if($env:BUILD_CTEST -eq "true") { cp Testing/**/Test.xml Tests/ctest.xml } + - | + if($env:CHECK_WARNINGS -eq "true" -and (cat make.output | Select-String -Pattern ': warning') ) + { + Write-Output 'There were compiler warnings:\n' + cat make.output | Select-String -Pattern ': warning' + exit 1 + } diff --git a/scripts/ci/jobs/build-linux.yml b/scripts/ci/jobs/build-linux.yml index ef375adff313cdddd19a5c5fa5f7e27341fd2119..3dd53aa4bba283c3d39db7a7e768d636b967b698 100644 --- a/scripts/ci/jobs/build-linux.yml +++ b/scripts/ci/jobs/build-linux.yml @@ -50,6 +50,7 @@ build linux (no unity): BUILD_DIR: "no-unity" BUILD_TESTS: "false" BUILD_CTEST: "false" + CHECK_WARNINGS: "true" CMAKE_PRESET: release CMAKE_ARGS: >- -DOGS_USE_PYTHON=OFF diff --git a/scripts/ci/jobs/build-mac.yml b/scripts/ci/jobs/build-mac.yml index 2c85a2a1af108212e0f3d0313a274162c59518ee..04eb3319bbb8f945435689b87d7b77f1666905b5 100644 --- a/scripts/ci/jobs/build-mac.yml +++ b/scripts/ci/jobs/build-mac.yml @@ -7,6 +7,7 @@ build mac: needs: [meta] variables: BUILD_DIR: "mac-release" + CHECK_WARNINGS: "true" CMAKE_PRESET: release CMAKE_ARGS: >- -DOGS_INSTALL_DEPENDENCIES=ON diff --git a/scripts/ci/jobs/build-win.yml b/scripts/ci/jobs/build-win.yml index bf991fb6bc64776df2a4f4a54d1dc0c3ae5b58b9..9c2ed063ede0a1ba66d3403d8767a8421aea293e 100644 --- a/scripts/ci/jobs/build-win.yml +++ b/scripts/ci/jobs/build-win.yml @@ -8,6 +8,7 @@ build win: allow_failure: true variables: BUILD_DIR: win-release + CHECK_WARNINGS: "true" CMAKE_PRESET: release CMAKE_ARGS: >- -DOGS_CI_TESTRUNNER_REPEAT=1 diff --git a/scripts/ci/jobs/checks.yml b/scripts/ci/jobs/checks.yml deleted file mode 100644 index c3a993ce5ef828290f040e32451594f799aaa631..0000000000000000000000000000000000000000 --- a/scripts/ci/jobs/checks.yml +++ /dev/null @@ -1,16 +0,0 @@ -compiler warnings: - stage: check - image: ubuntu:20.04 - variables: - GIT_STRATEGY: none - allow_failure: true - needs: - - job: "build linux (no unity)" - - job: "build win: [USE_PYTHON=ON]" - - job: build mac - script: - - exit_code=0 - - "if [[ $(cat build/no-unity/make.output | grep warning -i) ]]; then printf 'There were GCC compiler warnings:\n\n'; cat make.output | grep warning -i; exit_code=1; fi" - - "if [[ $(cat build/win-release/make.output | grep ': warning' -i) ]]; then printf 'There were MSVC compiler warnings:\n\n'; cat make.output | grep ': warning' -i; exit_code=1; fi" - - "if [[ $(cat build/mac-release/make.output | grep warning -i) ]]; then printf 'There were Clang (macOS) compiler warnings:\n\n'; cat make.output | grep warning -i; exit_code=1; fi" - - exit $exit_code diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake index fc99fd756e0af16a1d0126399731bdc46b51a267..75ad4beb45642cc48ce964a82689c8d706003163 100644 --- a/scripts/cmake/Dependencies.cmake +++ b/scripts/cmake/Dependencies.cmake @@ -377,6 +377,9 @@ if(OGS_BUILD_TESTING) endif() # Disable warnings +if(WIN32 AND VTK_ADDED) + list(APPEND DISABLE_WARNINGS_TARGETS vtksys) +endif() foreach(target ${DISABLE_WARNINGS_TARGETS}) target_compile_options( ${target}