From f5f6ddf219c9adbbb369cd4def3d559d5601ea03 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Mon, 20 Feb 2017 13:28:31 -0700 Subject: [PATCH 1/5] Disable tests on MSVC for broken literal handling --- unittests/integer_literal_test.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/unittests/integer_literal_test.cpp b/unittests/integer_literal_test.cpp index 9ac8808..114883c 100644 --- a/unittests/integer_literal_test.cpp +++ b/unittests/integer_literal_test.cpp @@ -192,12 +192,18 @@ int main() && TEST_LITERAL(255) && TEST_LITERAL(65535) && TEST_LITERAL(16777215) - && TEST_LITERAL(4294967295) +#ifndef CHAISCRIPT_MSVC + // bug in cl.exe causes this to be incorrectly parsed as an unsigned + && TEST_LITERAL(4294967295) +#endif && TEST_LITERAL_SIGNED(-255) && TEST_LITERAL_SIGNED(-65535) && TEST_LITERAL_SIGNED(-16777215) - && TEST_LITERAL_SIGNED(-4294967295) +#ifndef CHAISCRIPT_MSVC + // bug in cl.exe causes this to be incorrectly parsed as an unsigned + && TEST_LITERAL_SIGNED(-4294967295) +#endif && TEST_LITERAL(255u) && TEST_LITERAL(65535u) @@ -212,12 +218,18 @@ int main() && TEST_LITERAL(255l) && TEST_LITERAL(65535l) && TEST_LITERAL(16777215l) - && TEST_LITERAL(4294967295l) +#ifndef CHAISCRIPT_MSVC + // bug in cl.exe causes this to be incorrectly parsed as an unsigned + && TEST_LITERAL(4294967295l) +#endif && TEST_LITERAL_SIGNED(-255l) && TEST_LITERAL_SIGNED(-65535l) && TEST_LITERAL_SIGNED(-16777215l) - && TEST_LITERAL_SIGNED(-4294967295l) +#ifndef CHAISCRIPT_MSVC + // bug in cl.exe causes this to be incorrectly parsed as an unsigned + && TEST_LITERAL_SIGNED(-4294967295l) +#endif && TEST_LITERAL(255ul) && TEST_LITERAL(65535ul) From 40fb8d257e7ebb49cc0aa0ad4f3898dbcd10bcbe Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Wed, 22 Feb 2017 13:55:02 -0700 Subject: [PATCH 2/5] Fix warnings from MSVC --- include/chaiscript/dispatchkit/boxed_number.hpp | 7 +++++++ include/chaiscript/language/chaiscript_engine.hpp | 3 --- unittests/integer_literal_test.cpp | 15 +++++++++++---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/chaiscript/dispatchkit/boxed_number.hpp b/include/chaiscript/dispatchkit/boxed_number.hpp index 68b2f0b..2d44b7e 100644 --- a/include/chaiscript/dispatchkit/boxed_number.hpp +++ b/include/chaiscript/dispatchkit/boxed_number.hpp @@ -588,12 +588,19 @@ namespace chaiscript template static void check_type() { +#ifdef CHAISCRIPT_MSVC +#pragma warning(push) +#pragma warning(disable : 4127) +#endif if (sizeof(Source) != sizeof(Target) || std::is_signed() != std::is_signed() || std::is_floating_point() != std::is_floating_point()) { throw chaiscript::detail::exception::bad_any_cast(); } +#ifdef CHAISCRIPT_MSVC +#pragma warning(pop) +#endif } template Target get_as_checked() const diff --git a/include/chaiscript/language/chaiscript_engine.hpp b/include/chaiscript/language/chaiscript_engine.hpp index f4550e8..828fc40 100644 --- a/include/chaiscript/language/chaiscript_engine.hpp +++ b/include/chaiscript/language/chaiscript_engine.hpp @@ -145,9 +145,6 @@ namespace chaiscript }) , "call_exists"); -// m_engine.add(fun &)>(std::bind(&chaiscript::dispatch::Proxy_Function_Base::operator(), std::placeholders::_1, std::placeholders::_2, std::ref(m_engine.conversions()))), "call"); -// -// m_engine.add(fun( [=](const dispatch::Proxy_Function_Base &t_fun, const std::vector &t_params) -> Boxed_Value { diff --git a/unittests/integer_literal_test.cpp b/unittests/integer_literal_test.cpp index 114883c..9112374 100644 --- a/unittests/integer_literal_test.cpp +++ b/unittests/integer_literal_test.cpp @@ -3,6 +3,12 @@ #include "../static_libs/chaiscript_stdlib.hpp" +#ifdef CHAISCRIPT_MSVC +#pragma warning(push) +#pragma warning(disable : 4146) +#endif + + #define TEST_LITERAL(v) test_literal(v, #v) #define TEST_LITERAL_SIGNED(v) test_literal(v, #v, true) @@ -269,8 +275,9 @@ int main() return EXIT_FAILURE; } - - - - } + + +#ifdef CHAISCRIPT_MSVC +#pragma warning(pop) +#endif From c0c0bd3172c7f70a01653c955a5d9bc76b9befee Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Wed, 22 Feb 2017 14:04:56 -0700 Subject: [PATCH 3/5] Address warning from MSVC /analyze --- unittests/integer_literal_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/unittests/integer_literal_test.cpp b/unittests/integer_literal_test.cpp index 9112374..3187b65 100644 --- a/unittests/integer_literal_test.cpp +++ b/unittests/integer_literal_test.cpp @@ -4,6 +4,7 @@ #ifdef CHAISCRIPT_MSVC +// ignore errors about negative unsigned integer literals #pragma warning(push) #pragma warning(disable : 4146) #endif From 283785faaff2c7287e95fc5b1459b8aada3154cb Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Wed, 22 Feb 2017 15:18:56 -0700 Subject: [PATCH 4/5] Add PVS Studio and address some issues it found --- include/chaiscript/chaiscript.hpp | 4 ++++ include/chaiscript/chaiscript_threading.hpp | 4 ++++ .../chaiscript/dispatchkit/bad_boxed_cast.hpp | 4 ++++ include/chaiscript/dispatchkit/bind_first.hpp | 4 ++++ include/chaiscript/dispatchkit/bootstrap.hpp | 4 ++++ .../chaiscript/dispatchkit/bootstrap_stl.hpp | 4 ++++ include/chaiscript/dispatchkit/boxed_cast.hpp | 4 ++++ .../dispatchkit/boxed_cast_helper.hpp | 4 ++++ .../chaiscript/dispatchkit/boxed_number.hpp | 6 +++++- include/chaiscript/dispatchkit/boxed_value.hpp | 4 ++++ include/chaiscript/dispatchkit/dispatchkit.hpp | 4 ++++ .../chaiscript/dispatchkit/dynamic_object.hpp | 4 ++++ .../dispatchkit/exception_specification.hpp | 4 ++++ .../chaiscript/dispatchkit/function_call.hpp | 4 ++++ .../dispatchkit/function_call_detail.hpp | 4 ++++ .../chaiscript/dispatchkit/handle_return.hpp | 4 ++++ include/chaiscript/dispatchkit/operators.hpp | 4 ++++ .../dispatchkit/proxy_constructors.hpp | 3 +++ .../chaiscript/dispatchkit/proxy_functions.hpp | 3 +++ .../dispatchkit/proxy_functions_detail.hpp | 4 ++++ .../dispatchkit/register_function.hpp | 4 ++++ .../dispatchkit/type_conversions.hpp | 18 +++++++++--------- include/chaiscript/dispatchkit/type_info.hpp | 4 ++++ .../language/chaiscript_algebraic.hpp | 4 ++++ .../chaiscript/language/chaiscript_common.hpp | 4 ++++ .../chaiscript/language/chaiscript_engine.hpp | 4 ++++ .../chaiscript/language/chaiscript_eval.hpp | 4 ++++ .../chaiscript/language/chaiscript_parser.hpp | 4 ++++ include/chaiscript/utility/utility.hpp | 4 ++++ samples/fun_call_performance.cpp | 4 ++++ src/main.cpp | 4 ++++ src/stl_extra.cpp | 4 ++++ unittests/compiled_tests.cpp | 2 +- 33 files changed, 133 insertions(+), 11 deletions(-) diff --git a/include/chaiscript/chaiscript.hpp b/include/chaiscript/chaiscript.hpp index b3fefc9..632aa30 100644 --- a/include/chaiscript/chaiscript.hpp +++ b/include/chaiscript/chaiscript.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_HPP_ #define CHAISCRIPT_HPP_ diff --git a/include/chaiscript/chaiscript_threading.hpp b/include/chaiscript/chaiscript_threading.hpp index e8f097f..5c3e0b4 100644 --- a/include/chaiscript/chaiscript_threading.hpp +++ b/include/chaiscript/chaiscript_threading.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_THREADING_HPP_ #define CHAISCRIPT_THREADING_HPP_ diff --git a/include/chaiscript/dispatchkit/bad_boxed_cast.hpp b/include/chaiscript/dispatchkit/bad_boxed_cast.hpp index 8547b97..3529578 100644 --- a/include/chaiscript/dispatchkit/bad_boxed_cast.hpp +++ b/include/chaiscript/dispatchkit/bad_boxed_cast.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_BAD_BOXED_CAST_HPP_ #define CHAISCRIPT_BAD_BOXED_CAST_HPP_ diff --git a/include/chaiscript/dispatchkit/bind_first.hpp b/include/chaiscript/dispatchkit/bind_first.hpp index 98da1de..edd365c 100644 --- a/include/chaiscript/dispatchkit/bind_first.hpp +++ b/include/chaiscript/dispatchkit/bind_first.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_BIND_FIRST_HPP_ #define CHAISCRIPT_BIND_FIRST_HPP_ diff --git a/include/chaiscript/dispatchkit/bootstrap.hpp b/include/chaiscript/dispatchkit/bootstrap.hpp index 4514363..3cef9f0 100644 --- a/include/chaiscript/dispatchkit/bootstrap.hpp +++ b/include/chaiscript/dispatchkit/bootstrap.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_BOOTSTRAP_HPP_ #define CHAISCRIPT_BOOTSTRAP_HPP_ diff --git a/include/chaiscript/dispatchkit/bootstrap_stl.hpp b/include/chaiscript/dispatchkit/bootstrap_stl.hpp index e2ec267..b0297a8 100644 --- a/include/chaiscript/dispatchkit/bootstrap_stl.hpp +++ b/include/chaiscript/dispatchkit/bootstrap_stl.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + /// \file /// This file contains utility functions for registration of STL container /// classes. The methodology used is based on the SGI STL concepts. diff --git a/include/chaiscript/dispatchkit/boxed_cast.hpp b/include/chaiscript/dispatchkit/boxed_cast.hpp index 7fbe78d..d7c52fc 100644 --- a/include/chaiscript/dispatchkit/boxed_cast.hpp +++ b/include/chaiscript/dispatchkit/boxed_cast.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_BOXED_CAST_HPP_ #define CHAISCRIPT_BOXED_CAST_HPP_ diff --git a/include/chaiscript/dispatchkit/boxed_cast_helper.hpp b/include/chaiscript/dispatchkit/boxed_cast_helper.hpp index c8dce2e..01e8936 100644 --- a/include/chaiscript/dispatchkit/boxed_cast_helper.hpp +++ b/include/chaiscript/dispatchkit/boxed_cast_helper.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_BOXED_CAST_HELPER_HPP_ #define CHAISCRIPT_BOXED_CAST_HELPER_HPP_ diff --git a/include/chaiscript/dispatchkit/boxed_number.hpp b/include/chaiscript/dispatchkit/boxed_number.hpp index 2d44b7e..2ab6509 100644 --- a/include/chaiscript/dispatchkit/boxed_number.hpp +++ b/include/chaiscript/dispatchkit/boxed_number.hpp @@ -4,6 +4,9 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #ifndef CHAISCRIPT_BOXED_NUMERIC_HPP_ #define CHAISCRIPT_BOXED_NUMERIC_HPP_ @@ -589,8 +592,9 @@ namespace chaiscript static void check_type() { #ifdef CHAISCRIPT_MSVC +// MSVC complains about this being redundant / tautologica l #pragma warning(push) -#pragma warning(disable : 4127) +#pragma warning(disable : 4127 6287) #endif if (sizeof(Source) != sizeof(Target) || std::is_signed() != std::is_signed() diff --git a/include/chaiscript/dispatchkit/boxed_value.hpp b/include/chaiscript/dispatchkit/boxed_value.hpp index 938aab0..138311e 100644 --- a/include/chaiscript/dispatchkit/boxed_value.hpp +++ b/include/chaiscript/dispatchkit/boxed_value.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_BOXED_VALUE_HPP_ #define CHAISCRIPT_BOXED_VALUE_HPP_ diff --git a/include/chaiscript/dispatchkit/dispatchkit.hpp b/include/chaiscript/dispatchkit/dispatchkit.hpp index a83747e..85227f7 100644 --- a/include/chaiscript/dispatchkit/dispatchkit.hpp +++ b/include/chaiscript/dispatchkit/dispatchkit.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_DISPATCHKIT_HPP_ #define CHAISCRIPT_DISPATCHKIT_HPP_ diff --git a/include/chaiscript/dispatchkit/dynamic_object.hpp b/include/chaiscript/dispatchkit/dynamic_object.hpp index ee97232..7aa6352 100644 --- a/include/chaiscript/dispatchkit/dynamic_object.hpp +++ b/include/chaiscript/dispatchkit/dynamic_object.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_DYNAMIC_OBJECT_HPP_ #define CHAISCRIPT_DYNAMIC_OBJECT_HPP_ diff --git a/include/chaiscript/dispatchkit/exception_specification.hpp b/include/chaiscript/dispatchkit/exception_specification.hpp index 0c9b40f..17bca6b 100644 --- a/include/chaiscript/dispatchkit/exception_specification.hpp +++ b/include/chaiscript/dispatchkit/exception_specification.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_EXCEPTION_SPECIFICATION_HPP_ #define CHAISCRIPT_EXCEPTION_SPECIFICATION_HPP_ diff --git a/include/chaiscript/dispatchkit/function_call.hpp b/include/chaiscript/dispatchkit/function_call.hpp index 3efb703..b9b0384 100644 --- a/include/chaiscript/dispatchkit/function_call.hpp +++ b/include/chaiscript/dispatchkit/function_call.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_FUNCTION_CALL_HPP_ #define CHAISCRIPT_FUNCTION_CALL_HPP_ diff --git a/include/chaiscript/dispatchkit/function_call_detail.hpp b/include/chaiscript/dispatchkit/function_call_detail.hpp index 93e3e61..c9cdaad 100644 --- a/include/chaiscript/dispatchkit/function_call_detail.hpp +++ b/include/chaiscript/dispatchkit/function_call_detail.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_FUNCTION_CALL_DETAIL_HPP_ #define CHAISCRIPT_FUNCTION_CALL_DETAIL_HPP_ diff --git a/include/chaiscript/dispatchkit/handle_return.hpp b/include/chaiscript/dispatchkit/handle_return.hpp index 4d0930e..1c70bcb 100644 --- a/include/chaiscript/dispatchkit/handle_return.hpp +++ b/include/chaiscript/dispatchkit/handle_return.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_HANDLE_RETURN_HPP_ #define CHAISCRIPT_HANDLE_RETURN_HPP_ diff --git a/include/chaiscript/dispatchkit/operators.hpp b/include/chaiscript/dispatchkit/operators.hpp index 4ebaec5..0563fbf 100644 --- a/include/chaiscript/dispatchkit/operators.hpp +++ b/include/chaiscript/dispatchkit/operators.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_OPERATORS_HPP_ #define CHAISCRIPT_OPERATORS_HPP_ diff --git a/include/chaiscript/dispatchkit/proxy_constructors.hpp b/include/chaiscript/dispatchkit/proxy_constructors.hpp index a5ad41e..1d73307 100644 --- a/include/chaiscript/dispatchkit/proxy_constructors.hpp +++ b/include/chaiscript/dispatchkit/proxy_constructors.hpp @@ -4,6 +4,9 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #ifndef CHAISCRIPT_PROXY_CONSTRUCTORS_HPP_ #define CHAISCRIPT_PROXY_CONSTRUCTORS_HPP_ diff --git a/include/chaiscript/dispatchkit/proxy_functions.hpp b/include/chaiscript/dispatchkit/proxy_functions.hpp index 67b94c0..cc861a2 100644 --- a/include/chaiscript/dispatchkit/proxy_functions.hpp +++ b/include/chaiscript/dispatchkit/proxy_functions.hpp @@ -4,6 +4,9 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #ifndef CHAISCRIPT_PROXY_FUNCTIONS_HPP_ #define CHAISCRIPT_PROXY_FUNCTIONS_HPP_ diff --git a/include/chaiscript/dispatchkit/proxy_functions_detail.hpp b/include/chaiscript/dispatchkit/proxy_functions_detail.hpp index f00eeef..48c039d 100644 --- a/include/chaiscript/dispatchkit/proxy_functions_detail.hpp +++ b/include/chaiscript/dispatchkit/proxy_functions_detail.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_PROXY_FUNCTIONS_DETAIL_HPP_ #define CHAISCRIPT_PROXY_FUNCTIONS_DETAIL_HPP_ diff --git a/include/chaiscript/dispatchkit/register_function.hpp b/include/chaiscript/dispatchkit/register_function.hpp index 1c58840..4193ad8 100644 --- a/include/chaiscript/dispatchkit/register_function.hpp +++ b/include/chaiscript/dispatchkit/register_function.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_REGISTER_FUNCTION_HPP_ #define CHAISCRIPT_REGISTER_FUNCTION_HPP_ diff --git a/include/chaiscript/dispatchkit/type_conversions.hpp b/include/chaiscript/dispatchkit/type_conversions.hpp index 3a546c6..df229bd 100644 --- a/include/chaiscript/dispatchkit/type_conversions.hpp +++ b/include/chaiscript/dispatchkit/type_conversions.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_DYNAMIC_CAST_CONVERSION_HPP_ #define CHAISCRIPT_DYNAMIC_CAST_CONVERSION_HPP_ @@ -340,15 +344,11 @@ namespace chaiscript { } - Type_Conversions(const Type_Conversions &t_other) - : m_mutex(), - m_conversions(t_other.get_conversions()), - m_convertableTypes(t_other.m_convertableTypes), - m_num_types(m_conversions.size()), - m_thread_cache(this), - m_conversion_saves(this) - { - } + Type_Conversions(const Type_Conversions &t_other) = delete; + Type_Conversions(Type_Conversions &&) = default; + + Type_Conversions &operator=(const Type_Conversions &) = delete; + Type_Conversions &operator=(Type_Conversions &&) = default; const std::set &thread_cache() const { diff --git a/include/chaiscript/dispatchkit/type_info.hpp b/include/chaiscript/dispatchkit/type_info.hpp index 592271a..47f10c5 100644 --- a/include/chaiscript/dispatchkit/type_info.hpp +++ b/include/chaiscript/dispatchkit/type_info.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_TYPE_INFO_HPP_ #define CHAISCRIPT_TYPE_INFO_HPP_ diff --git a/include/chaiscript/language/chaiscript_algebraic.hpp b/include/chaiscript/language/chaiscript_algebraic.hpp index 022a295..ad55a38 100644 --- a/include/chaiscript/language/chaiscript_algebraic.hpp +++ b/include/chaiscript/language/chaiscript_algebraic.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_ALGEBRAIC_HPP_ #define CHAISCRIPT_ALGEBRAIC_HPP_ diff --git a/include/chaiscript/language/chaiscript_common.hpp b/include/chaiscript/language/chaiscript_common.hpp index abcfe5b..8983f19 100644 --- a/include/chaiscript/language/chaiscript_common.hpp +++ b/include/chaiscript/language/chaiscript_common.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_COMMON_HPP_ #define CHAISCRIPT_COMMON_HPP_ diff --git a/include/chaiscript/language/chaiscript_engine.hpp b/include/chaiscript/language/chaiscript_engine.hpp index 828fc40..33cb00f 100644 --- a/include/chaiscript/language/chaiscript_engine.hpp +++ b/include/chaiscript/language/chaiscript_engine.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_ENGINE_HPP_ #define CHAISCRIPT_ENGINE_HPP_ diff --git a/include/chaiscript/language/chaiscript_eval.hpp b/include/chaiscript/language/chaiscript_eval.hpp index c6143f1..0373dcc 100644 --- a/include/chaiscript/language/chaiscript_eval.hpp +++ b/include/chaiscript/language/chaiscript_eval.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_EVAL_HPP_ #define CHAISCRIPT_EVAL_HPP_ diff --git a/include/chaiscript/language/chaiscript_parser.hpp b/include/chaiscript/language/chaiscript_parser.hpp index 913b995..5536b00 100644 --- a/include/chaiscript/language/chaiscript_parser.hpp +++ b/include/chaiscript/language/chaiscript_parser.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_PARSER_HPP_ #define CHAISCRIPT_PARSER_HPP_ diff --git a/include/chaiscript/utility/utility.hpp b/include/chaiscript/utility/utility.hpp index 11262ff..1cfb3eb 100644 --- a/include/chaiscript/utility/utility.hpp +++ b/include/chaiscript/utility/utility.hpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #ifndef CHAISCRIPT_UTILITY_UTILITY_HPP_ #define CHAISCRIPT_UTILITY_UTILITY_HPP_ diff --git a/samples/fun_call_performance.cpp b/samples/fun_call_performance.cpp index 90fd7d9..d18c636 100644 --- a/samples/fun_call_performance.cpp +++ b/samples/fun_call_performance.cpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #include #include #include diff --git a/src/main.cpp b/src/main.cpp index ae2d490..a32e647 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #include #include #include diff --git a/src/stl_extra.cpp b/src/stl_extra.cpp index 07bc060..807dbac 100644 --- a/src/stl_extra.cpp +++ b/src/stl_extra.cpp @@ -4,6 +4,10 @@ // Copyright 2009-2016, Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com +// This is an open source non-commercial project. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + + #include #include #include diff --git a/unittests/compiled_tests.cpp b/unittests/compiled_tests.cpp index 1a94c73..c1716ec 100644 --- a/unittests/compiled_tests.cpp +++ b/unittests/compiled_tests.cpp @@ -198,7 +198,7 @@ TEST_CASE("Throw int or double") chai.eval("throw(1.0)", chaiscript::exception_specification()); REQUIRE(false); } catch (const double e) { - CHECK(e == 1.0); + CHECK(e == Approx(1.0)); } } From e342243193da0fa34c212b783dd13f9e1ee8973f Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Wed, 22 Feb 2017 15:33:42 -0700 Subject: [PATCH 5/5] Update release notes for 6.0.0 --- releasenotes.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/releasenotes.md b/releasenotes.md index 5f4f3eb..9951e75 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -26,7 +26,7 @@ Current Version: 6.0.0 * Modular optimization system; this can be accessed via the ChaiScript_Basic interface * Execution tracing capability; also accessed via ChaiScript_Basic interface -* range-based for loops `for( id : container ) { }` +* range-based for loops `for( id : container ) { }` (much better performance than other loop types) * If-init expressions (ala C++17) * Support for passing r-value references to functions * Support for containing unique_ptr @@ -39,6 +39,7 @@ Current Version: 6.0.0 * Compile size improvements * Significant runtime improvements (see "Modular optimization system") * Significant parser improvements, both with parse-time and parser initialization time (Thanks @niXman) +* Fix type conversion to bool in conditionals #### Improvements Still Need To Be Made