Skip to content
Snippets Groups Projects
Commit 778295a2 authored by scott snyder's avatar scott snyder
Browse files

ExpressionEvaluator: Fix compilation warnings.

Don't rely on falling through between switch cases.
Unused function parameters.
parent ff0b07aa
No related branches found
No related tags found
1 merge request!99ExpressionEvaluator: Fix compilation warnings.
......@@ -57,21 +57,21 @@ public:
void setVariable(const char * name, const char * expression);
void setFunction(const char * name, double (*fun)()) {;}
void setFunction(const char * /*name*/, double (*/*fun*/)()) {;}
void setArray(const char * name, std::vector<double> array);
void setFunction(const char * name, double (*fun)(double)) {;}
void setFunction(const char * /*name*/, double (*/*fun*/)(double)) {;}
void setFunction(const char * name, double (*fun)(double,double)) {;}
void setFunction(const char * /*name*/, double (*/*fun*/)(double,double)) {;}
void setFunction(const char * name, double (*fun)(double,double,double)) {;}
void setFunction(const char * /*name*/, double (*/*fun*/)(double,double,double)) {;}
void setFunction(const char * name,
double (*fun)(double,double,double,double)) {;}
void setFunction(const char * /*name*/,
double (*/*fun*/)(double,double,double,double)) {;}
void setFunction(const char * name,
double (*fun)(double,double,double,double,double)) {;}
void setFunction(const char * /*name*/,
double (*/*fun*/)(double,double,double,double,double)) {;}
bool findVariable(const char * name) const;
......
......@@ -35,27 +35,27 @@ class IEvaluator {
virtual void setVariable(const char * name, const char * expression) = 0;
virtual void setFunction(const char * name, double (*fun)()) {;}
virtual void setFunction(const char * /*name*/, double (*/*fun*/)()) {;}
virtual void setFunction(const char * name, double (*fun)(double)) {;}
virtual void setFunction(const char * /*name*/, double (*/*fun*/)(double)) {;}
virtual void setFunction(const char * name, double (*fun)(double,double)) {;}
virtual void setFunction(const char * /*name*/, double (*/*fun*/)(double,double)) {;}
virtual void setFunction(const char * name, double (*fun)(double,double,double)) {;}
virtual void setFunction(const char * /*name*/, double (*/*fun*/)(double,double,double)) {;}
virtual void setFunction(const char * name,
double (*fun)(double,double,double,double)) {;}
virtual void setFunction(const char * /*name*/,
double (*/*fun*/)(double,double,double,double)) {;}
virtual void setFunction(const char * name,
double (*fun)(double,double,double,double,double)) {;}
virtual void setFunction(const char * /*name*/,
double (*/*fun*/)(double,double,double,double,double)) {;}
virtual bool findVariable(const char * name) const =0;
virtual bool findFunction(const char * name, int npar) const =0;
virtual void removeVariable(const char * name) {;}
virtual void removeVariable(const char * /*name*/) {;}
virtual void removeFunction(const char * name, int npar) {;}
virtual void removeFunction(const char * /*name*/, int /*npar*/) {;}
virtual void clear() {;}
......
......@@ -100,6 +100,7 @@ static int variable(const string & name, double & result,
pchar exp_end = exp_begin + strlen(exp_begin) - 1;
if (engine(exp_begin, exp_end, result, exp_end, dictionary) == EVAL::OK)
return EVAL::OK;
return EVAL::ERROR_CALCULATION_ERROR;
}
default:
return EVAL::ERROR_CALCULATION_ERROR;
......@@ -350,6 +351,7 @@ static int maker(int op, stack<double> & val)
errno = 0;
val.top() = std::pow(val1,val2);
if (errno == 0) return EVAL::OK;
return EVAL::ERROR_CALCULATION_ERROR;
case UNARY_PLUS: // unary operator '+'
val.top() = val1 + val2; // val1 is zero
return EVAL::OK;
......
......@@ -116,17 +116,17 @@ bool ExprtkEvaluator::findVariable(const char * name) const
return (varMap.find(name)!=varMap.end());
}
bool ExprtkEvaluator::findFunction(const char * name, int npar) const
bool ExprtkEvaluator::findFunction(const char * /*name*/, int /*npar*/) const
{
return true;
}
void ExprtkEvaluator::removeVariable(const char * name)
void ExprtkEvaluator::removeVariable(const char * /*name*/)
{
}
void ExprtkEvaluator::removeFunction(const char * name, int npar)
void ExprtkEvaluator::removeFunction(const char * /*name*/, int /*npar*/)
{
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment