From a23c393e9e49024562468357709b6d3649ce7af8 Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Sat, 12 Sep 2015 20:07:34 +1000 Subject: [PATCH] Fix clang and cppcheck warnings --- src/deptree.cpp | 4 ++-- src/object.cpp | 2 +- src/object.h | 2 +- src/parser/lexical.l | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/deptree.cpp b/src/deptree.cpp index b9dc9c1..07568d6 100644 --- a/src/deptree.cpp +++ b/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; } } diff --git a/src/object.cpp b/src/object.cpp index 754dc75..e7193d2 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -6,7 +6,7 @@ template<> EXPORT std::string ObjectSimple::type="integer"; template<> EXPORT std::string ObjectSimple::type="real"; template<> EXPORT std::string ObjectSimple::type="string"; -inline ObjectBase* OFunc::Evaluate(bool* err) +ObjectBase* OFunc::Evaluate(bool* err) { *err=false; if(G_funcs.find(name)==G_funcs.end()) diff --git a/src/object.h b/src/object.h index 1cc6082..687efce 100644 --- a/src/object.h +++ b/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";} diff --git a/src/parser/lexical.l b/src/parser/lexical.l index 67b1fdf..2fa9534 100644 --- a/src/parser/lexical.l +++ b/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)<state.curdir<state.filename<<" at line "<state.curline<<": "<<(message)<\" BEGIN(PARSE); COUT(MOREDEBUG)<<" STRING("<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; . str+=yytext[0]; yynextsym; <> yyextra->states.pop(); yyerrormessage("unclosed quote",-1); -<> 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); +<> 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); %%