diff --git a/.decent_ci-Linux.yaml b/.decent_ci-Linux.yaml index 931e699..6f7125f 100644 --- a/.decent_ci-Linux.yaml +++ b/.decent_ci-Linux.yaml @@ -26,5 +26,5 @@ compilers: skip_packaging: true cmake_extra_flags: -DBUILD_SAMPLES:BOOL=ON -DBUILD_PACKAGE:BOOL=ON -DBUILD_TESTING:BOOL=ON - name: cppcheck - compiler_extra_flags: --enable=all -I include --inline-suppr -Umax --suppress="*:cmake*" --suppress="*:catch.hpp" --force + compiler_extra_flags: --enable=all -I include --inline-suppr -Umax --suppress="*:cmake*" --suppress="*:unittests/catch.hpp" --force diff --git a/contrib/codeanalysis/heterogenous_array_loop.chai b/contrib/codeanalysis/heterogenous_array_loop.chai index 5c688d1..d94d53f 100644 --- a/contrib/codeanalysis/heterogenous_array_loop.chai +++ b/contrib/codeanalysis/heterogenous_array_loop.chai @@ -1,10 +1,19 @@ -var my_array=["1", 4, 6.6l, 10ul, "1000", 100, 10.9f ]; - -for (var j = 0; j < 10000; ++j) +def go() { - for (var i = 0; i < 6; ++i) + var my_array=["1", 4, 6.6l, 10ul, "1000", 100, 10.9f ]; + + var q = 0; + + for (var j = 0; j < 10000; ++j) { - to_string(my_array[i]); + for (var i = 0; i < 6; ++i) + { + to_string(my_array[i]); + } + + q += j; } } + +go(); diff --git a/include/chaiscript/language/chaiscript_eval.hpp b/include/chaiscript/language/chaiscript_eval.hpp index 5b2b495..38c588b 100644 --- a/include/chaiscript/language/chaiscript_eval.hpp +++ b/include/chaiscript/language/chaiscript_eval.hpp @@ -90,9 +90,6 @@ namespace chaiscript Operators::Opers t_oper, const std::string &t_oper_string, const Boxed_Value &t_lhs, const Boxed_Value &t_rhs) const { try { - chaiscript::eval::detail::Function_Push_Pop fpp(t_ss); - fpp.save_params({t_lhs, t_rhs}); - if (t_oper != Operators::invalid && t_lhs.get_type_info().is_arithmetic() && t_rhs.get_type_info().is_arithmetic()) { // If it's an arithmetic operation we want to short circuit dispatch @@ -103,8 +100,9 @@ namespace chaiscript } catch (...) { throw exception::eval_error("Error with numeric operator calling: " + t_oper_string); } - } else { + chaiscript::eval::detail::Function_Push_Pop fpp(t_ss); + fpp.save_params({t_lhs, t_rhs}); chaiscript::eval::detail::Stack_Push_Pop spp(t_ss); return t_ss.call_function(t_oper_string, t_lhs, t_rhs); } @@ -1218,7 +1216,6 @@ namespace chaiscript virtual ~Prefix_AST_Node() {} virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss) const CHAISCRIPT_OVERRIDE{ - chaiscript::eval::detail::Function_Push_Pop fpp(t_ss); Boxed_Value bv(this->children[1]->eval(t_ss)); try { @@ -1227,6 +1224,7 @@ namespace chaiscript { return Boxed_Number::do_oper(m_oper, std::move(bv)); } else { + chaiscript::eval::detail::Function_Push_Pop fpp(t_ss); chaiscript::eval::detail::Stack_Push_Pop spp(t_ss); fpp.save_params({bv}); return t_ss.call_function(this->children[0]->text, std::move(bv)); diff --git a/src/test_module.cpp b/src/test_module.cpp index f27faaf..1ed7182 100644 --- a/src/test_module.cpp +++ b/src/test_module.cpp @@ -8,9 +8,18 @@ class TestBaseType { public: - TestBaseType() : val(10), const_val(15) { } - TestBaseType(int) : val(10), const_val(15) {} - TestBaseType(int *) : val(10), const_val(15) { } +#ifdef CHAISCRIPT_MSVC_12 +#pragma warning(push) +#pragma warning(disable : 4351) +#endif + // MSVC 12 warns that we are using new (correct) behavior + TestBaseType() : val(10), const_val(15), mdarray{} { } + TestBaseType(int) : val(10), const_val(15), mdarray{} { } + TestBaseType(int *) : val(10), const_val(15), mdarray{} { } +#ifdef CHAISCRIPT_MSVC_12 +#pragma warning(pop) +#endif + TestBaseType(const TestBaseType &) = default; virtual ~TestBaseType() {} virtual int func() { return 0; }