Fixed some compiler warning issues

This commit is contained in:
Ray Speth 2012-03-15 19:55:18 +00:00
parent 6ec589a9e5
commit 4506ee2f8a
28 changed files with 55 additions and 83 deletions

View file

@ -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'

View file

@ -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))

View file

@ -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.
/*!

View file

@ -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:

View file

@ -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)
{
}

View file

@ -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);

View file

@ -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);
}

View file

@ -1449,7 +1449,7 @@ extern "C" {
}
}
int write_HTML_log(char* file)
int write_HTML_log(const char* file)
{
try {
write_logfile(string(file));

View file

@ -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();

View file

@ -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;

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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]);

View file

@ -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);

View file

@ -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;

View file

@ -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");

View file

@ -20,7 +20,7 @@ public:
mexPrintf("%s", s.c_str());
}
virtual void writeendl(const std::string& msg) {
virtual void writeendl() {
mexPrintf("\n");
}

View file

@ -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;

View file

@ -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]);

View file

@ -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]);

View file

@ -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]);

View file

@ -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<double> x(nsp);
iok = -1;
switch (job) {
case 101:
checkNArgs(3,nrhs);

View file

@ -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) {

View file

@ -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);

View file

@ -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]);

View file

@ -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]);

View file

@ -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)

View file

@ -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;
}