Address some of the issues found by cppcheck

This commit is contained in:
Jason Turner
2014-03-26 16:59:41 -06:00
parent 296769ee24
commit 65b0846e41
8 changed files with 19 additions and 25 deletions

View File

@@ -54,7 +54,7 @@ namespace chaiscript
};
/// \brief Typedef for pointers to AST_Node objects. Used in building of the AST_Node tree
typedef boost::shared_ptr<struct AST_Node> AST_NodePtr;
typedef boost::shared_ptr<AST_Node> AST_NodePtr;
/// \brief Classes which may be thrown during error cases when ChaiScript is executing.
@@ -435,7 +435,7 @@ namespace chaiscript
return eval_internal(t_e);
} catch (exception::eval_error &ee) {
ee.call_stack.push_back(shared_from_this());
throw ee;
throw;
}
}

View File

@@ -681,7 +681,7 @@ namespace chaiscript
if (t_handler) {
t_handler->handle(bv, m_engine);
}
throw bv;
throw;
}
}
@@ -707,7 +707,7 @@ namespace chaiscript
if (t_handler) {
t_handler->handle(bv, m_engine);
}
throw bv;
throw;
}
}
@@ -737,7 +737,7 @@ namespace chaiscript
if (t_handler) {
t_handler->handle(bv, m_engine);
}
throw bv;
throw;
}
}
@@ -753,7 +753,7 @@ namespace chaiscript
if (t_handler) {
t_handler->handle(bv, m_engine);
}
throw bv;
throw;
}
}
@@ -773,7 +773,7 @@ namespace chaiscript
if (t_handler) {
t_handler->handle(bv, m_engine);
}
throw bv;
throw;
}
}
};

View File

@@ -56,7 +56,8 @@ namespace chaiscript
public:
ChaiScript_Parser()
: m_multiline_comment_begin("/*"),
: m_line(-1), m_col(-1),
m_multiline_comment_begin("/*"),
m_multiline_comment_end("*/"),
m_singleline_comment("//")
{
@@ -804,10 +805,9 @@ namespace chaiscript
*/
bool Quoted_String_() {
bool retval = false;
char prev_char = 0;
if (has_more_input() && (*m_input_pos == '\"')) {
retval = true;
prev_char = *m_input_pos;
char prev_char = *m_input_pos;
++m_input_pos;
++m_col;
@@ -981,10 +981,9 @@ namespace chaiscript
*/
bool Single_Quoted_String_() {
bool retval = false;
char prev_char = 0;
if (has_more_input() && (*m_input_pos == '\'')) {
retval = true;
prev_char = *m_input_pos;
char prev_char = *m_input_pos;
++m_input_pos;
++m_col;
@@ -1350,7 +1349,6 @@ namespace chaiscript
bool Def() {
bool retval = false;
bool is_annotated = false;
bool is_method = false;
AST_NodePtr annotation;
if (Annotation()) {
@@ -1369,6 +1367,8 @@ namespace chaiscript
throw exception::eval_error("Missing function name in definition", File_Position(m_line, m_col), *m_filename);
}
bool is_method = false;
if (Symbol("::", false)) {
//We're now a method
is_method = true;