diff --git a/configure.ac b/configure.ac index 14d19e2e9..60994e2d7 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ AC_INIT([cantera], [2.1a1], [nick@ices.utexas.edu]) AC_CONFIG_HEADER(config.h) AC_CONFIG_AUX_DIR([build-aux]) #AX_ENABLE_BUILDDIR -AM_INIT_AUTOMAKE(-Wall -Werror) +AM_INIT_AUTOMAKE(-Wall -Werror -Wshadow) # snarf and provide versioning numbers AX_SPLIT_VERSION diff --git a/include/cantera/IdealGasMix.h b/include/cantera/IdealGasMix.h index 82ab1529f..5a4bd3038 100644 --- a/include/cantera/IdealGasMix.h +++ b/include/cantera/IdealGasMix.h @@ -19,13 +19,13 @@ public: IdealGasMix() : m_ok(false), m_r(0) {} - IdealGasMix(const std::string& infile, std::string id="") : + IdealGasMix(const std::string& infile, std::string id_="") : m_ok(false), m_r(0) { m_r = get_XML_File(infile); - m_id = id; - if (id == "-") { - id = ""; + m_id = id_; + if (id_ == "-") { + id_ = ""; } m_ok = buildSolutionFromXML(*m_r, m_id, "phase", this, this); @@ -35,8 +35,8 @@ public: IdealGasMix(XML_Node& root, - std::string id) : m_ok(false), m_r(&root), m_id(id) { - m_ok = buildSolutionFromXML(root, id, "phase", this, this); + std::string id_) : m_ok(false), m_r(&root), m_id(id_) { + m_ok = buildSolutionFromXML(root, id_, "phase", this, this); } IdealGasMix(const IdealGasMix& other) : m_ok(false), diff --git a/include/cantera/base/XML_Writer.h b/include/cantera/base/XML_Writer.h index cda87fa2e..158aa9433 100644 --- a/include/cantera/base/XML_Writer.h +++ b/include/cantera/base/XML_Writer.h @@ -14,8 +14,8 @@ namespace Cantera class XML_Writer { public: - XML_Writer(std::ostream& output) : - m_s(output), _indent(" "), _level(0) {} + XML_Writer(std::ostream& output_) : + m_s(output_), _indent(" "), _level(0) {} virtual ~XML_Writer() {} std::ostream& m_s; diff --git a/include/cantera/base/xml.h b/include/cantera/base/xml.h index 2448f1560..b58d23c04 100644 --- a/include/cantera/base/xml.h +++ b/include/cantera/base/xml.h @@ -449,8 +449,8 @@ public: /*! * @param name The name of the XML node */ - void setName(const std::string& name) { - m_name = name; + void setName(const std::string& name_) { + m_name = name_; } //! Return the id attribute, if present diff --git a/include/cantera/kinetics/GasKinetics.h b/include/cantera/kinetics/GasKinetics.h index 529c5d4fe..c95dcf0e6 100644 --- a/include/cantera/kinetics/GasKinetics.h +++ b/include/cantera/kinetics/GasKinetics.h @@ -438,8 +438,8 @@ private: const std::vector& p); void updateKc(); - void registerReaction(size_t rxnNumber, int type, size_t loc) { - m_index[rxnNumber] = std::pair(type, loc); + void registerReaction(size_t rxnNumber, int type_, size_t loc) { + m_index[rxnNumber] = std::pair(type_, loc); } bool m_finalized; }; diff --git a/include/cantera/kinetics/StoichManager.h b/include/cantera/kinetics/StoichManager.h index 145e31c7d..cbbc66f72 100644 --- a/include/cantera/kinetics/StoichManager.h +++ b/include/cantera/kinetics/StoichManager.h @@ -459,7 +459,7 @@ public: m_rxn(npos) { } - C_AnyN(size_t rxn, const std::vector& ic, const vector_fp& order, const vector_fp& stoich) : + C_AnyN(size_t rxn, const std::vector& ic, const vector_fp& order_, const vector_fp& stoich_) : m_n(0), m_rxn(rxn) { m_n = ic.size(); @@ -468,8 +468,8 @@ public: m_stoich.resize(m_n); for (size_t n = 0; n < m_n; n++) { m_ic[n] = ic[n]; - m_order[n] = order[n]; - m_stoich[n] = stoich[n]; + m_order[n] = order_[n]; + m_stoich[n] = stoich_[n]; } } diff --git a/include/cantera/thermo/LatticeSolidPhase.h b/include/cantera/thermo/LatticeSolidPhase.h index 5511070e7..0629faa6b 100644 --- a/include/cantera/thermo/LatticeSolidPhase.h +++ b/include/cantera/thermo/LatticeSolidPhase.h @@ -653,7 +653,7 @@ public: * @param k Species k * @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar */ - virtual void modifyOneHf298SS(const int k, const doublereal Hf298New); + virtual void modifyOneHf298SS(const size_t &k, const doublereal Hf298New); #endif private: diff --git a/include/cantera/thermo/NasaPoly1.h b/include/cantera/thermo/NasaPoly1.h index 0e3a02ce1..6f8f52576 100644 --- a/include/cantera/thermo/NasaPoly1.h +++ b/include/cantera/thermo/NasaPoly1.h @@ -294,7 +294,7 @@ public: return h; } - virtual void modifyOneHf298(const int k, const doublereal Hf298New) { + virtual void modifyOneHf298(const size_t &k, const doublereal Hf298New) { if (k != m_index) { return; } diff --git a/include/cantera/thermo/Phase.h b/include/cantera/thermo/Phase.h index 18bcc985a..d64b7fda5 100644 --- a/include/cantera/thermo/Phase.h +++ b/include/cantera/thermo/Phase.h @@ -542,12 +542,12 @@ public: //! Set the internally stored density (kg/m^3) of the phase //! Note the density of a phase is an independent variable. //! @param[in] density density (kg/m^3). - virtual void setDensity(const doublereal density) { - if (density <= 0) { + virtual void setDensity(const doublereal density_) { + if (density_ <= 0) { throw CanteraError("Phase::setDensity", "density must be positive"); } - m_dens = density; + m_dens = density_; } //! Set the internally stored molar density (kmol/m^3) of the phase. diff --git a/src/apps/csvdiff.cpp b/src/apps/csvdiff.cpp index b086cbcf8..bf7624402 100644 --- a/src/apps/csvdiff.cpp +++ b/src/apps/csvdiff.cpp @@ -650,7 +650,7 @@ int main(int argc, char* argv[]) int* ColIsFloat1 = NULL, *ColIsFloat2 = NULL; double* curVarValues1 = NULL, *curVarValues2 = NULL; char** curStringValues1 = NULL, **curStringValues2 = NULL; - int i, j, ndiff, jmax, i1, i2, k; + int i, j, ndiff, jmax=0, i1, i2, k; bool found; double max_diff, rel_diff; int testPassed = RT_PASSED; diff --git a/src/equil/vcs_solve_TP.cpp b/src/equil/vcs_solve_TP.cpp index 8dc2432fd..0cd9c256d 100644 --- a/src/equil/vcs_solve_TP.cpp +++ b/src/equil/vcs_solve_TP.cpp @@ -4188,13 +4188,13 @@ void VCS_SOLVE::vcs_dfe(const int stateCalc, { size_t l1, l2, iph, kspec, irxn; size_t iphase; - double* tPhMoles_ptr; - double* actCoeff_ptr; - double* tlogMoles; + double* tPhMoles_ptr=0; + double* actCoeff_ptr=0; + double* tlogMoles=0; vcs_VolPhase* Vphase; - double* feSpecies; - double* molNum; + double* feSpecies=0; + double* molNum=0; if (stateCalc == VCS_STATECALC_OLD) { feSpecies = VCS_DATA_PTR(m_feSpecies_old); tPhMoles_ptr = VCS_DATA_PTR(m_tPhaseMoles_old); @@ -5239,9 +5239,9 @@ void VCS_SOLVE::vcs_deltag_Phase(const size_t iphase, const bool doDeleted, size_t irxn, kspec, kcomp; double* dtmp_ptr; - double* feSpecies; - double* deltaGRxn; - double* actCoeffSpecies; + double* feSpecies=0; + double* deltaGRxn=0; + double* actCoeffSpecies=0; if (stateCalc == VCS_STATECALC_NEW) { feSpecies = VCS_DATA_PTR(m_feSpecies_new); deltaGRxn = VCS_DATA_PTR(m_deltaGRxn_new); diff --git a/src/numerics/NonlinearSolver.cpp b/src/numerics/NonlinearSolver.cpp index 9a2824a65..f3d643a5c 100644 --- a/src/numerics/NonlinearSolver.cpp +++ b/src/numerics/NonlinearSolver.cpp @@ -3694,7 +3694,7 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f, { double* col_j; int info; - doublereal ysave, ydotsave, dy; + doublereal ysave, ydotsave=0., dy; int retn = 1; /* diff --git a/src/thermo/ConstCpPoly.cpp b/src/thermo/ConstCpPoly.cpp index 587282243..6ffda61b0 100644 --- a/src/thermo/ConstCpPoly.cpp +++ b/src/thermo/ConstCpPoly.cpp @@ -155,7 +155,7 @@ doublereal ConstCpPoly::reportHf298(doublereal* const h298) const return h; } -void ConstCpPoly::modifyOneHf298(const int k, const doublereal Hf298New) +void ConstCpPoly::modifyOneHf298(const size_t &k, const doublereal Hf298New) { if (k != m_index) { return; diff --git a/src/thermo/ConstCpPoly.h b/src/thermo/ConstCpPoly.h index 07ef86418..97d08a142 100644 --- a/src/thermo/ConstCpPoly.h +++ b/src/thermo/ConstCpPoly.h @@ -175,7 +175,7 @@ public: virtual doublereal reportHf298(doublereal* const h298 = 0) const; - virtual void modifyOneHf298(const int k, const doublereal Hf298New); + virtual void modifyOneHf298(const size_t &k, const doublereal Hf298New); #endif diff --git a/src/thermo/IonsFromNeutralVPSSTP.cpp b/src/thermo/IonsFromNeutralVPSSTP.cpp index e697f748b..abbc33191 100644 --- a/src/thermo/IonsFromNeutralVPSSTP.cpp +++ b/src/thermo/IonsFromNeutralVPSSTP.cpp @@ -1580,8 +1580,8 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN_diag() const */ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN() const { - size_t kcat, kNeut, mcat, mNeut; - doublereal fmij, mfmij; + size_t kcat = 0, kNeut = 0, mcat = 0, mNeut = 0; + doublereal fmij = 0.0, mfmij; dlnActCoeffdlnN_.zero(); /* * Get the activity coefficients of the neutral molecules diff --git a/src/thermo/LatticeSolidPhase.cpp b/src/thermo/LatticeSolidPhase.cpp index 8b39e786c..d71e93a10 100644 --- a/src/thermo/LatticeSolidPhase.cpp +++ b/src/thermo/LatticeSolidPhase.cpp @@ -673,11 +673,11 @@ void LatticeSolidPhase::setParametersFromXML(const XML_Node& eosdata) * @param k Species k * @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar */ -void LatticeSolidPhase::modifyOneHf298SS(const int k, const doublereal Hf298New) +void LatticeSolidPhase::modifyOneHf298SS(const size_t &k, const doublereal Hf298New) { - for (int n = 0; n < m_nlattice; n++) { + for (size_t n = 0; n < m_nlattice; n++) { if (lkstart_[n+1] < k) { - int kk = k-lkstart_[n]; + size_t kk = k-lkstart_[n]; SpeciesThermo& l_spthermo = m_lattice[n]->speciesThermo(); l_spthermo.modifyOneHf298(kk, Hf298New); } diff --git a/src/thermo/MixtureFugacityTP.cpp b/src/thermo/MixtureFugacityTP.cpp index f8a4a0398..657e193bf 100644 --- a/src/thermo/MixtureFugacityTP.cpp +++ b/src/thermo/MixtureFugacityTP.cpp @@ -1152,7 +1152,7 @@ doublereal MixtureFugacityTP::calculatePsat(doublereal TKelvin, doublereal& mola * First part of the calculation involves finding a pressure at which the * gas and the liquid state coexists. */ - doublereal presLiquid; + doublereal presLiquid = 0.; doublereal presGas; doublereal presBase = pres; bool foundLiquid = false; diff --git a/src/thermo/NasaPoly2.h b/src/thermo/NasaPoly2.h index 584ecae91..6459f470a 100644 --- a/src/thermo/NasaPoly2.h +++ b/src/thermo/NasaPoly2.h @@ -261,7 +261,7 @@ public: return h; } - void modifyOneHf298(const int k, const doublereal Hf298New) { + void modifyOneHf298(const size_t &k, const doublereal Hf298New) { if (k != m_index) { return; } diff --git a/src/thermo/RedlichKwongMFTP.cpp b/src/thermo/RedlichKwongMFTP.cpp index 38596a036..d1f6c2df9 100644 --- a/src/thermo/RedlichKwongMFTP.cpp +++ b/src/thermo/RedlichKwongMFTP.cpp @@ -1852,7 +1852,7 @@ int RedlichKwongMFTP::NicholsSolve(double TKelvin, double pres, doublereal a, do /* * Unfortunately, there is a heavy amount of roundoff error due to bad conditioning in this */ - double res, dresdV; + double res, dresdV = 0.0; for (int i = 0; i < nSolnValues; i++) { for (int n = 0; n < 20; n++) { res = an * Vroot[i] * Vroot[i] * Vroot[i] + bn * Vroot[i] * Vroot[i] + cn * Vroot[i] + dn; diff --git a/src/thermo/ShomatePoly.h b/src/thermo/ShomatePoly.h index 4be98d3e7..0bcc3c4fb 100644 --- a/src/thermo/ShomatePoly.h +++ b/src/thermo/ShomatePoly.h @@ -665,7 +665,7 @@ public: return h; } - virtual void modifyOneHf298(const int k, const doublereal Hf298New) { + virtual void modifyOneHf298(const size_t &k, const doublereal Hf298New) { if (k != m_index) { return; } diff --git a/src/thermo/SpeciesThermoFactory.cpp b/src/thermo/SpeciesThermoFactory.cpp index 36f957ffe..6447c3317 100644 --- a/src/thermo/SpeciesThermoFactory.cpp +++ b/src/thermo/SpeciesThermoFactory.cpp @@ -655,11 +655,9 @@ static void installStatMechThermoFromXML(const std::string& speciesName, { const XML_Node* fptr = tp[0]; int nRegTmp = tp.size(); - int nRegions = 0; vector_fp cPoly; - StatMech* np_ptr = 0; std::vector regionPtrs; - doublereal tmin, tmax, pref = OneAtm; + doublereal tmin, tmax = 0.0, pref = OneAtm; // Loop over all of the possible temperature regions for (int i = 0; i < nRegTmp; i++) { diff --git a/src/thermo/StatMech.cpp b/src/thermo/StatMech.cpp index 3f92fa777..fee919418 100644 --- a/src/thermo/StatMech.cpp +++ b/src/thermo/StatMech.cpp @@ -191,7 +191,7 @@ int StatMech::buildmap() SS.push_back("e"); // now place each species in a map - int ii; + size_t ii; for (ii=0; ii < SS.size(); ii++) { name_map[SS[ii]]=(new species); @@ -572,7 +572,6 @@ int StatMech::buildmap() name_map["e"]->mol_weight=0.00055; name_map["e"]->nvib=0; - int dum = 0; for (ii=0; ii < SS.size(); ii++) { // check nvib was initalized for all species if (name_map[SS[ii]]->nvib == -1) { diff --git a/src/transport/PecosTransport.cpp b/src/transport/PecosTransport.cpp index 327bdd3c3..1fe20ede7 100755 --- a/src/transport/PecosTransport.cpp +++ b/src/transport/PecosTransport.cpp @@ -276,7 +276,7 @@ void PecosTransport::getSpeciesFluxes(int ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, int ldf, doublereal* fluxes) { - int n, k; + int n=0, k; update_T(); update_C(); @@ -368,9 +368,9 @@ void PecosTransport::getMixDiffCoeffsMole(doublereal* const d) if (m_nsp == 1) { d[0] = m_bdiff(0,0) / p; } else { - for (size_t k = 0; k < m_nsp; k++) { + for (int k = 0; k < m_nsp; k++) { double sum2 = 0.0; - for (size_t j = 0; j < m_nsp; j++) { + for (int j = 0; j < m_nsp; j++) { if (j != k) { sum2 += m_molefracs[j] / m_bdiff(j,k); } @@ -400,10 +400,10 @@ void PecosTransport::getMixDiffCoeffsMass(doublereal* const d) if (m_nsp == 1) { d[0] = m_bdiff(0,0) / p; } else { - for (size_t k=0; k