Skip to content

Commit

Permalink
fix several warnings originating from the swig wrappers (rdkit#7063)
Browse files Browse the repository at this point in the history
  • Loading branch information
rvianello authored Jan 30, 2024
1 parent 19aff7f commit 25b7dbf
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 25 deletions.
3 changes: 0 additions & 3 deletions Code/GraphMol/FilterCatalog/FilterMatcherBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ struct RDKIT_FILTERCATALOG_EXPORT FilterMatch {
MatchVectType atomPairs)
: filterMatch(std::move(filter)), atomPairs(std::move(atomPairs)) {}

FilterMatch(const FilterMatch &rhs)
: filterMatch(rhs.filterMatch), atomPairs(rhs.atomPairs) {}

bool operator==(const FilterMatch &rhs) const {
return (filterMatch.get() == rhs.filterMatch.get() &&
atomPairs == rhs.atomPairs);
Expand Down
2 changes: 1 addition & 1 deletion Code/JavaWrappers/Atom.i
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
RDKit::markConjAtomBonds(($self));
}
int numBondsPlusLonePairs() {
RDKit::numBondsPlusLonePairs(($self));
return RDKit::numBondsPlusLonePairs(($self));
}
bool atomHasConjugatedBond() {
return RDKit::MolOps::atomHasConjugatedBond(($self));
Expand Down
2 changes: 1 addition & 1 deletion Code/JavaWrappers/Bond.i
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
/* Methods from MolFileStereoChem.h */
Bond::BondDir DetermineBondWedgeState(const std::map<int, std::unique_ptr<RDKit::Chirality::WedgeInfoBase>> &wedgeBonds,
const RDKit::Conformer *conf) {
RDKit::DetermineBondWedgeState(($self), wedgeBonds, conf);
return RDKit::DetermineBondWedgeState(($self), wedgeBonds, conf);
}

/* Based on corresponding methods in Atom.i */
Expand Down
2 changes: 1 addition & 1 deletion Code/JavaWrappers/FMCS.i
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
%{

RDKit::MCSResult findMCS(const std::vector<RDKit::ROMOL_SPTR>& mols){
RDKit::findMCS(mols,static_cast<const RDKit::MCSParameters *>(NULL));
return RDKit::findMCS(mols,static_cast<const RDKit::MCSParameters *>(NULL));
};
%}
6 changes: 4 additions & 2 deletions Code/JavaWrappers/FilterCatalog.i
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ typedef std::vector<std::string> STR_VECT;
return new RDKit::FilterCatalog(str);
}

bool canSerialize() const {
static bool canSerialize() {
return RDKit::FilterCatalogCanSerialize();
}

Expand Down Expand Up @@ -183,7 +183,9 @@ typedef std::vector<std::string> STR_VECT;
#ifdef SWIGCSHARP
%typemap(csbase) RDKit::FilterCatalogParams::FilterCatalogs "uint"
#endif


%immutable RDKit::DEFAULT_FILTERMATCHERBASE_NAME;

%include <GraphMol/FilterCatalog/FilterMatcherBase.h>
%include <GraphMol/FilterCatalog/FilterCatalogEntry.h>
%include <GraphMol/FilterCatalog/FilterCatalog.h>
Expand Down
11 changes: 5 additions & 6 deletions Code/JavaWrappers/ROMol.i
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ void setAllowNontetrahedralChirality(bool);
return RDKit::MolAlign::alignMol(*($self), refMol, prbCid, refCid, atomMap, weights, reflect, maxIters);
}

void alignMolConformers(ROMol &mol, const std::vector<unsigned int> *atomIds=0,
void alignMolConformers(const std::vector<unsigned int> *atomIds=0,
const std::vector<unsigned int> *confIds=0,
const RDNumeric::DoubleVector *weights=0,
bool reflect=false, unsigned int maxIters=50) {
Expand Down Expand Up @@ -711,13 +711,12 @@ void setAllowNontetrahedralChirality(bool);
return std::make_pair(rmsd,score);
}

void computeGasteigerCharges(const RDKit::ROMol *mol,int nIter=12,bool throwOnParamFailure=false){
RDKit::computeGasteigerCharges(*mol,nIter,throwOnParamFailure);
void computeGasteigerCharges(int nIter=12,bool throwOnParamFailure=false){
RDKit::computeGasteigerCharges(*($self),nIter,throwOnParamFailure);
}
void computeGasteigerCharges(const RDKit::ROMol *mol,
std::vector<double> &charges,
void computeGasteigerCharges(std::vector<double> &charges,
int nIter=12,bool throwOnParamFailure=false){
RDKit::computeGasteigerCharges(*mol,charges,nIter,throwOnParamFailure);
RDKit::computeGasteigerCharges(*($self),charges,nIter,throwOnParamFailure);
}

/* From new_canon.h*/
Expand Down
6 changes: 3 additions & 3 deletions Code/JavaWrappers/SubstanceGroup.i
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ unsigned int getSubstanceGroupCount(RDKit::ROMol &mol);
auto &attachPoints = $self->getAttachPoints();
return &(attachPoints[idx]);
}
const getBracketCount() {
size_t getBracketCount() {
return $self->getBrackets().size();
}
const getCStateCount() {
size_t getCStateCount() {
return $self->getCStates().size();
}
const getAttachPointCount() {
size_t getAttachPointCount() {
return $self->getAttachPoints().size();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Code/JavaWrappers/SubstructLibrary.i
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ using RDKit::GeneralizedSubstruct::ExtendedQueryMol;
return new RDKit::SubstructLibrary(str);
}

bool canSerialize() const {
static bool canSerialize() {
return RDKit::SubstructLibraryCanSerialize();
}
}
Expand Down
16 changes: 11 additions & 5 deletions Code/JavaWrappers/csharp_wrapper/GraphMolCSharp.i
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,19 @@
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, err.c_str());
return $null;
}
catch (RDKit::SmilesParseException e) {
catch (RDKit::SmilesParseException &e) {
std::string err="SmilesParseException: ";
err+=e.what();
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, err.c_str());
return $null;
}
catch (KeyErrorException e) {
catch (KeyErrorException &e) {
std::string err="KeyError: ";
err+=e.key();
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, err.c_str());
return $null;
}
catch (std::exception e) {
catch (std::exception &e) {
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "error");
return $null;
}
Expand Down Expand Up @@ -158,6 +158,7 @@ typedef unsigned long long int uintmax_t;

%shared_ptr(std::exception)
%shared_ptr(RDKit::RDProps)
%shared_ptr(RDKit::Conformer)
%shared_ptr(RDKit::ROMol)
%shared_ptr(RDKit::RWMol)
%shared_ptr(RDKit::Atom)
Expand Down Expand Up @@ -317,15 +318,15 @@ typedef unsigned long long int uintmax_t;
double getElement(int i) {
return (*($self))[i];
}
double setElement(int i, double value) {
void setElement(int i, double value) {
(*($self))[i] = value;
}
}
%extend boost::shared_array<int> {
int getElement(int i) {
return (*($self))[i];
}
int setElement(int i, int value) {
void setElement(int i, int value) {
(*($self))[i] = value;
}
}
Expand All @@ -344,4 +345,9 @@ typedef unsigned long long int uintmax_t;
%{
#include <RDGeneral/versions.h>
%}

%immutable RDKit::rdkitVersion;
%immutable RDKit::boostVersion;
%immutable RDKit::rdkitBuild;

%include <RDGeneral/versions.h>
10 changes: 8 additions & 2 deletions Code/JavaWrappers/gmwrapper/GraphMolJava.i
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ typedef unsigned long long int uintmax_t;

%shared_ptr(std::exception)
%shared_ptr(RDKit::RDProps)
%shared_ptr(RDKit::Conformer)
%shared_ptr(RDKit::ROMol)
%shared_ptr(RDKit::RWMol)
%shared_ptr(RDKit::Atom)
Expand Down Expand Up @@ -286,15 +287,15 @@ typedef unsigned long long int uintmax_t;
double getElement(int i) {
return (*($self))[i];
}
double setElement(int i, double value) {
void setElement(int i, double value) {
(*($self))[i] = value;
}
}
%extend boost::shared_array<int> {
int getElement(int i) {
return (*($self))[i];
}
int setElement(int i, int value) {
void setElement(int i, int value) {
(*($self))[i] = value;
}
}
Expand All @@ -313,4 +314,9 @@ typedef unsigned long long int uintmax_t;
%{
#include <RDGeneral/versions.h>
%}

%immutable RDKit::rdkitVersion;
%immutable RDKit::boostVersion;
%immutable RDKit::rdkitBuild;

%include <RDGeneral/versions.h>

0 comments on commit 25b7dbf

Please sign in to comment.