CBDD / rDock

rDock is a fast and versatile Open Source docking program that can be used to dock small molecules against proteins and nucleic acids. It is designed for High Throughput Virtual Screening (HTVS) campaigns and Binding Mode prediction studies.
https://rdock.github.io
GNU Lesser General Public License v3.0
51 stars 22 forks source link

increase warnings for build #40

Closed ggutierrez-sunbright closed 10 months ago

ggutierrez-sunbright commented 1 year ago

improve the code quality until compilers don't give any warnings with -Wall flag enabled

we will keep making the configuration stricter until we have code fully compliant with the standard

ggutierrez-sunbright commented 11 months ago

when -Wall is added to the compilation flags, 86 new unique errors show up (comprehensive list in the attached document).

after a quick classification we have this information:

Error type Count
-Werror=delete-non-virtual-dtor 2
-Werror=maybe-uninitialized 3
-Werror=misleading-indentation 4
-Werror=reorder 17*
-Werror=sign-compare 54
-Werror=unused-variable 6

While reorder, misleading indentation, and unused variable are mainly cosmetic issues, non-virtual destructor could produce memory leaks, and maybe uninitialized could lead to undefined behavior.

all of those should be fixed, prioritizing the dangerous ones.

* for each order change there are 3 [-Werror=reorder] entries in the log

