From ebbcc5cbdbb1283c78a36f5b1021171b752e5cbe Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Tue, 4 Mar 2014 11:20:45 -0700 Subject: [PATCH 1/6] Catch missing virtual destructors, enable g++ warnings --- CMakeLists.txt | 2 +- include/chaiscript/dispatchkit/any.hpp | 7 +++++-- include/chaiscript/dispatchkit/proxy_functions.hpp | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c122aac..2875f31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,7 +89,7 @@ if(MSVC) add_definitions(/W4) add_definitions(/bigobj) else() - add_definitions(-Wall -Wextra -Wshadow -pedantic ${CPP11_FLAG}) + add_definitions(-Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic ${CPP11_FLAG}) if (APPLE) add_definitions(-Wno-sign-compare) diff --git a/include/chaiscript/dispatchkit/any.hpp b/include/chaiscript/dispatchkit/any.hpp index 217ce7f..75a01c0 100644 --- a/include/chaiscript/dispatchkit/any.hpp +++ b/include/chaiscript/dispatchkit/any.hpp @@ -42,6 +42,7 @@ namespace chaiscript { private: struct Data { + virtual ~Data() {} virtual void *data() = 0; virtual const std::type_info &type() const = 0; virtual std::shared_ptr clone() const = 0; @@ -56,6 +57,8 @@ namespace chaiscript { { } + virtual ~Data_Impl() {} + virtual void *data() { return &m_data; @@ -94,9 +97,9 @@ namespace chaiscript { } template - Any(const ValueType &t_value) + Any(const ValueType &t_value) + : m_data(std::shared_ptr(new Data_Impl(t_value))) { - m_data = std::shared_ptr(new Data_Impl(t_value)); } Any & operator=(const Any &t_any) diff --git a/include/chaiscript/dispatchkit/proxy_functions.hpp b/include/chaiscript/dispatchkit/proxy_functions.hpp index 6abc3aa..d5de855 100644 --- a/include/chaiscript/dispatchkit/proxy_functions.hpp +++ b/include/chaiscript/dispatchkit/proxy_functions.hpp @@ -39,6 +39,7 @@ namespace chaiscript { public: virtual ~Proxy_Function_Base() {} + Boxed_Value operator()(const std::vector ¶ms, const chaiscript::Dynamic_Cast_Conversions &t_conversions) const { Boxed_Value bv = do_call(params, t_conversions); @@ -205,6 +206,8 @@ namespace chaiscript { } + virtual ~Dynamic_Proxy_Function() {} + virtual bool operator==(const Proxy_Function_Base &rhs) const { const Dynamic_Proxy_Function *prhs = dynamic_cast(&rhs); @@ -221,9 +224,6 @@ namespace chaiscript && test_guard(vals, t_conversions); } - virtual ~Dynamic_Proxy_Function() {} - - virtual int get_arity() const { return m_arity; From 8b134c65d1d280e42a28f1059c3e7b11f192ac84 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Mon, 10 Mar 2014 14:16:56 -0600 Subject: [PATCH 2/6] Add travis script for automated testing --- .travis.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..35235e1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +language: cpp +compiler: + - gcc + - clang +script: + - mkdir build + - cd build + - cmake ../build + - make test +notifications: + recipients: + - jason@emptycrate.com + email: + on_success: always + on_failure: always + From d22fb19e0e874c1965f851eecf118e939ce503e8 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Mon, 10 Mar 2014 14:31:02 -0600 Subject: [PATCH 3/6] Add travis-ci support for master branch --- .travis.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..abb47e1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: cpp +compiler: + - gcc + - clang +before_install: + - sudo apt-get install libboost-dev +script: + - mkdir build + - cd build + - cmake ../ + - make + - make test +notifications: + recipients: + - jason@emptycrate.com + email: + on_success: always + on_failure: always + From 016275715819457351a3250703b869ecb23ec2ac Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Mon, 10 Mar 2014 14:48:59 -0600 Subject: [PATCH 4/6] Add missing boost dependency for travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index abb47e1..0fcfba3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ compiler: - gcc - clang before_install: - - sudo apt-get install libboost-dev + - sudo apt-get install libboost-dev libboost-all-dev script: - mkdir build - cd build From 27307b17d118cb568678beb0944ec1220679ae26 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Mon, 10 Mar 2014 15:04:47 -0600 Subject: [PATCH 5/6] Update readme.md --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 34069ff..f9a9dea 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/ChaiScript/ChaiScript.png?branch=master)](https://travis-ci.org/ChaiScript/ChaiScript) + ChaiScript http://www.chaiscript.com From 385465cf3f606cfd0e6d213845f4883deb285f96 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Mon, 10 Mar 2014 15:05:54 -0600 Subject: [PATCH 6/6] Update readme.md --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index a82f916..2bd07ce 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/ChaiScript/ChaiScript.png?branch=ChaiScript_5_0_CPP_11)](https://travis-ci.org/ChaiScript/ChaiScript) + ChaiScript http://www.chaiscript.com