diff --git a/SConstruct b/SConstruct index 734da19c2..5f15b468e 100644 --- a/SConstruct +++ b/SConstruct @@ -188,14 +188,14 @@ elif env['CC'] == 'cl': # Visual Studio elif env['CC'] == 'icc': defaults.cxxFlags = '-ftemplate-depth-128' - defaults.ccFlags = '-Wcheck -vec-report0' + defaults.ccFlags = '-Wcheck -vec-report0 -diag-disable 1478' defaults.debugCcFlags = '-g' defaults.noOptimizeCcFlags = '-O0 -fno-inline' defaults.optimizeCcFlags = '-O3 -finline-functions -DNDEBUG' elif env['CC'] == 'clang': defaults.cxxFlags = '' - defaults.ccFlags = '-fcolor-diagnostics' + defaults.ccFlags = '-Wall -fcolor-diagnostics -Wno-deprecated-declarations' defaults.debugCcFlags = '-g' defaults.noOptimizeCcFlags = '-O0' defaults.optimizeCcFlags = '-O3 -DNDEBUG' diff --git a/ext/SConscript b/ext/SConscript index 729f68732..b5dab2ca8 100644 --- a/ext/SConscript +++ b/ext/SConscript @@ -45,13 +45,6 @@ def prep_sundials(env): return localenv -def prep_libexecstream(env): - localenv = env.Clone() - if '-Wall' in localenv['CCFLAGS']: - localenv['CCFLAGS'].append('-Wno-unused-result') - - return localenv - def prep_gtest(env): localenv = env.Clone() localenv.Append(CPPPATH=[Dir('#ext/gtest'), @@ -60,7 +53,7 @@ def prep_gtest(env): return localenv # (subdir, (file extensions), prepfunction) -libs = [('libexecstream', ['cpp'], prep_libexecstream)] +libs = [('libexecstream', ['cpp'], prep_default)] if env['build_with_f2c']: libs.append(('f2c_math', ['cpp','c'], prep_f2c)) diff --git a/include/cantera/thermo/RedlichKwongMFTP.h b/include/cantera/thermo/RedlichKwongMFTP.h index f7be1b57f..824432326 100644 --- a/include/cantera/thermo/RedlichKwongMFTP.h +++ b/include/cantera/thermo/RedlichKwongMFTP.h @@ -308,14 +308,14 @@ public: * @return * Returns the standard Concentration in units of m3 kmol-1. */ - virtual doublereal standardConcentration(int k=0) const; + virtual doublereal standardConcentration(size_t k=0) const; //! Returns the natural logarithm of the standard //! concentration of the kth species /*! * @param k index of the species. (defaults to zero) */ - virtual doublereal logStandardConc(int k=0) const; + virtual doublereal logStandardConc(size_t k=0) const; //! Returns the units of the standard and generalized concentrations. /*! diff --git a/interfaces/python/Cantera/Kinetics.py b/interfaces/python/Cantera/Kinetics.py index 6a07e907a..a4cbb8d11 100755 --- a/interfaces/python/Cantera/Kinetics.py +++ b/interfaces/python/Cantera/Kinetics.py @@ -18,6 +18,7 @@ class Kinetics: def __init__(self, kintype=-1, thrm=0, xml_phase=None, id=None, phases=[]): """ Build a kinetics manager from an XML specification. + :param kintype: Integer specifying the type of kinetics manager to create. :param root: diff --git a/src/base/ctexceptions.cpp b/src/base/ctexceptions.cpp index 7ede4d96e..989026ae4 100644 --- a/src/base/ctexceptions.cpp +++ b/src/base/ctexceptions.cpp @@ -14,8 +14,8 @@ namespace Cantera { static const char* stars = "***********************************************************************\n"; CanteraError::CanteraError(std::string procedure, std::string msg) : - msg_(msg), procedure_(procedure), + msg_(msg), saved_(false) { } diff --git a/src/base/mdp_allo.cpp b/src/base/mdp_allo.cpp index b4f0b3dd3..b5a93bfbd 100644 --- a/src/base/mdp_allo.cpp +++ b/src/base/mdp_allo.cpp @@ -2,10 +2,6 @@ * @file mdp_allo.cpp * Definitions for dynamic allocation of multidimensional pointer arrays */ -/* - * $Revision$ - * $Date$ - */ /* * Copyright 2004 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government @@ -340,14 +336,7 @@ static double* smalloc(size_t n) FILE* file; #endif double* pntr; - if (n < 0) { - if (MDP_ALLO_errorOption == 7 || - MDP_ALLO_errorOption == 5 || MDP_ALLO_errorOption == 3 || - MDP_ALLO_errorOption == 1) { - (void) fprintf(stderr, "smalloc ERROR: Non-positive argument. (%d)\n", (int) n); - return NULL; - } - } else if (n == 0) { + if (n == 0) { pntr = NULL; } else { n = ((n - 1) / 8); diff --git a/src/base/xml.cpp b/src/base/xml.cpp index 113a07589..55d17eb11 100644 --- a/src/base/xml.cpp +++ b/src/base/xml.cpp @@ -306,11 +306,11 @@ void XML_Reader::parseTag(std::string tag, std::string& name, { string::size_type iloc; string attr, val; - string s = strip(tag); + string s = stripws(tag); iloc = s.find(' '); if (iloc != string::npos) { name = s.substr(0, iloc); - s = strip(s.substr(iloc+1,s.size())); + s = stripws(s.substr(iloc+1,s.size())); if (s[s.size()-1] == '/') { name += "/"; } @@ -321,16 +321,16 @@ void XML_Reader::parseTag(std::string tag, std::string& name, if (iloc == string::npos) { break; } - attr = strip(s.substr(0,iloc)); + attr = stripws(s.substr(0,iloc)); if (attr == "") { break; } - s = strip(s.substr(iloc+1,s.size())); + s = stripws(s.substr(iloc+1,s.size())); iloc = findQuotedString(s, val); attribs[attr] = val; if (iloc != string::npos) { if (iloc < s.size()) { - s = strip(s.substr(iloc,s.size())); + s = stripws(s.substr(iloc,s.size())); } else { break; } @@ -414,7 +414,7 @@ std::string XML_Reader::readValue() tag += ch; } } - return strip(tag); + return stripws(tag); } diff --git a/src/clib/ct.cpp b/src/clib/ct.cpp index 666388c06..d9d9d35a2 100644 --- a/src/clib/ct.cpp +++ b/src/clib/ct.cpp @@ -1449,7 +1449,7 @@ extern "C" { } } - int write_HTML_log(char* file) + int write_HTML_log(const char* file) { try { write_logfile(string(file)); diff --git a/src/clib/ct.h b/src/clib/ct.h index 44904f5d9..966089fa2 100644 --- a/src/clib/ct.h +++ b/src/clib/ct.h @@ -143,7 +143,7 @@ extern "C" { int nphases, int* ith, int nkin); CANTERA_CAPI int getCanteraError(int buflen, char* buf); CANTERA_CAPI int showCanteraErrors(); - CANTERA_CAPI int write_HTML_log(char* file); + CANTERA_CAPI int write_HTML_log(const char* file); CANTERA_CAPI int setLogWriter(void* logger); CANTERA_CAPI int addCanteraDirectory(size_t buflen, char* buf); CANTERA_CAPI int clearStorage(); diff --git a/src/equil/vcs_dbolsm.c b/src/equil/vcs_dbolsm.c index 09633023d..019c33385 100644 --- a/src/equil/vcs_dbolsm.c +++ b/src/equil/vcs_dbolsm.c @@ -1353,8 +1353,9 @@ L540: } i__1 = *ncols; for (j = 1; j <= i__1; ++j) { - if (bl[j] <= zero && zero <= bu[j] && (d__1 = bu[j], abs(d__1)) < ( - d__2 = bl[j], abs(d__2)) || bu[j] < zero) { + if ((bl[j] <= zero && zero <= bu[j] && + (d__1 = bu[j], abs(d__1)) < (d__2 = bl[j], abs(d__2))) || + bu[j] < zero) { t = bu[j]; bu[j] = -bl[j]; bl[j] = -t; diff --git a/src/matlab/ctfunctions.cpp b/src/matlab/ctfunctions.cpp index 8629b5b15..9f4235643 100644 --- a/src/matlab/ctfunctions.cpp +++ b/src/matlab/ctfunctions.cpp @@ -26,7 +26,7 @@ void ctfunctions(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { int job = getInt(prhs[1]); - int iok, dbg, validate; + int iok = 0, dbg, validate; char* infile, *dbfile, *trfile, *idtag; int buflen = 0; char* output_buf = 0; diff --git a/src/matlab/ctmethods.cpp b/src/matlab/ctmethods.cpp index 579ed5149..efbf2bf19 100644 --- a/src/matlab/ctmethods.cpp +++ b/src/matlab/ctmethods.cpp @@ -79,7 +79,7 @@ void initLogger() if (!_logger) { _logger = new Cantera::ML_Logger; // Call the DLL program to set the logger - int retn = setLogWriter(_logger); + setLogWriter(_logger); } } diff --git a/src/matlab/flowdevicemethods.cpp b/src/matlab/flowdevicemethods.cpp index 4aa8b0b12..722d8f6cd 100644 --- a/src/matlab/flowdevicemethods.cpp +++ b/src/matlab/flowdevicemethods.cpp @@ -7,7 +7,7 @@ void flowdevicemethods(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { - int m, iok, n; + int m, iok = 0, n; int job = getInt(prhs[1]); int i = getInt(prhs[2]); diff --git a/src/matlab/funcmethods.cpp b/src/matlab/funcmethods.cpp index e874d304f..3581b34e1 100644 --- a/src/matlab/funcmethods.cpp +++ b/src/matlab/funcmethods.cpp @@ -38,7 +38,7 @@ void funcmethods(int nlhs, mxArray* plhs[], else { int nn = 0; double t; - double v; + double v = 0.0; int i = getInt(prhs[2]); if (job == 1) { nn = func_del(i); diff --git a/src/matlab/kineticsmethods.cpp b/src/matlab/kineticsmethods.cpp index 715785bf5..43ac2e28b 100644 --- a/src/matlab/kineticsmethods.cpp +++ b/src/matlab/kineticsmethods.cpp @@ -11,7 +11,7 @@ void checkNArgs(const int n, const int nrhs) void kineticsmethods(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { - double vv; + double vv = 0.0; int job = getInt(prhs[2]); int kin, irxn; diff --git a/src/matlab/mixturemethods.cpp b/src/matlab/mixturemethods.cpp index fe1676b55..9c4803f2f 100644 --- a/src/matlab/mixturemethods.cpp +++ b/src/matlab/mixturemethods.cpp @@ -11,7 +11,7 @@ using namespace std; void mixturemethods(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { - int m, iok, n; + int m, iok = 0, n; int job = getInt(prhs[1]); int i = getInt(prhs[2]); @@ -164,12 +164,12 @@ void mixturemethods(int nlhs, mxArray* plhs[], plhs[0] = mxCreateNumericMatrix(nsp,1, mxDOUBLE_CLASS,mxREAL); double* h = mxGetPr(plhs[0]); if (iok >= 0) { - for (int i = 0; i < nsp; i++) { + for (mwSize i = 0; i < nsp; i++) { h[i] = x[i]; } return; } else { - for (int i = 0; i < nsp; i++) { + for (mwSize i = 0; i < nsp; i++) { h[i] = -999.99; } mexErrMsgTxt("unknown attribute"); diff --git a/src/matlab/mllogger.h b/src/matlab/mllogger.h index 6669ca646..1fa812788 100644 --- a/src/matlab/mllogger.h +++ b/src/matlab/mllogger.h @@ -20,7 +20,7 @@ public: mexPrintf("%s", s.c_str()); } - virtual void writeendl(const std::string& msg) { + virtual void writeendl() { mexPrintf("\n"); } diff --git a/src/matlab/onedimmethods.cpp b/src/matlab/onedimmethods.cpp index e5f9a40d0..79fe3780c 100644 --- a/src/matlab/onedimmethods.cpp +++ b/src/matlab/onedimmethods.cpp @@ -10,11 +10,11 @@ using namespace Cantera; void onedimmethods(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { - double vv; + double vv = 0.0; int job = getInt(prhs[2]); size_t n, m; double* dom_ids, *h; - int indx; + int indx = 0; char* nm; int dom; diff --git a/src/matlab/phasemethods.cpp b/src/matlab/phasemethods.cpp index b6b83ec09..e88891c55 100644 --- a/src/matlab/phasemethods.cpp +++ b/src/matlab/phasemethods.cpp @@ -8,12 +8,11 @@ void phasemethods(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { - double vv; + double vv = 0.0; int iok=0, k; int ph = getInt(prhs[1]); int job = getInt(prhs[2]); - bool ok = true; char* input_buf; double* ptr = 0; size_t nsp, n, m; @@ -31,7 +30,6 @@ void phasemethods(int nlhs, mxArray* plhs[], nsp = phase_nSpecies(ph); // set scalar attributes - bool ok = true; if (mjob < 10) { if (m != 1 || n != 1) { mexErrMsgTxt("value must be scalar."); @@ -45,7 +43,7 @@ void phasemethods(int nlhs, mxArray* plhs[], iok = phase_setDensity(ph,*ptr); break; default: - ok = false; + mexErrMsgTxt("Unknown job number"); } } @@ -69,7 +67,7 @@ void phasemethods(int nlhs, mxArray* plhs[], iok = phase_setMassFractions(ph, nsp, ptr, norm); break; default: - ok = false; + mexErrMsgTxt("Unknown job number"); } } else { mexErrMsgTxt("wrong array size"); @@ -102,7 +100,7 @@ void phasemethods(int nlhs, mxArray* plhs[], iok = phase_setName(ph, input_buf); break; default: - mexErrMsgTxt("what?"); + mexErrMsgTxt("Unknown job number"); } } else { mexErrMsgTxt("expected a string."); @@ -156,17 +154,15 @@ void phasemethods(int nlhs, mxArray* plhs[], vv = write_phase(ph,show_thermo); break; default: - ok = false; + mexErrMsgTxt("Unknown job number"); } - if (ok) { - if (vv == DERR || vv == -1 || vv == ERR) { - reportError(); - } - plhs[0] = mxCreateNumericMatrix(1,1,mxDOUBLE_CLASS,mxREAL); - double* h = mxGetPr(plhs[0]); - *h = vv; - return; + if (vv == DERR || vv == -1 || vv == ERR) { + reportError(); } + plhs[0] = mxCreateNumericMatrix(1,1,mxDOUBLE_CLASS,mxREAL); + double* h = mxGetPr(plhs[0]); + *h = vv; + return; } else if (job < 30) { @@ -184,7 +180,7 @@ void phasemethods(int nlhs, mxArray* plhs[], iok = phase_getMolecularWeights(ph,nsp, &x[0]); break; default: - ; + mexErrMsgTxt("Unknown job number"); } plhs[0] = mxCreateNumericMatrix((mwSize) nsp, 1, mxDOUBLE_CLASS, mxREAL); double* h = mxGetPr(plhs[0]); diff --git a/src/matlab/reactormethods.cpp b/src/matlab/reactormethods.cpp index 85b2e0a9b..d4335e1e3 100644 --- a/src/matlab/reactormethods.cpp +++ b/src/matlab/reactormethods.cpp @@ -9,7 +9,7 @@ void reactormethods(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { - int iok, n; + int iok = 0, n; int job = getInt(prhs[1]); int i = getInt(prhs[2]); diff --git a/src/matlab/reactornetmethods.cpp b/src/matlab/reactornetmethods.cpp index 4eacdb932..c6101bc10 100644 --- a/src/matlab/reactornetmethods.cpp +++ b/src/matlab/reactornetmethods.cpp @@ -11,7 +11,7 @@ void reactornetmethods(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { - int iok, n; + int iok = 0, n; int job = getInt(prhs[1]); int i = getInt(prhs[2]); diff --git a/src/matlab/surfmethods.cpp b/src/matlab/surfmethods.cpp index e1bddb999..5448b761c 100644 --- a/src/matlab/surfmethods.cpp +++ b/src/matlab/surfmethods.cpp @@ -14,7 +14,7 @@ void surfmethods(int nlhs, mxArray* plhs[], { double vv; int job = getInt(prhs[2]); - int iok; + int iok = 0; double* ptr; char* str; size_t nsp, n, m; @@ -66,7 +66,7 @@ void surfmethods(int nlhs, mxArray* plhs[], else if (job < 200) { nsp = phase_nSpecies(surf); std::vector x(nsp); - + iok = -1; switch (job) { case 101: checkNArgs(3,nrhs); diff --git a/src/matlab/thermomethods.cpp b/src/matlab/thermomethods.cpp index 6fc80dd21..87fd6b380 100644 --- a/src/matlab/thermomethods.cpp +++ b/src/matlab/thermomethods.cpp @@ -18,8 +18,6 @@ static void thermoset(int nlhs, mxArray* plhs[], size_t m = mxGetM(prhs[3]); size_t n = mxGetN(prhs[3]); - bool ok = true; - // scalar attributes if (job < 20) { if (m != 1 || n != 1) { diff --git a/src/matlab/transportmethods.cpp b/src/matlab/transportmethods.cpp index 0163f661f..1aeaf797c 100644 --- a/src/matlab/transportmethods.cpp +++ b/src/matlab/transportmethods.cpp @@ -8,7 +8,7 @@ void reportError(); void transportmethods(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { - double vv; + double vv = 0.0; int n = getInt(prhs[1]); int job = getInt(prhs[2]); double* h; @@ -33,7 +33,6 @@ void transportmethods(int nlhs, mxArray* plhs[], if (job < 10) { - bool ok = true; switch (job) { case 0: delTransport(n); diff --git a/src/matlab/wallmethods.cpp b/src/matlab/wallmethods.cpp index c9912716c..b6ed83965 100644 --- a/src/matlab/wallmethods.cpp +++ b/src/matlab/wallmethods.cpp @@ -11,7 +11,7 @@ void wallmethods(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { - int m, iok, n; + int m, iok = 0, n; int job = getInt(prhs[1]); int i = getInt(prhs[2]); diff --git a/src/matlab/xmlmethods.cpp b/src/matlab/xmlmethods.cpp index 0bfc39319..381717a68 100644 --- a/src/matlab/xmlmethods.cpp +++ b/src/matlab/xmlmethods.cpp @@ -39,7 +39,7 @@ static bool nargs_ok(int job, int n) void xmlmethods(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { - int j, m, iok; + int j, m, iok = 0; char* file, *key, *val, *nm; int job = getInt(prhs[1]); diff --git a/src/thermo/Phase.cpp b/src/thermo/Phase.cpp index d0393f67b..796cd06ef 100644 --- a/src/thermo/Phase.cpp +++ b/src/thermo/Phase.cpp @@ -931,8 +931,6 @@ void Phase::freezeSpecies() { m_speciesFrozen = true; init(molecularWeights()); - size_t kk = nSpecies(); - m_kk = nSpecies(); } void Phase::init(const vector_fp& mw) diff --git a/src/thermo/RedlichKwongMFTP.cpp b/src/thermo/RedlichKwongMFTP.cpp index cd3f7cd7b..ba18d046a 100644 --- a/src/thermo/RedlichKwongMFTP.cpp +++ b/src/thermo/RedlichKwongMFTP.cpp @@ -429,11 +429,8 @@ doublereal RedlichKwongMFTP::isothermalCompressibility() const //==================================================================================================================== void RedlichKwongMFTP::getActivityConcentrations(doublereal* c) const { - - int k; getPartialMolarVolumes(DATA_PTR(m_partialMolarVolumes)); - - for (k = 0; k < m_kk; k++) { + for (size_t k = 0; k < m_kk; k++) { c[k] = moleFraction(k) / m_partialMolarVolumes[k]; } } @@ -442,7 +439,7 @@ void RedlichKwongMFTP::getActivityConcentrations(doublereal* c) const * Returns the standard concentration \f$ C^0_k \f$, which is used to normalize * the generalized concentration. */ -doublereal RedlichKwongMFTP::standardConcentration(int k) const +doublereal RedlichKwongMFTP::standardConcentration(size_t k) const { getStandardVolumes(DATA_PTR(m_tmpV)); @@ -457,7 +454,7 @@ doublereal RedlichKwongMFTP::standardConcentration(int k) const * Returns the natural logarithm of the standard * concentration of the kth species */ -doublereal RedlichKwongMFTP::logStandardConc(int k) const +doublereal RedlichKwongMFTP::logStandardConc(size_t k) const { double c = standardConcentration(k); double lc = std::log(c); @@ -574,7 +571,7 @@ void RedlichKwongMFTP::getChemPotentials_RT(doublereal* muRT) const { getChemPotentials(muRT); doublereal invRT = 1.0 / _RT(); - for (int k = 0; k < m_kk; k++) { + for (size_t k = 0; k < m_kk; k++) { muRT[k] *= invRT; } } @@ -1125,7 +1122,7 @@ void RedlichKwongMFTP::readXMLCrossFluid(XML_Node& CrossFluidParam) throw CanteraError("RedlichKwongMFTP::readXMLCrossFluid", "no species1 attribute"); } size_t iSpecies = speciesIndex(iName); - if (iSpecies < 0) { + if (iSpecies == npos) { return; } string jName = CrossFluidParam.attrib("species2"); @@ -1133,7 +1130,7 @@ void RedlichKwongMFTP::readXMLCrossFluid(XML_Node& CrossFluidParam) throw CanteraError("RedlichKwongMFTP::readXMLCrossFluid", "no species2 attribute"); } size_t jSpecies = speciesIndex(jName); - if (jSpecies < 0) { + if (jSpecies == npos) { return; }