ggutierrez-sunbright commented 11 months ago
./import/tnt/include/tnt_array3d_utils.h:47:5: error: this 'for' clause does not guard... [-Werror=misleading-indentation]
./import/tnt/include/tnt_fortran_array2d_utils.h:61:5: error: this 'for' clause does not guard... [-Werror=misleading-indentation]
./import/tnt/include/tnt_fortran_array3d_utils.h:65:5: error: this 'for' clause does not guard... [-Werror=misleading-indentation]
./include/RbtAtom.h:294:12: error:   'RbtInt RbtAtom::m_nAtomicNo' [-Werror=reorder]
./include/RbtAtom.h:295:12: error: 'RbtAtom::m_nAtomId' will be initialized after [-Werror=reorder]
./include/RbtAtom.h:303:15: error:   'RbtModel* RbtAtom::m_pModel' [-Werror=reorder]
./include/RbtAtom.h:319:15: error: 'RbtAtom::m_strFFType' will be initialized after [-Werror=reorder]
./include/RbtAtom.h:717:63: error: 'bIsGuan' may be used uninitialized [-Werror=maybe-uninitialized]
./include/RbtAtom.h:754:42: error:   'Rbt::isCoordinationNumber_eq::<unnamed enum> Rbt::isCoordinationNumber_eq::eCNType' [-Werror=reorder]
./include/RbtAtom.h:755:12: error: 'Rbt::isCoordinationNumber_eq::n' will be initialized after [-Werror=reorder]
./include/RbtAtom.h:762:14: error:   when initialized here [-Werror=reorder]
./include/RbtAtom.h:769:14: error:   when initialized here [-Werror=reorder]
./include/RbtAtom.h:776:14: error:   when initialized here [-Werror=reorder]
./include/RbtAtom.h:783:14: error:   when initialized here [-Werror=reorder]
./include/RbtAtom.h:792:55: error: comparison of integer expressions of different signedness: 'RbtUInt' {aka 'unsigned int'} and 'const RbtInt' {aka 'const int'} [-Werror=sign-compare]
./include/RbtAtom.h:794:59: error: comparison of integer expressions of different signedness: 'RbtUInt' {aka 'unsigned int'} and 'const RbtInt' {aka 'const int'} [-Werror=sign-compare]
./include/RbtAtom.h:796:61: error: comparison of integer expressions of different signedness: 'RbtUInt' {aka 'unsigned int'} and 'const RbtInt' {aka 'const int'} [-Werror=sign-compare]
./include/RbtAtom.h:798:61: error: comparison of integer expressions of different signedness: 'RbtUInt' {aka 'unsigned int'} and 'const RbtInt' {aka 'const int'} [-Werror=sign-compare]
./include/RbtBaseFileSource.h:89:13: error:   'RbtBool RbtBaseFileSource::m_bFileOpen' [-Werror=reorder]
./include/RbtBaseFileSource.h:90:13: error: 'RbtBaseFileSource::m_bMultiRec' will be initialized after [-Werror=reorder]
./include/RbtBaseFileSource.h:91:15: error: 'RbtBaseFileSource::m_strRecDelim' will be initialized after [-Werror=reorder]
./include/RbtBaseGrid.h:186:13: error:   'RbtUInt RbtBaseGrid::m_NX' [-Werror=reorder]
./include/RbtBaseGrid.h:195:15: error: 'RbtBaseGrid::m_step' will be initialized after [-Werror=reorder]
./include/RbtBaseMolecularFileSink.h:89:13: error:   'RbtBool RbtBaseMolecularFileSink::m_bUseModelSegmentNames' [-Werror=reorder]
./include/RbtBaseMolecularFileSink.h:97:13: error: 'RbtBaseMolecularFileSink::m_bMultiConf' will be initialized after [-Werror=reorder]
./include/RbtCellTokenIter.h:55:17: error:   'RbtTokenPtr RbtCellTokenIter::current' [-Werror=reorder]
./include/RbtCellTokenIter.h:56:19: error: 'RbtCellTokenIter::cells' will be initialized after [-Werror=reorder]
./include/RbtError.h:102:5: error:   when initialized here [-Werror=reorder]
./include/RbtError.h:114:15: error:   'RbtString RbtError::m_strMessage' [-Werror=reorder]
./include/RbtError.h:115:12: error: 'RbtError::m_nLine' will be initialized after [-Werror=reorder]
./include/RbtError.h:66:5: error:   when initialized here [-Werror=reorder]
./include/RbtError.h:70:5: error:   when initialized here [-Werror=reorder]
./include/RbtFFTGrid.h:25:5: error:   when initialized here [-Werror=reorder]
./include/RbtFFTGrid.h:30:15: error:   'RbtDouble RbtFFTPeak::height' [-Werror=reorder]
./include/RbtFFTGrid.h:31:13: error: 'RbtFFTPeak::volume' will be initialized after [-Werror=reorder]
./include/RbtRealGrid.h:198:14: error:   'float*** RbtRealGrid::m_grid' [-Werror=reorder]
./include/RbtRealGrid.h:200:15: error: 'RbtRealGrid::m_tol' will be initialized after [-Werror=reorder]
./include/RbtSmartPointer.h:165:13: error: deleting object of polymorphic class type 'RbtCavity' which has non-virtual destructor might cause undefined behavior [-Werror=delete-non-virtual-dtor]
./include/RbtSmartPointer.h:165:13: error: deleting object of polymorphic class type 'RbtDockingSite' which has non-virtual destructor might cause undefined behavior [-Werror=delete-non-virtual-dtor]
./include/RbtStringTokenIter.h:60:16: error:   'istreamPtr RbtStringTokenIter::filep' [-Werror=reorder]
./include/RbtStringTokenIter.h:61:17: error: 'RbtStringTokenIter::current' will be initialized after [-Werror=reorder]
./include/RbtToken.h:61:17: error:   'RbtCommands RbtToken::comm' [-Werror=reorder]
./include/RbtToken.h:62:20: error:   'const RbtVble& RbtToken::vble' [-Werror=reorder]
./include/RbtToken.h:62:20: error: 'RbtToken::vble' will be initialized after [-Werror=reorder]
./include/RbtToken.h:63:13: error: 'RbtToken::isvble' will be initialized after [-Werror=reorder]
./include/RbtVble.h:27:5: error:   when initialized here [-Werror=reorder]
./include/RbtVble.h:39:5: error:   when initialized here [-Werror=reorder]
./include/RbtVble.h:58:14: error:   'RbtVble::VbleType RbtVble::vt' [-Werror=reorder]
./include/RbtVble.h:59:19: error: 'RbtVble::value' will be initialized after [-Werror=reorder]
src/lib/RbtAtom.cxx:29:1: error:   when initialized here [-Werror=reorder]
src/lib/RbtAtom.cxx:58:1: error:   when initialized here [-Werror=reorder]
src/lib/RbtBaseFileSource.cxx:27:1: error:   when initialized here [-Werror=reorder]
src/lib/RbtBaseFileSource.cxx:35:1: error:   when initialized here [-Werror=reorder]
src/lib/RbtBaseGrid.cxx:27:1: error:   when initialized here [-Werror=reorder]
src/lib/RbtBaseMolecularFileSink.cxx:28:1: error:   when initialized here [-Werror=reorder]
src/lib/RbtBaseMolecularFileSource.cxx:355:22: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtBiMolWorkSpace.cxx:83:41: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtBond.cxx:40:13: error: unused variable 'bOK1' [-Werror=unused-variable]
src/lib/RbtBond.cxx:41:13: error: unused variable 'bOK2' [-Werror=unused-variable]
src/lib/RbtBond.cxx:53:13: error: unused variable 'bOK1' [-Werror=unused-variable]
src/lib/RbtBond.cxx:54:13: error: unused variable 'bOK2' [-Werror=unused-variable]
src/lib/RbtCellTokenIter.cxx:39:1: error:   when initialized here [-Werror=reorder]
src/lib/RbtChromElement.cxx:66:45: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtChromElement.cxx:66:68: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtChromElement.cxx:72:45: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<std::vector<double> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtChromElement.cxx:72:68: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<std::vector<double> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtConstraint.cxx:207:38: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtConstraint.cxx:218:38: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtConstraint.cxx:230:38: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtConstraint.cxx:240:38: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtConstraint.cxx:251:38: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtConstraint.cxx:262:38: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtConstraint.cxx:272:38: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtConstraint.cxx:282:38: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtConstraint.cxx:300:38: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtContext.cxx:104:12: error: unused variable 'nBonds' [-Werror=unused-variable]
src/lib/RbtContext.cxx:105:12: error: unused variable 'nSegs' [-Werror=unused-variable]
src/lib/RbtCrdFileSource.cxx:76:39: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtCrdFileSource.cxx:98:35: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtDihedralSF.cxx:108:56: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtDihedralSF.cxx:129:48: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtDihedralSF.cxx:31:26: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<RbtDihedral::prms>::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtDihedralSF.cxx:96:48: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtDockingSite.cxx:87:26: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<SmartPtr<RbtCavity> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtLigandSiteMapper.cxx:156:27: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtCavity> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtMOL2FileSource.cxx:136:35: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtMOL2FileSource.cxx:140:35: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtBond> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtMOL2FileSource.cxx:144:33: error: comparison of integer expressions of different signedness: 'std::map<int, RbtMOL2Substructure>::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtMOL2FileSource.cxx:306:49: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtMOL2FileSource.cxx:307:28: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtMOL2FileSource.cxx:352:30: error: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtMdlFileSource.cxx:100:39: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtMdlFileSource.cxx:146:35: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtMdlFileSource.cxx:158:39: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtBond> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtMdlFileSource.cxx:165:31: error: comparison of integer expressions of different signedness: 'RbtUInt' {aka 'unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtMdlFileSource.cxx:165:56: error: comparison of integer expressions of different signedness: 'RbtUInt' {aka 'unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtMdlFileSource.cxx:182:35: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtBond> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtMdlFileSource.cxx:52:40: error: comparison of integer expressions of different signedness: 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtMdlFileSource.cxx:57:36: error: comparison of integer expressions of different signedness: 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtModel.cxx:177:32: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtModel.cxx:505:56: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<std::vector<RbtAtom*> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtModel.cxx:533:56: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<std::vector<RbtAtom*> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtModelMutator.cxx:159:60: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<std::vector<RbtAtom*> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtModelMutator.cxx:168:60: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<std::vector<RbtAtom*> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtPMFDirSource.cxx:98:23: error: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtPMFIdxSF.cxx:64:23: error: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<RbtPMFValue> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtPMFIdxSF.cxx:73:27: error: comparison of integer expressions of different signedness: 'int' and 'std::vector<RbtPMFValue>::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtPMFIdxSF.cxx:85:23: error: comparison of integer expressions of different signedness: 'int' and 'std::vector<RbtPMFValue>::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtRealGrid.cxx:27:1: error:   when initialized here [-Werror=reorder]
src/lib/RbtSetupPMFSF.cxx:154:24: error: comparison of integer expressions of different signedness: 'long int' and 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtSetupPMFSF.cxx:368:23: error: comparison of integer expressions of different signedness: 'int' and 'std::vector<SmartPtr<RbtAtom> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]
src/lib/RbtSphereSiteMapper.cxx:189:27: error: comparison of integer expressions of different signedness: 'std::vector<SmartPtr<RbtCavity> >::size_type' {aka 'long unsigned int'} and 'RbtInt' {aka 'int'} [-Werror=sign-compare]
src/lib/RbtStringTokenIter.cxx:31:1: error:   when initialized here [-Werror=reorder]
src/lib/RbtToken.cxx:27:1: error:   when initialized here [-Werror=reorder]
src/lib/RbtToken.cxx:29:1: error:   when initialized here [-Werror=reorder]
src/lib/RbtToken.cxx:33:1: error:   when initialized here [-Werror=reorder]
src/lib/RbtVdwSF.cxx:290:23: error: 'alphai' may be used uninitialized in this function [-Werror=maybe-uninitialized]
src/lib/RbtVdwSF.cxx:329:71: error: 'Ii' may be used uninitialized in this function [-Werror=maybe-uninitialized]
src/lib/RbtVdwSF.cxx:396:41: error: comparison of integer expressions of different signedness: 'RbtInt' {aka 'int'} and 'std::vector<std::vector<RbtAtom*> >::size_type' {aka 'long unsigned int'} [-Werror=sign-compare]