From 5a6494b7fabc512f536c83cf90961e86a5f6b4ee Mon Sep 17 00:00:00 2001 From: Soeren Peters <peters@irmb.tu-bs.de> Date: Fri, 22 Dec 2023 07:36:46 +0000 Subject: [PATCH] MSVC: disable globally C4458 --- 3rdParty/metis/metis-5.1.0/CMakeLists.txt | 2 +- CMake/compilerflags/CompilerWarnings.cmake | 1 + src/gpu/GridGenerator/CMakeLists.txt | 1 - .../grid/MultipleGridBuilderFacadeTest.cpp | 4 ++-- tests/unit-tests/gpu/GridGenerator/grid/SideTest.cpp | 10 ++++++++++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/3rdParty/metis/metis-5.1.0/CMakeLists.txt b/3rdParty/metis/metis-5.1.0/CMakeLists.txt index 91cb12066..78f430019 100644 --- a/3rdParty/metis/metis-5.1.0/CMakeLists.txt +++ b/3rdParty/metis/metis-5.1.0/CMakeLists.txt @@ -27,7 +27,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") endif() if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") - target_compile_options(metis PRIVATE "-Wno-fortify-source") + target_compile_options(metis PRIVATE "-Wno-misleading-indentation" "-Wno-fortify-source" "-Wno-nested-anon-types") endif() group_target(metis ${thirdFolder}) \ No newline at end of file diff --git a/CMake/compilerflags/CompilerWarnings.cmake b/CMake/compilerflags/CompilerWarnings.cmake index cc79431a6..5656bf94b 100644 --- a/CMake/compilerflags/CompilerWarnings.cmake +++ b/CMake/compilerflags/CompilerWarnings.cmake @@ -58,6 +58,7 @@ function(set_project_warnings project_name) /w14906 # string literal cast to 'LPWSTR' /w14928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied /permissive- # standards conformance mode for MSVC compiler. + /wd4458 # disable declaration of 'XXX' hides class member ) set(CLANG_WARNINGS diff --git a/src/gpu/GridGenerator/CMakeLists.txt b/src/gpu/GridGenerator/CMakeLists.txt index 41fe531ce..ea572b4a4 100644 --- a/src/gpu/GridGenerator/CMakeLists.txt +++ b/src/gpu/GridGenerator/CMakeLists.txt @@ -70,7 +70,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") target_compile_options(GridGenerator PRIVATE "/wd4100") # unreferenced formal parameter target_compile_options(GridGenerator PRIVATE "/wd4701") # potentially uninitialized local variable target_compile_options(GridGenerator PRIVATE "/wd4703") # potentially uninitialized local pointer - target_compile_options(GridGenerator PRIVATE "/wd4458") # declaration of 'XXX' hides class member target_compile_options(GridGenerator PRIVATE "/wd4305") #'initializing': truncation from double to float target_compile_options(GridGenerator PRIVATE "/wd4389") #''==': signed/unsigned mismatch endif() \ No newline at end of file diff --git a/tests/unit-tests/gpu/GridGenerator/grid/MultipleGridBuilderFacadeTest.cpp b/tests/unit-tests/gpu/GridGenerator/grid/MultipleGridBuilderFacadeTest.cpp index 27729de91..6501f9e34 100644 --- a/tests/unit-tests/gpu/GridGenerator/grid/MultipleGridBuilderFacadeTest.cpp +++ b/tests/unit-tests/gpu/GridGenerator/grid/MultipleGridBuilderFacadeTest.cpp @@ -89,7 +89,7 @@ class MockMultipleGridBuilder : public MultipleGridBuilder public: MOCK_METHOD(void, addCoarseGrid, (real startX, real startY, real startZ, real endX, real endY, real endZ, real delta), (override)); - void addCoarseGrid(const GridDimensions& gridDimensions) override {}; + void addCoarseGrid(const GridDimensions& gridDimensions) override {(void)gridDimensions;}; MOCK_METHOD(void, setSubDomainBox, (SPtr<BoundingBox> subDomainBox), (override)); MOCK_METHOD(void, findCommunicationIndices, (int direction, bool doShift), (override)); MOCK_METHOD(void, setCommunicationProcess, (int direction, uint process), (override)); @@ -112,7 +112,7 @@ public: MOCK_METHOD(void, addGrid, (std::shared_ptr<Object> gridShape), (override)); MOCK_METHOD(void, addGeometry, (std::shared_ptr<Object> gridShape), (override)); - void buildGrids(bool enableThinWalls) override {}; + void buildGrids(bool enableThinWalls) override {(void)enableThinWalls;}; }; TEST(MultipleGridBuilderFacadeTest, transform1dCoordinateToComponents) diff --git a/tests/unit-tests/gpu/GridGenerator/grid/SideTest.cpp b/tests/unit-tests/gpu/GridGenerator/grid/SideTest.cpp index 4cbbfac03..dbacc27a4 100644 --- a/tests/unit-tests/gpu/GridGenerator/grid/SideTest.cpp +++ b/tests/unit-tests/gpu/GridGenerator/grid/SideTest.cpp @@ -64,6 +64,9 @@ public: private: void correctNeighborForPeriodicBoundaries(const Grid *grid, std::array<real, 3>& coords, std::array<real, 3>& neighbors) const override { + (void)grid; + (void)coords; + (void)neighbors; } int getDirection() const override @@ -73,6 +76,9 @@ private: void addIndices(const std::vector<SPtr<Grid>> &grid, uint level, SPtr<gg::BoundaryCondition> boundaryCondition) override { + (void)grid; + (void)level; + (void)boundaryCondition; } int getCoordinate() const override @@ -99,6 +105,7 @@ public: void transIndexToCoords(uint index, real &x, real &y, real &z) const override { + (void)index; x = 0; y = 0; z = 0; @@ -111,6 +118,9 @@ public: uint transCoordToIndex(const real &x, const real &y, const real &z) const override { + (void)x; + (void)y; + (void)z; return 0; } -- GitLab