Fix minor issues for GCC 11
Hi,
GCC 11.1 was release this week and since it is already installed on our systems, I couldn't refrain from trying to compile HyTeG with it.
- Good news: Test suite compiles and runs through (in Release mode)
- Small issues exist, though. The improved warning features point out some details in HyTeG and waLBerla.
Most warnings come from the new -Wrange-loop-construct that "warns when a range-based for-loop is creating unnecessary and expensive copies"
[130/1805] Building CXX object src/hyteg/CMakeFiles/hyteg.dir/edgedofspace/EdgeDoFOperator.cpp.o
In file included from [PATH]/HyTeG/src/hyteg/edgedofspace/EdgeDoFOperator.cpp:20:
[PATH]/HyTeG/src/hyteg/edgedofspace/EdgeDoFOperator.hpp: In instantiation of ‘void hyteg::assembleEdgeToEdgeStencils(const std::shared_ptr<hyteg::PrimitiveStorage>&, const uint_t&, const uint_t&, const hyteg::PrimitiveDataID<hyteg::LevelWiseMemory<std::map<long unsigned int, std::map<hyteg::edgedof::EdgeDoFOrientation, std::map<hyteg::edgedof::EdgeDoFOrientation, std::map<hyteg::indexing::IndexIncrement, double> > > > >, hyteg::Edge>&, const hyteg::PrimitiveDataID<hyteg::LevelWiseMemory<std::map<long unsigned int, std::map<hyteg::edgedof::EdgeDoFOrientation, std::map<hyteg::edgedof::EdgeDoFOrientation, std::map<hyteg::indexing::IndexIncrement, double> > > > >, hyteg::Face>&, const hyteg::PrimitiveDataID<hyteg::LevelWiseMemory<std::map<hyteg::edgedof::EdgeDoFOrientation, std::map<hyteg::edgedof::EdgeDoFOrientation, std::map<hyteg::indexing::IndexIncrement, double> > > >, hyteg::Cell>&, const EdgeDoFForm&) [with EdgeDoFForm = hyteg::P2FenicsForm<hyteg::fenics::NoAssemble, hyteg::fenics::NoAssemble>; walberla::uint_t = long unsigned int]’:
[PATH]/HyTeG/src/hyteg/edgedofspace/EdgeDoFOperator.cpp:87:51: required from ‘hyteg::EdgeDoFOperator<EdgeDoFForm>::EdgeDoFOperator(const std::shared_ptr<hyteg::PrimitiveStorage>&, walberla::uint_t, walberla::uint_t, const EdgeDoFForm&) [with EdgeDoFForm = hyteg::P2FenicsForm<hyteg::fenics::NoAssemble, hyteg::fenics::NoAssemble>; walberla::uint_t = long unsigned int]’
[PATH]/HyTeG/src/hyteg/edgedofspace/EdgeDoFOperator.cpp:618:16: required from here
[PATH]/HyTeG/src/hyteg/edgedofspace/EdgeDoFOperator.hpp:209:36: warning: loop variable ‘stencilIt’ creates a copy from type ‘const std::pair<const hyteg::indexing::IndexIncrement, double>’ [-Wrange-loop-construct]
209 | for ( const auto stencilIt : edgeToEdgeStencilMap )
| ^~~~~~~~~
[PATH]/HyTeG/src/hyteg/edgedofspace/EdgeDoFOperator.hpp:209:36: note: use reference type to prevent copying
209 | for ( const auto stencilIt : edgeToEdgeStencilMap )
| ^~~~~~~~~
| &
The other kind of warning is related to functionality inside waLBerla
In file included from [PATH]/HyTeG/tests/hyteg/convergence/P1GSConvergenceTest.cpp:29:
[PATH]/HyTeG/walberla/src/core/Format.hpp: In function ‘void test.constprop(const string&, const uint_t&, const uint_t&, const uint_t&)’:
[PATH]/HyTeG/walberla/src/core/Format.hpp:41:24: warning: ‘rel_res’ may be used uninitialized [-Wmaybe-uninitialized]
41 | int check = snprintf(buffer, maxBufferSize, formatString.c_str(), args...);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[PATH]/HyTeG/tests/hyteg/convergence/P1GSConvergenceTest.cpp:81:34: note: ‘rel_res’ was declared here
81 | real_t begin_res, abs_res_old, rel_res, abs_res = 0;
| ^~~~~~~
Cheers
Marcus
Edited by Marcus Mohr