Browse Source

Fix clang and cppcheck warnings

test
Michael Uleysky 9 years ago
parent
commit
a23c393e9e
  1. 4
      src/deptree.cpp
  2. 2
      src/object.cpp
  3. 2
      src/object.h
  4. 4
      src/parser/lexical.l

4
src/deptree.cpp

@ -147,7 +147,7 @@ DepTree::LeafVector DepTree::FindLeafNodes() const
{
if(it!=end)
{
if((*it)->visited==isvisited) {it++; continue;}
if((*it)->visited==isvisited) {++it; continue;}
path.push(it); ends.push(end);
curnode=(*it);
curnode->visited=isvisited;
@ -160,7 +160,7 @@ DepTree::LeafVector DepTree::FindLeafNodes() const
if(path.size()==0) break;
it=path.top(); path.pop();
end=ends.top(); ends.pop();
it++;
++it;
}
}

2
src/object.cpp

@ -6,7 +6,7 @@ template<> EXPORT std::string ObjectSimple<int64_t>::type="integer";
template<> EXPORT std::string ObjectSimple<double>::type="real";
template<> EXPORT std::string ObjectSimple<std::string>::type="string";
inline ObjectBase* OFunc::Evaluate(bool* err)
ObjectBase* OFunc::Evaluate(bool* err)
{
*err=false;
if(G_funcs.find(name)==G_funcs.end())

2
src/object.h

@ -283,7 +283,7 @@ class OId: public ObjectBase
std::string name;
public:
OId(const std::string* t) {name=*t;}
OId(const std::string* t):name(*t) {}
~OId() {}
bool Print() const override {return false;}
std::string Type() const override {return "IDENT";}

4
src/parser/lexical.l

@ -28,7 +28,7 @@ class ObjectBase;
// Get rid of warning on unused function
#define YY_NO_INPUT
// Termination (mostly. in case of errors)
#define yyterminate(ret) { while(YY_CURRENT_BUFFER) yypop_buffer_state(yyscanner); str.erase(); yyextra->retcode=-(ret); return (ret); }
#define yyterminate(ret) { while(0!=YY_CURRENT_BUFFER) yypop_buffer_state(yyscanner); str.erase(); yyextra->retcode=-(ret); return (ret); }
// Abnormal termination with description of error
#define yyerrormessage(message,ret) {COUT(ERROR)<<std::endl<<" Lexical error in file "<<yyextra->state.curdir<<yyextra->state.filename<<" at line "<<yyextra->state.curline<<": "<<(message)<<std::endl; yyterminate(ret);}
// Trace position
@ -97,5 +97,5 @@ std::string str;
<PSTRING>\" BEGIN(PARSE); COUT(MOREDEBUG)<<" STRING("<<str<<")"; yylval_param->str=new std::string(str); {struct lexical_state prstate=yyextra->states.top(); yyextra->states.pop(); yylloc_param->first_line=prstate.curline; yylloc_param->last_line=yyextra->state.curline; yylloc_param->first_column=prstate.curpos; yylloc_param->last_column=yyextra->state.curpos+yyleng;}; yynextsym; return STRING;
<PSTRING,INCLUDE>. str+=yytext[0]; yynextsym;
<PSTRING,INCLUDE><<EOF>> yyextra->states.pop(); yyerrormessage("unclosed quote",-1);
<<EOF>> yypop_buffer_state(yyscanner); if(YY_CURRENT_BUFFER) {yyextra->state=yyextra->states.top(); yyextra->states.pop(); fclose(yyextra->fds.top()); yyextra->fds.pop(); yylloc_param->filename=yyextra->state.curdir+yyextra->state.filename;} else yyterminate(0);
<<EOF>> yypop_buffer_state(yyscanner); if(0!=YY_CURRENT_BUFFER) {yyextra->state=yyextra->states.top(); yyextra->states.pop(); fclose(yyextra->fds.top()); yyextra->fds.pop(); yylloc_param->filename=yyextra->state.curdir+yyextra->state.filename;} else yyterminate(0);
%%

Loading…
Cancel
Save