From f749eeec40dd2fffe13c1d6bfa1cdce7e7ce44b2 Mon Sep 17 00:00:00 2001 From: Mike Owen Date: Fri, 14 Jan 2022 15:30:28 -0800 Subject: [PATCH 01/10] Setting BLT to v0.4.1 --- cmake/blt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/blt b/cmake/blt index 569675453..ddd5a0ca7 160000 --- a/cmake/blt +++ b/cmake/blt @@ -1 +1 @@ -Subproject commit 56967545342412bf81a622f170482152f7ebbbe5 +Subproject commit ddd5a0ca7c566d0ae14270b66625c8a363630ddb From e59f51ae986532a276e3118c923cfada595c5cb3 Mon Sep 17 00:00:00 2001 From: Mike Owen Date: Tue, 18 Jan 2022 16:17:44 -0800 Subject: [PATCH 02/10] Warnings about extra ";" (really picky!) --- src/FSISPH/SlideSurface.cc | 10 +++++----- src/Neighbor/NestedGridNeighbor.hh | 2 +- src/Neighbor/NodePairList.cc | 2 +- src/Utilities/lineSegmentIntersections.cc | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/FSISPH/SlideSurface.cc b/src/FSISPH/SlideSurface.cc index c2df35d9d..a98faa1e4 100644 --- a/src/FSISPH/SlideSurface.cc +++ b/src/FSISPH/SlideSurface.cc @@ -91,7 +91,7 @@ isSlideSurface(const int nodeListi, const int nodeListj) const { const auto oneDimIndex = mNumNodeLists * nodeListi + nodeListj; return mIsSlideSurface[oneDimIndex]; -}; +} //------------------------------------------------------------------------------ // return correction factor [0,1] for the artificial viscosity pressure @@ -206,7 +206,7 @@ const auto& connectivityMap = dataBase.connectivityMap(); -}; +} //------------------------------------------------------------------------------ @@ -223,7 +223,7 @@ registerState(DataBase& dataBase, state.enroll(mSurfaceNormals); state.enroll(mSurfaceFraction); state.enroll(mSurfaceSmoothness); -}; +} //------------------------------------------------------------------------------ @@ -238,7 +238,7 @@ registerState(DataBase& dataBase, // const typename Dimension::Scalar /*currentTime*/) const{ // return make_pair(std::numeric_limits::max(), this->label()); -// }; +// } @@ -270,4 +270,4 @@ registerState(DataBase& dataBase, // restoreState(const FileIO& /*file*/, // const std::string& /*pathName*/){}; -} \ No newline at end of file +} diff --git a/src/Neighbor/NestedGridNeighbor.hh b/src/Neighbor/NestedGridNeighbor.hh index 80022a8da..76ccf4aa4 100644 --- a/src/Neighbor/NestedGridNeighbor.hh +++ b/src/Neighbor/NestedGridNeighbor.hh @@ -86,7 +86,7 @@ public: std::vector& coarseNeighbors) const override; // Reassign the grid cell info for a given set of nodes. - virtual void updateNodes() override;; + virtual void updateNodes() override; virtual void updateNodes(const std::vector& nodeIDs) override; // Function to determine the appropriate gridlevel for a node. diff --git a/src/Neighbor/NodePairList.cc b/src/Neighbor/NodePairList.cc index 274ab2b8f..4e76a3bcd 100644 --- a/src/Neighbor/NodePairList.cc +++ b/src/Neighbor/NodePairList.cc @@ -5,7 +5,7 @@ namespace Spheral { NodePairIdxType::NodePairIdxType(int i_n, int i_l, int j_n, int j_l, double f) : i_node(i_n), i_list(i_l), j_node(j_n), j_list(j_l), f_couple(f) {} - NodePairList::NodePairList(){}; + NodePairList::NodePairList(){} void NodePairList::push_back(NodePairIdxType nodePair) { mNodePairList.push_back(nodePair); diff --git a/src/Utilities/lineSegmentIntersections.cc b/src/Utilities/lineSegmentIntersections.cc index 68e500762..a6342e365 100644 --- a/src/Utilities/lineSegmentIntersections.cc +++ b/src/Utilities/lineSegmentIntersections.cc @@ -21,7 +21,7 @@ namespace bg = boost::geometry; BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET(Spheral::Dim<2>::Vector, double, bg::cs::cartesian, Spheral::Dim<2>::Vector::x, Spheral::Dim<2>::Vector::y, - Spheral::Dim<2>::Vector::x, Spheral::Dim<2>::Vector::y); + Spheral::Dim<2>::Vector::x, Spheral::Dim<2>::Vector::y) using std::vector; using std::string; From 11fc1445dd9697494a5edcb4cbc23a3d3fc11677 Mon Sep 17 00:00:00 2001 From: Mike Owen Date: Tue, 18 Jan 2022 16:18:43 -0800 Subject: [PATCH 03/10] Can't declare variable size character arrays in standard --- src/FileIO/SiloFileIO.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/FileIO/SiloFileIO.cc b/src/FileIO/SiloFileIO.cc index c3036f761..cecc9f0d9 100644 --- a/src/FileIO/SiloFileIO.cc +++ b/src/FileIO/SiloFileIO.cc @@ -107,14 +107,11 @@ void readInt(DBfile* filePtr, int& value, const string pathName) { //------------------------------------------------------------------------------ void writeString(DBfile* filePtr, const string& value, const string pathName) { const int size = value.size(); - char cvalue[size]; - std::copy(value.begin(), value.end(), cvalue); - //cvalue[size] = '\0'; int dims[1] = {size}; writeInt(filePtr, dims[0], pathName + "/size"); if (dims[0] > 0) { const string varname = setdir(filePtr, pathName + "/value"); - VERIFY2(DBWrite(filePtr, varname.c_str(), cvalue, dims, 1, DB_CHAR) == 0, + VERIFY2(DBWrite(filePtr, varname.c_str(), value.c_str(), dims, 1, DB_CHAR) == 0, "SiloFileIO ERROR: unable to write string variable " << pathName); } } @@ -125,9 +122,9 @@ void readString(DBfile* filePtr, string& value, const string pathName) { if (valsize == 0) { value = ""; } else { - char cvalue[valsize + 1]; // Do we need to allow space for trailing null? + std::vector cvalue(valsize + 1); // Do we need to allow space for trailing null? const string varname = setdir(filePtr, pathName + "/value"); - VERIFY2(DBReadVar(filePtr, varname.c_str(), cvalue) == 0, + VERIFY2(DBReadVar(filePtr, varname.c_str(), &cvalue[0]) == 0, "SiloFileIO ERROR: failed to read string variable " << pathName); value = string(&cvalue[0], &cvalue[valsize]); } From e8785a2c32aa7dfe51590f6461ddefb051d325db Mon Sep 17 00:00:00 2001 From: Mike Owen Date: Tue, 18 Jan 2022 17:03:12 -0800 Subject: [PATCH 04/10] More control over warnings and build errors. I don't like making unused parameters warnings/errors (it's the API after all, what errors are we trying to catch?), so excluded those. May be controversial... --- cmake/SetupSpheral.cmake | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/cmake/SetupSpheral.cmake b/cmake/SetupSpheral.cmake index 7889cb1ad..18b0ba7ef 100644 --- a/cmake/SetupSpheral.cmake +++ b/cmake/SetupSpheral.cmake @@ -4,7 +4,7 @@ include(ExternalProject) # Configure CMake #------------------------------------------------------------------------------- set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undefined-var-template") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-missing-include-dirs") # -Wno-undefined-var-template set(CMAKE_EXPORT_COMPILE_COMMANDS On) if (NOT CMAKE_MODULE_PATH) @@ -24,10 +24,28 @@ message("-- compiler warnings ${ENABLE_WARNINGS}") option(ENABLE_UNUSED_VARIABLE_WARNINGS "show unused variable compiler warnings" ON) if (NOT ENABLE_UNUSED_VARIABLE_WARNINGS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable -Wno-unused-parameter") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable") endif() message("-- compiler unused variable warnings ${ENABLE_UNUSED_VARIABLE_WARNINGS}") +option(ENABLE_WARNINGS_AS_ERRORS "make warnings errors" OFF) +if (ENABLE_WARNINGS_AS_ERRORS) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + set(CXX_WARNING_FLAGS /W4 /WX) + else() + set(CXX_WARNING_FLAGS -Wall -Wextra -pedantic -Werror -Wl,--fatal-warnings) + endif() + add_compile_options(${CXX_WARNING_FLAGS}) + message("-- treating warnings as errors with compile flags ${CXX_WARNING_FLAGS}") + # add_compile_options($<$,$,$>:"-Wall;-Wextra;-pedantic;-Werror;-Wl,--fatal-warnings"> + # $:"/W4;/WX">) +endif() + +# We build some Fortran code from outside sources (like the Helmholtz EOS) that +# cause building errors if the compiler is too picky... +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -w") +message("-- Fortran flags: ${CMAKE_Fortran_FLAGS}") + #------------------------------------------------------------------------------- # Configure and Include blt #------------------------------------------------------------------------------- From d23ee734b7f15b7e914c21cbf2cd89d3bcceb2a0 Mon Sep 17 00:00:00 2001 From: Mike Owen Date: Tue, 18 Jan 2022 17:04:32 -0800 Subject: [PATCH 05/10] Some TPL's do not provide headers for including (Fortran for example). --- cmake/spheral/SpheralHandleTPL.cmake | 5 ++++- cmake/tpl/aneos.cmake | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/spheral/SpheralHandleTPL.cmake b/cmake/spheral/SpheralHandleTPL.cmake index bd5513d51..cf9f94894 100644 --- a/cmake/spheral/SpheralHandleTPL.cmake +++ b/cmake/spheral/SpheralHandleTPL.cmake @@ -107,7 +107,10 @@ function(Spheral_Handle_TPL lib_name dep_list) # Include the actual .cmake file include(${TPL_CMAKE_DIR}/${lib_name}.cmake) - list(APPEND ${lib_name}_INCLUDES $) + if (NOT DEFINED ${lib_name}_NO_INCLUDES) + list(APPEND ${lib_name}_INCLUDES $) + #message("-- including path ${lib_name} : ${lib_name}_INCLUDES") + endif() # Generate full path to lib file for output list set(${lib_name}_LIBRARIES ) diff --git a/cmake/tpl/aneos.cmake b/cmake/tpl/aneos.cmake index 4483ded9a..946bb3e4e 100644 --- a/cmake/tpl/aneos.cmake +++ b/cmake/tpl/aneos.cmake @@ -6,6 +6,7 @@ set(ANEOS_SRC_DIR "${ANEOS_PREFIX}/src/aneos/src") set(ANEOS_DEST_DIR "${${lib_name}_DIR}/lib") set(ANEOS_INPUT_SRC_DIR "${ANEOS_PREFIX}/src/aneos/input") set(ANEOS_INPUT_DEST_DIR "${${lib_name}_DIR}/input") +set(ANEOS_NO_INCLUDES On) # ANEOS does not produce any include header files #set(${lib_name}_INCLUDES aneos.h) set(${lib_name}_libs libaneos.a) From a83e4d60f1c39b2eaed2e9239d8fd852b5005d17 Mon Sep 17 00:00:00 2001 From: Mike Owen Date: Tue, 18 Jan 2022 17:05:00 -0800 Subject: [PATCH 06/10] Fixing warnings --- src/Utilities/refinePolyhedron.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Utilities/refinePolyhedron.cc b/src/Utilities/refinePolyhedron.cc index 0c75b4098..e252eea02 100644 --- a/src/Utilities/refinePolyhedron.cc +++ b/src/Utilities/refinePolyhedron.cc @@ -108,7 +108,7 @@ GeomPolyhedron refinePolyhedron(const GeomPolyhedron& poly0, const unsigned numVertices0 = verts0.size(); const unsigned numFaces0 = facetVerts0.size(); // float g_verts[numVertices0][3]; - int g_vertsperface[numFaces0]; + vector g_vertsperface(numFaces0); unsigned vertsPerFaceSum = 0; { // for (unsigned i = 0; i != numVertices0; ++i) { @@ -121,7 +121,7 @@ GeomPolyhedron refinePolyhedron(const GeomPolyhedron& poly0, vertsPerFaceSum += facetVerts0[i].size(); } } - int g_vertIndices[vertsPerFaceSum]; + vector g_vertIndices(vertsPerFaceSum); { unsigned j = 0; for (const auto& inds: facetVerts0) { @@ -161,8 +161,8 @@ GeomPolyhedron refinePolyhedron(const GeomPolyhedron& poly0, Descriptor desc; desc.numVertices = numVertices0; desc.numFaces = numFaces0; - desc.numVertsPerFace = g_vertsperface; - desc.vertIndicesPerFace = g_vertIndices; + desc.numVertsPerFace = &g_vertsperface[0]; + desc.vertIndicesPerFace = &g_vertIndices[0]; // Instantiate a FarTopologyRefiner from the descriptor Far::TopologyRefiner * refiner = Far::TopologyRefinerFactory::Create(desc, From 7e0326dd30caa66d47d998d2ea1de25b8b1fe2c7 Mon Sep 17 00:00:00 2001 From: Mike Owen Date: Wed, 19 Jan 2022 11:33:16 -0800 Subject: [PATCH 07/10] Suspending warnings as errors for python bindings until we clean those up. --- cmake/spheral/SpheralAddLibs.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/spheral/SpheralAddLibs.cmake b/cmake/spheral/SpheralAddLibs.cmake index ed713a14a..63ecd0a21 100644 --- a/cmake/spheral/SpheralAddLibs.cmake +++ b/cmake/spheral/SpheralAddLibs.cmake @@ -110,6 +110,7 @@ function(spheral_add_pybind11_library package_name) ) add_dependencies(${MODULE_NAME} ${spheral_py_depends} ${spheral_depends}) target_compile_options(${MODULE_NAME} PRIVATE + "-Wno-error" "-Wno-unused-local-typedefs" "-Wno-self-assign-overloaded" "-Wno-overloaded-virtual" From 378fea0990def49796c9032a88ad4ea6eb9b5efe Mon Sep 17 00:00:00 2001 From: Mike Owen Date: Tue, 25 Jan 2022 16:44:21 -0800 Subject: [PATCH 08/10] int signedness --- src/Field/FieldListInline.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Field/FieldListInline.hh b/src/Field/FieldListInline.hh index 9b1e78b47..cb47b07d3 100644 --- a/src/Field/FieldListInline.hh +++ b/src/Field/FieldListInline.hh @@ -1848,7 +1848,7 @@ operator*(const FieldList& lhs, REQUIRE(lhs.numFields() == rhs.numFields()); FieldList::ProductType> result; result.copyFields(); - for (int i = 0; i < lhs.numFields(); ++i) { + for (auto i = 0u; i < lhs.numFields(); ++i) { CHECK2(lhs[i]->nodeListPtr() == rhs[i]->nodeListPtr(), lhs[i]->nodeListPtr()->name() << " != " << rhs[i]->nodeListPtr()->name()); result.appendField((*(lhs[i])) * (*(rhs[i]))); } From 4cbf5875a4549caa464124403343916163abf79b Mon Sep 17 00:00:00 2001 From: Mike Owen Date: Tue, 25 Jan 2022 16:44:37 -0800 Subject: [PATCH 09/10] Standard says you can't have variable sized C arrays. --- src/Utilities/SidreDataCollectionInline.hh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Utilities/SidreDataCollectionInline.hh b/src/Utilities/SidreDataCollectionInline.hh index 2717b9370..7c289a878 100644 --- a/src/Utilities/SidreDataCollectionInline.hh +++ b/src/Utilities/SidreDataCollectionInline.hh @@ -1,6 +1,7 @@ //SidreDataCollectionInLine.hh #include "axom/sidre.hpp" #include "Field/Field.hh" +#include namespace Spheral { @@ -166,7 +167,7 @@ axom::sidre::Group *SidreDataCollection::sidreStoreField(const std::string &view axom::IndexType num_elements = DataTypeTraits::numElements(field[0]); int view_count = 0; - double data [num_elements]; + std::vector data(num_elements); for (u_int i = 0; i < field.size(); ++i) { int index = 0; @@ -176,7 +177,7 @@ axom::sidre::Group *SidreDataCollection::sidreStoreField(const std::string &view index++; } axom::sidre::Buffer* buff = m_datastore_ptr->createBuffer()->allocate(dtype, num_elements) - ->copyBytesIntoBuffer(data, sizeof(double) * num_elements); + ->copyBytesIntoBuffer(&data[0], sizeof(double) * num_elements); wholeField->createView(view_name + std::to_string(view_count), dtype, num_elements, buff); view_count++; } @@ -194,7 +195,7 @@ axom::sidre::Group *SidreDataCollection::sidreStoreField(const std::string &view axom::IndexType num_elements = DataTypeTraits::Vector>::numElements(field[0]); int view_count = 0; - double data [num_elements]; + std::vector data(num_elements); for (u_int i = 0; i < field.size(); ++i) { int index = 0; @@ -204,7 +205,7 @@ axom::sidre::Group *SidreDataCollection::sidreStoreField(const std::string &view index++; } axom::sidre::Buffer* buff = m_datastore_ptr->createBuffer()->allocate(dtype, num_elements) - ->copyBytesIntoBuffer(data, sizeof(double) * num_elements); + ->copyBytesIntoBuffer(&data[0], sizeof(double) * num_elements); wholeField->createView(view_name + std::to_string(view_count), dtype, num_elements, buff); view_count++; } From 995d3e672619944c60fcb0b7bbcc9a3ae1fc6d52 Mon Sep 17 00:00:00 2001 From: Mike Owen Date: Mon, 31 Jan 2022 14:26:15 -0800 Subject: [PATCH 10/10] Removing commented out generator pattern --- cmake/SetupSpheral.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmake/SetupSpheral.cmake b/cmake/SetupSpheral.cmake index 18b0ba7ef..a7eaf0dc3 100644 --- a/cmake/SetupSpheral.cmake +++ b/cmake/SetupSpheral.cmake @@ -37,8 +37,6 @@ if (ENABLE_WARNINGS_AS_ERRORS) endif() add_compile_options(${CXX_WARNING_FLAGS}) message("-- treating warnings as errors with compile flags ${CXX_WARNING_FLAGS}") - # add_compile_options($<$,$,$>:"-Wall;-Wextra;-pedantic;-Werror;-Wl,--fatal-warnings"> - # $:"/W4;/WX">) endif() # We build some Fortran code from outside sources (like the Helmholtz EOS) that