Skip to content

Commit

Permalink
Issue #40/increase warning level on build (#51)
Browse files Browse the repository at this point in the history
* make releases as draft, to be manually published

* fix tnt

* fix RbtAtom warnings

* fix RbtError.h reorder warnings

* Fix reorder warnings in RbtBaseFileSource

* fix reorder warnings in RbtBaseGrid

* fix reorder warning in RbtBaseMolecularFileSink

* fix reorder warining in RbtCellTokenIter

* fix reorder warnings in RbtFFTGrid

* fix RbtRealGrid reorder warnings

* fix issues with virtual destructors (possible performance hit)

* fix reorder warnings in RbtStringTokenIter

* fix reorder warnings in RbtToken

* fix reorder warnings in RbtVble

* fix tnt array2d utils for braces

* lint
  • Loading branch information
ggutierrez-sunbright authored Dec 9, 2023
1 parent d6fd39c commit 158f004
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 62 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ jobs:
with:
tag: v${{ steps.set_version.outputs.RELEASE_VERSION }}
artifacts: artifacts/*/*.tar.gz
draft: true

4 changes: 2 additions & 2 deletions import/tnt/include/tnt_array2d_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ std::istream& operator>>(std::istream &s, Array2D<T> &A)

Array2D<T> B(M,N);

for (int i=0; i<M; i++)
for (int i=0; i<M; i++) {
for (int j=0; j<N; j++)
{
s >> B[i][j];
}

}
A = B;
return s;
}
Expand Down
10 changes: 6 additions & 4 deletions import/tnt/include/tnt_array3d_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ std::istream& operator>>(std::istream &s, Array3D<T> &A)

Array3D<T> B(M,N,K);

for (int i=0; i<M; i++)
for (int j=0; j<N; j++)
for (int k=0; k<K; k++)
for (int i=0; i<M; i++) {
for (int j=0; j<N; j++) {
for (int k=0; k<K; k++) {
s >> B[i][j][k];

}
}
}
A = B;
return s;
}
Expand Down
7 changes: 3 additions & 4 deletions import/tnt/include/tnt_fortran_array2d_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ std::istream& operator>>(std::istream &s, Fortran_Array2D<T> &A)

Fortran_Array2D<T> B(M,N);

for (int i=1; i<=M; i++)
for (int j=1; j<=N; j++)
{
for (int i=1; i<=M; i++) {
for (int j=1; j<=N; j++) {
s >> B(i,j);
}

}
A = B;
return s;
}
Expand Down
12 changes: 7 additions & 5 deletions import/tnt/include/tnt_fortran_array3d_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ std::istream& operator>>(std::istream &s, Fortran_Array3D<T> &A)

Fortran_Array3D<T> B(M,N,K);

for (int i=1; i<=M; i++)
for (int j=1; j<=N; j++)
for (int k=1; k<=K; k++)
s >> B(i,j,k);

for (int i=1; i<=M; i++) {
for (int j=1; j<=N; j++) {
for (int k=1; k<=K; k++) {
s >> B(i,j,k);
}
}
}
A = B;
return s;
}
Expand Down
18 changes: 9 additions & 9 deletions include/RbtAtom.h
Original file line number Diff line number Diff line change
Expand Up @@ -752,37 +752,37 @@ class isAtomLipophilic: public std::unary_function<RbtAtom*, RbtBool> {
// Other constructors check atomic number, force field type and hybridisation state coordination numbers
class isCoordinationNumber_eq: public std::unary_function<RbtAtom*, RbtBool> {
enum { TOTAL, ATNO, FFTYPE, HYBRID } eCNType; // Type of coordination number to check
RbtInt n; // Coordination number value to check
RbtUInt n; // Coordination number value to check
RbtInt atNo;
RbtString ffType;
RbtAtom::eHybridState hybrid;

public:
// Total coordination number
explicit isCoordinationNumber_eq(RbtInt nn):
n(nn),
explicit isCoordinationNumber_eq(RbtUInt nn):
eCNType(TOTAL),
n(nn),
atNo(0),
ffType(""),
hybrid(RbtAtom::UNDEFINED) {}
// Atomic number coordination number
explicit isCoordinationNumber_eq(RbtInt nn, RbtInt nAt):
n(nn),
explicit isCoordinationNumber_eq(RbtUInt nn, RbtUInt nAt):
eCNType(ATNO),
n(nn),
atNo(nAt),
ffType(""),
hybrid(RbtAtom::UNDEFINED) {}
// Force field type coordination number
explicit isCoordinationNumber_eq(RbtInt nn, const RbtString& strType):
n(nn),
explicit isCoordinationNumber_eq(RbtUInt nn, const RbtString& strType):
eCNType(FFTYPE),
n(nn),
atNo(0),
ffType(strType),
hybrid(RbtAtom::UNDEFINED) {}
// Hybridisation state coordination number
explicit isCoordinationNumber_eq(RbtInt nn, RbtAtom::eHybridState eState):
n(nn),
explicit isCoordinationNumber_eq(RbtUInt nn, RbtAtom::eHybridState eState):
eCNType(HYBRID),
n(nn),
atNo(0),
ffType(""),
hybrid(eState) {}
Expand Down
2 changes: 1 addition & 1 deletion include/RbtCavity.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class RbtCavity {
RbtCavity(istream& istr) { Read(istr); }

// Destructor
~RbtCavity(){};
virtual ~RbtCavity(){};

///////////////////////////////////////////////
// Stream functions
Expand Down
2 changes: 1 addition & 1 deletion include/RbtDockingSite.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class RbtDockingSite {
RbtDockingSite(istream& istr);

// Destructor
~RbtDockingSite();
virtual ~RbtDockingSite();

// Insertion operator
friend ostream& operator<<(ostream& s, const RbtDockingSite& site);
Expand Down
6 changes: 3 additions & 3 deletions include/RbtError.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ class RbtError {
// Default constructor
// Use to create an "error" with status=OK, no line, no file, no message
// All other constructors set the OK flag to false
RbtError(): m_strName(IDS_OK), m_strFile(""), m_nLine(0), m_strMessage(""), m_bOK(true) {}
RbtError(): m_strName(IDS_OK), m_strFile(""), m_strMessage(""), m_nLine(0), m_bOK(true) {}

// Parameterised constructor
// Use to create unspecified Rbt Errors
RbtError(const RbtString& strFile, RbtInt nLine, const RbtString& strMessage = ""):
m_strName(IDS_ERROR),
m_strFile(strFile),
m_nLine(nLine),
m_strMessage(strMessage),
m_nLine(nLine),
m_bOK(false) {}

// Default destructor
Expand Down Expand Up @@ -102,8 +102,8 @@ class RbtError {
RbtError(const RbtString& strName, const RbtString& strFile, RbtInt nLine, const RbtString& strMessage = ""):
m_strName(strName),
m_strFile(strFile),
m_nLine(nLine),
m_strMessage(strMessage),
m_nLine(nLine),
m_bOK(false) {}

///////////////////////
Expand Down
2 changes: 1 addition & 1 deletion include/RbtFFTGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class RbtFFTPeak {
public:
// Constructor
RbtFFTPeak(): index(0), coord(0.0, 0.0, 0.0), volume(0), height(0.0) {}
RbtFFTPeak(): index(0), coord(0.0, 0.0, 0.0), height(0.0), volume(0) {}

// Data attributes - public to avoid need for accessor functions
RbtUInt index; // Location of peak maximum - iXYZ index into grid
Expand Down
4 changes: 2 additions & 2 deletions include/RbtVble.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class RbtVble {
public:
static RbtString _CT;
enum VbleType { CTE, LIG, SCORE, SITE };
RbtVble(): value(0.0), vt(CTE), name("") { _RBTOBJECTCOUNTER_CONSTR_(_CT); }; // default const.
RbtVble(): vt(CTE), value(0.0), name("") { _RBTOBJECTCOUNTER_CONSTR_(_CT); }; // default const.
RbtVble(RbtString s, RbtReturnType val = 0.0): value(val), name(s) {
if (s.find("LIG_") == 0)
vt = LIG;
Expand All @@ -36,7 +36,7 @@ class RbtVble {
vt = CTE;
_RBTOBJECTCOUNTER_CONSTR_(_CT);
}
RbtVble(const RbtVble& v): value(v.value), vt(v.vt), name(v.name) { _RBTOBJECTCOUNTER_COPYCONSTR_(_CT); }
RbtVble(const RbtVble& v): vt(v.vt), value(v.value), name(v.name) { _RBTOBJECTCOUNTER_COPYCONSTR_(_CT); }
void SetValue(RbtReturnType val) {
value = val;
if (name == "") {
Expand Down
34 changes: 17 additions & 17 deletions src/lib/RbtAtom.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,29 @@ using std::ptr_fun;
// Initialise 2-D attributes to suitable defaults
// Initialise 3-D attributes to zero/null
RbtAtom::RbtAtom():
m_nAtomId(0),
m_nAtomicNo(6),
m_nAtomId(0),
m_strAtomName("C"),
m_strSubunitId("1"),
m_strSubunitName("RES"),
m_strSegmentName("SEG1"),
m_eState(UNDEFINED), // DM 8 Dec 1998 Changed from SP3 to UNDEFINED
m_nHydrogens(0),
m_nFormalCharge(0),
m_coord(0.0, 0.0, 0.0),
m_dPartialCharge(0.0),
m_dGroupCharge(0.0),
m_dAtomicMass(0.0),
m_dVdwRadius(0.0),
m_strFFType(""),
m_pModel(NULL),
m_bCyclic(false),
m_bSelected(false),
m_bUser1(false),
m_dUser1(1.0), // DM 27 Jul 2000 - initialise user values to 1 as they are commonly used as weightings
m_dUser2(1.0),
m_nPMFType(PMF_UNDEFINED),
m_triposType(RbtTriposAtomType::UNDEFINED) {
m_triposType(RbtTriposAtomType::UNDEFINED),
m_coord(0.0, 0.0, 0.0),
m_dPartialCharge(0.0),
m_dGroupCharge(0.0),
m_dAtomicMass(0.0),
m_dVdwRadius(0.0),
m_strFFType("") {
_RBTOBJECTCOUNTER_CONSTR_("RbtAtom");
}

Expand All @@ -66,29 +66,29 @@ RbtAtom::RbtAtom(
RbtUInt nHydrogens /*= 0*/,
RbtInt nFormalCharge /*= 0.0*/
):
m_nAtomId(nAtomId),
m_nAtomicNo(nAtomicNo),
m_nAtomId(nAtomId),
m_strAtomName(strAtomName),
m_strSubunitId(strSubunitId),
m_strSubunitName(strSubunitName),
m_strSegmentName(strSegmentName),
m_eState(eState),
m_nHydrogens(nHydrogens),
m_nFormalCharge(nFormalCharge),
m_coord(0.0, 0.0, 0.0),
m_dPartialCharge(0.0),
m_dGroupCharge(0.0),
m_dAtomicMass(0.0),
m_dVdwRadius(0.0),
m_strFFType(""),
m_pModel(NULL),
m_bCyclic(false),
m_bSelected(false),
m_bUser1(false),
m_dUser1(1.0), // DM 27 Jul 2000 - initialise user values to 1 as they are commonly used as weightings
m_dUser2(1.0),
m_nPMFType(PMF_UNDEFINED),
m_triposType(RbtTriposAtomType::UNDEFINED) {
m_triposType(RbtTriposAtomType::UNDEFINED),
m_coord(0.0, 0.0, 0.0),
m_dPartialCharge(0.0),
m_dGroupCharge(0.0),
m_dAtomicMass(0.0),
m_dVdwRadius(0.0),
m_strFFType("") {
_RBTOBJECTCOUNTER_CONSTR_("RbtAtom");
}

Expand All @@ -97,8 +97,8 @@ RbtAtom::~RbtAtom() { _RBTOBJECTCOUNTER_DESTR_("RbtAtom"); }

// Copy constructor
RbtAtom::RbtAtom(const RbtAtom& atom) {
m_nAtomId = atom.m_nAtomId;
m_nAtomicNo = atom.m_nAtomicNo;
m_nAtomId = atom.m_nAtomId;
m_strAtomName = atom.m_strAtomName;
m_strSubunitId = atom.m_strSubunitId;
m_strSubunitName = atom.m_strSubunitName;
Expand Down
6 changes: 3 additions & 3 deletions src/lib/RbtBaseFileSource.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// _RBTOBJECTCOUNTER_CONSTR_("RbtBaseFileSource");
// }

RbtBaseFileSource::RbtBaseFileSource(const RbtString& fileName): m_bMultiRec(false), m_bFileOpen(false) {
RbtBaseFileSource::RbtBaseFileSource(const RbtString& fileName): m_bFileOpen(false), m_bMultiRec(false) {
m_strFileName = fileName;
m_szBuf = new char[MAXLINELENGTH + 1]; // DM 24 Mar - allocate line buffer
ClearCache();
Expand All @@ -33,9 +33,9 @@ RbtBaseFileSource::RbtBaseFileSource(const RbtString& fileName): m_bMultiRec(fal

// Multi-record constructor
RbtBaseFileSource::RbtBaseFileSource(const RbtString& fileName, const RbtString& strRecDelim):
m_bFileOpen(false),
m_bMultiRec(true),
m_strRecDelim(strRecDelim),
m_bFileOpen(false) {
m_strRecDelim(strRecDelim) {
m_strFileName = fileName;
m_szBuf = new char[MAXLINELENGTH + 1]; // DM 24 Mar - allocate line buffer
ClearCache();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/RbtBaseGrid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ RbtString RbtBaseGrid::_CT("RbtBaseGrid");
RbtBaseGrid::RbtBaseGrid(
const RbtCoord& gridMin, const RbtCoord& gridStep, RbtUInt NX, RbtUInt NY, RbtUInt NZ, RbtUInt NPad
):
m_step(gridStep),
m_NX(NX),
m_NY(NY),
m_NZ(NZ),
m_N(NX * NY * NZ),
m_SX(NY * NZ),
m_SY(NZ),
m_SZ(1),
m_step(gridStep),
m_NPad(NPad) {
// Set the logical (real-world) dimensions of the grid
SetGridMin(gridMin);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/RbtBaseMolecularFileSink.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ RbtBaseMolecularFileSink::RbtBaseMolecularFileSink(
const RbtString& fileName, RbtModelPtr spModel, RbtBool bUseModelSegmentNames
):
RbtBaseFileSink(fileName),
m_bUseModelSegmentNames(bUseModelSegmentNames),
m_spModel(spModel),
m_bMultiConf(false),
m_bUseModelSegmentNames(bUseModelSegmentNames) {
m_bMultiConf(false) {
Reset();
_RBTOBJECTCOUNTER_CONSTR_("RbtBaseMolecularFileSink");
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/RbtCellTokenIter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RbtCellTokenIter::RbtCellTokenIter(const RbtGPChromosomePtr c, RbtContextPtr con
_RBTOBJECTCOUNTER_CONSTR_(_CT);
}

RbtCellTokenIter::RbtCellTokenIter(const RbtCellTokenIter& ti): chrom(ti.chrom), cells(ti.cells), current(ti.current) {
RbtCellTokenIter::RbtCellTokenIter(const RbtCellTokenIter& ti): chrom(ti.chrom), current(ti.current), cells(ti.cells) {
_RBTOBJECTCOUNTER_COPYCONSTR_(_CT);
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/RbtRealGrid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ RbtRealGrid::RbtRealGrid(
const RbtCoord& gridMin, const RbtCoord& gridStep, RbtUInt NX, RbtUInt NY, RbtUInt NZ, RbtUInt NPad
):
RbtBaseGrid(gridMin, gridStep, NX, NY, NZ, NPad),
m_tol(0.001),
m_grid(NULL),
m_data(NULL) {
m_data(NULL),
m_tol(0.001) {
CreateArrays();
// Initialise the grid to zero
SetAllValues(0.0);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/RbtStringTokenIter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ RbtStringTokenIter::RbtStringTokenIter(const istreamPtr fn, RbtContextPtr co): f
}

RbtStringTokenIter::RbtStringTokenIter(const RbtStringTokenIter& ti):
current(ti.current),
filep(ti.filep),
current(ti.current),
strtok(ti.strtok),
contextp(ti.contextp) {
_RBTOBJECTCOUNTER_COPYCONSTR_(_CT);
Expand Down
6 changes: 3 additions & 3 deletions src/lib/RbtToken.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ RbtString RbtToken::_CT("RbtToken");
///////////////////
// Constructors
///////////////////
RbtToken::RbtToken(const RbtVble& v): isvble(true), vble(v), comm(-1) { _RBTOBJECTCOUNTER_CONSTR_(_CT); }
RbtToken::RbtToken(const RbtVble& v): comm(-1), vble(v), isvble(true) { _RBTOBJECTCOUNTER_CONSTR_(_CT); }

RbtToken::RbtToken(RbtCommands c): isvble(false), comm(c), vble(RBT::defaultConstRbtVble) {
RbtToken::RbtToken(RbtCommands c): comm(c), vble(RBT::defaultConstRbtVble), isvble(false) {
_RBTOBJECTCOUNTER_CONSTR_(_CT);
}

RbtToken::RbtToken(const RbtToken& t): isvble(t.isvble), comm(t.comm), vble(t.vble) {
RbtToken::RbtToken(const RbtToken& t): comm(t.comm), vble(t.vble), isvble(t.isvble) {
_RBTOBJECTCOUNTER_COPYCONSTR_(_CT);
}

Expand Down

0 comments on commit 158f004

Please sign in to comment.