From da69fd4406669ffc5772edf08af38d160c9d6405 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Tue, 9 Jun 2020 09:18:38 +0000 Subject: [PATCH] [CLANG-TIDY] performance-unnecessary-value-param I am unsure about const correctness in the python coupling. If you are familiar with the coupling feel free to remove the NOLINTs! --- src/blockforest/python/Exports.cpp | 4 ++-- src/python_coupling/CreateConfig.cpp | 4 +++- .../basic_exports/BasicExports.cpp | 16 +++++++------- .../basic_exports/MPIExport.cpp | 22 +++++++++---------- src/vtk/python/Exports.cpp | 2 +- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/blockforest/python/Exports.cpp b/src/blockforest/python/Exports.cpp index 83ef6f662..fcc28cf6b 100644 --- a/src/blockforest/python/Exports.cpp +++ b/src/blockforest/python/Exports.cpp @@ -64,7 +64,7 @@ namespace blockforest { using walberla::blockforest::communication::UniformBufferedScheme; -bool checkForThreeTuple( object obj ) +bool checkForThreeTuple( object obj ) //NOLINT { if( ! extract<tuple> ( obj ).check() ) return false; @@ -74,7 +74,7 @@ bool checkForThreeTuple( object obj ) } -object python_createUniformBlockGrid(tuple args, dict kw) +object python_createUniformBlockGrid(tuple args, dict kw) //NOLINT { if( len(args) > 0 ) { PyErr_SetString( PyExc_ValueError, "This function takes only keyword arguments" ); diff --git a/src/python_coupling/CreateConfig.cpp b/src/python_coupling/CreateConfig.cpp index c50e72784..461a82a38 100644 --- a/src/python_coupling/CreateConfig.cpp +++ b/src/python_coupling/CreateConfig.cpp @@ -83,7 +83,9 @@ namespace python_coupling { class PythonMultipleConfigGenerator : public config::ConfigGenerator { public: - PythonMultipleConfigGenerator( bp::stl_input_iterator< bp::dict > iterator ) : iter_( iterator ), firstTime_(true) {} + PythonMultipleConfigGenerator( bp::stl_input_iterator< bp::dict > iterator ) //NOLINT + : iter_( iterator ), firstTime_(true) + {} shared_ptr<Config> next() override { diff --git a/src/python_coupling/basic_exports/BasicExports.cpp b/src/python_coupling/basic_exports/BasicExports.cpp index 17341f26b..75d0354c2 100644 --- a/src/python_coupling/basic_exports/BasicExports.cpp +++ b/src/python_coupling/basic_exports/BasicExports.cpp @@ -670,7 +670,7 @@ void exportTiming() // //====================================================================================================================== -boost::python::object IBlock_getData( boost::python::object iblockObject, const std::string & stringID ) +boost::python::object IBlock_getData( boost::python::object iblockObject, const std::string & stringID ) //NOLINT { IBlock * block = boost::python::extract<IBlock*>( iblockObject ); @@ -701,7 +701,7 @@ boost::python::object IBlock_getData( boost::python::object iblockObject, const } -boost::python::list IBlock_blockDataList( boost::python::object iblockObject ) +boost::python::list IBlock_blockDataList( boost::python::object iblockObject ) //NOLINT { IBlock * block = boost::python::extract<IBlock*>( iblockObject ); @@ -722,7 +722,7 @@ boost::python::list IBlock_blockDataList( boost::python::object iblockObject ) boost::python::object IBlock_iter( boost::python::object iblockObject ) { - boost::python::list resultList = IBlock_blockDataList( iblockObject ); + boost::python::list resultList = IBlock_blockDataList( iblockObject ); //NOLINT return resultList.attr("__iter__"); } @@ -847,13 +847,13 @@ void exportLogging() //====================================================================================================================== -object * blockDataCreationHelper( IBlock * block, StructuredBlockStorage * bs, object callable ) +object * blockDataCreationHelper( IBlock * block, StructuredBlockStorage * bs, object callable ) //NOLINT { object * res = new object( callable( ptr(block), ptr(bs) ) ); return res; } -uint_t StructuredBlockStorage_addBlockData( StructuredBlockStorage & s, const std::string & name, object functionPtr ) +uint_t StructuredBlockStorage_addBlockData( StructuredBlockStorage & s, const std::string & name, object functionPtr ) //NOLINT { BlockDataID res = s.addStructuredBlockData(name) << StructuredBlockDataCreator<object>( std::bind( &blockDataCreationHelper, std::placeholders::_1, std::placeholders::_2, functionPtr ) ); @@ -865,7 +865,7 @@ uint_t StructuredBlockStorage_addBlockData( StructuredBlockStorage & s, const st // boost::python comes with iteration helpers but non of this worked: // .def("__iter__" range(&StructuredBlockStorage::begin, &StructuredBlockStorage::end)) // .def("__iter__", range<return_value_policy<copy_non_const_reference> >( beginPtr, endPtr) ) -boost::python::object StructuredBlockStorage_iter( boost::python::object structuredBlockStorage ) +boost::python::object StructuredBlockStorage_iter( boost::python::object structuredBlockStorage ) //NOLINT { shared_ptr<StructuredBlockStorage> s = extract< shared_ptr<StructuredBlockStorage> > ( structuredBlockStorage ); @@ -884,7 +884,7 @@ boost::python::object StructuredBlockStorage_iter( boost::python::object structu } -boost::python::object StructuredBlockStorage_getItem( boost::python::object structuredBlockStorage, uint_t i ) +boost::python::object StructuredBlockStorage_getItem( boost::python::object structuredBlockStorage, uint_t i ) //NOLINT { shared_ptr<StructuredBlockStorage> s = extract< shared_ptr<StructuredBlockStorage> > ( structuredBlockStorage ); @@ -1090,7 +1090,7 @@ void exportStructuredBlockStorage() void exportCommunication() { using communication::UniformPackInfo; - class_< UniformPackInfo, shared_ptr<UniformPackInfo>, boost::noncopyable> + class_< UniformPackInfo, shared_ptr<UniformPackInfo>, boost::noncopyable> //NOLINT ( "UniformPackInfo", no_init ); using communication::UniformMPIDatatypeInfo; diff --git a/src/python_coupling/basic_exports/MPIExport.cpp b/src/python_coupling/basic_exports/MPIExport.cpp index 99a9ed2b6..5811cbab5 100644 --- a/src/python_coupling/basic_exports/MPIExport.cpp +++ b/src/python_coupling/basic_exports/MPIExport.cpp @@ -45,7 +45,7 @@ namespace python_coupling { // //=================================================================================================================== - static object broadcast_string( object value, int sendRank ) + static object broadcast_string( object value, int sendRank ) //NOLINT { if ( extract<std::string>(value).check() ) { @@ -58,7 +58,7 @@ namespace python_coupling { return object( extractedValue ); } - static object broadcast_int( object value, int sendRank ) + static object broadcast_int( object value, int sendRank ) //NOLINT { if ( extract<int64_t>(value).check() ) { @@ -71,7 +71,7 @@ namespace python_coupling { return object( extractedValue ); } - static object broadcast_real( object value, int sendRank ) + static object broadcast_real( object value, int sendRank ) //NOLINT { if ( extract<real_t>(value).check() ) { @@ -92,7 +92,7 @@ namespace python_coupling { //=================================================================================================================== - static object reduce_int( object value, mpi::Operation op, int recvRank ) + static object reduce_int( object value, mpi::Operation op, int recvRank ) //NOLINT { if ( extract<int64_t>(value).check() ) { @@ -105,7 +105,7 @@ namespace python_coupling { return object( extractedValue ); } - static object reduce_real( object value, mpi::Operation op, int recvRank ) + static object reduce_real( object value, mpi::Operation op, int recvRank ) //NOLINT { if ( extract<real_t>(value).check() ) { @@ -119,7 +119,7 @@ namespace python_coupling { } - static object allreduce_int( object value, mpi::Operation op ) + static object allreduce_int( object value, mpi::Operation op ) //NOLINT { if ( extract<int64_t>(value).check() ) { @@ -132,7 +132,7 @@ namespace python_coupling { return object( extractedValue ); } - static object allreduce_real( object value, mpi::Operation op ) + static object allreduce_real( object value, mpi::Operation op ) //NOLINT { if ( extract<real_t>(value).check() ) { @@ -152,7 +152,7 @@ namespace python_coupling { // //=================================================================================================================== - static IntStdVector gather_int( object value, int recvRank ) + static IntStdVector gather_int( object value, int recvRank ) //NOLINT { if ( ! extract<int64_t>(value).check() ) { @@ -163,7 +163,7 @@ namespace python_coupling { return mpi::gather( extractedValue , recvRank ); } - static RealStdVector gather_real( object value, int recvRank ) + static RealStdVector gather_real( object value, int recvRank ) //NOLINT { if ( ! extract<real_t>(value).check() ) { @@ -175,7 +175,7 @@ namespace python_coupling { } - static IntStdVector allgather_int( object value ) + static IntStdVector allgather_int( object value ) //NOLINT { if ( ! extract<int64_t>(value).check() ) { @@ -186,7 +186,7 @@ namespace python_coupling { return mpi::allGather( extractedValue ); } - static RealStdVector allgather_real( object value ) + static RealStdVector allgather_real( object value ) //NOLINT { if ( ! extract<real_t>(value).check() ) { diff --git a/src/vtk/python/Exports.cpp b/src/vtk/python/Exports.cpp index 86fe6e26f..719a6baeb 100644 --- a/src/vtk/python/Exports.cpp +++ b/src/vtk/python/Exports.cpp @@ -67,7 +67,7 @@ void exportModuleToPython() void ( VTKOutput::*p_setSamplingResolution1) ( const real_t ) = &VTKOutput::setSamplingResolution; void ( VTKOutput::*p_setSamplingResolution2) ( const real_t, const real_t, const real_t ) = &VTKOutput::setSamplingResolution; - class_<BlockCellDataWriterInterface, + class_<BlockCellDataWriterInterface, //NOLINT boost::noncopyable, shared_ptr<BlockCellDataWriterInterface> > ("BlockCellDataWriterInterface", no_init) ; -- GitLab