From c839e4bc21cfee05b19b55d841cec8f9c885867f Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Wed, 8 Jun 2011 19:19:59 -0600 Subject: [PATCH 1/3] Handle unnecessary MSVC compiler warnings. --- include/chaiscript/dispatchkit/boxed_number.hpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/include/chaiscript/dispatchkit/boxed_number.hpp b/include/chaiscript/dispatchkit/boxed_number.hpp index a5f6b50..d76c7a9 100644 --- a/include/chaiscript/dispatchkit/boxed_number.hpp +++ b/include/chaiscript/dispatchkit/boxed_number.hpp @@ -14,13 +14,21 @@ namespace chaiscript { +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable : 4244 4018 4389 4146) +#endif + /// \brief Represents any numeric type, generically. Used internally for generic operations between POD values class Boxed_Number { private: struct boolean { + +#ifdef BOOST_GCC #pragma GCC diagnostic ignored "-Wsign-compare" +#endif template static Boxed_Value go(Operators::Opers t_oper, const T &t, const U &u, const Boxed_Value &) { @@ -41,7 +49,6 @@ namespace chaiscript default: throw boost::bad_any_cast(); } - throw boost::bad_any_cast(); } }; @@ -137,7 +144,6 @@ namespace chaiscript default: throw boost::bad_any_cast(); } - throw boost::bad_any_cast(); } }; @@ -163,7 +169,6 @@ namespace chaiscript default: throw boost::bad_any_cast(); } - throw boost::bad_any_cast(); } }; @@ -680,7 +685,11 @@ namespace chaiscript { }; } - + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + } From ed15cc173057930b38e60812e23533f4b754cbe1 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Mon, 28 May 2012 10:48:19 -0600 Subject: [PATCH 2/3] Clean up a few warnings found in Windows. --- include/chaiscript/dispatchkit/dispatchkit.hpp | 1 + include/chaiscript/language/chaiscript_eval.hpp | 2 +- unittests/boxed_cast_test.cpp | 4 ++-- unittests/eval_catch_exception_test.cpp | 8 ++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/chaiscript/dispatchkit/dispatchkit.hpp b/include/chaiscript/dispatchkit/dispatchkit.hpp index 9269ff7..2698683 100644 --- a/include/chaiscript/dispatchkit/dispatchkit.hpp +++ b/include/chaiscript/dispatchkit/dispatchkit.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include "boxed_value.hpp" #include "type_info.hpp" diff --git a/include/chaiscript/language/chaiscript_eval.hpp b/include/chaiscript/language/chaiscript_eval.hpp index 33e1c3c..921ad85 100644 --- a/include/chaiscript/language/chaiscript_eval.hpp +++ b/include/chaiscript/language/chaiscript_eval.hpp @@ -806,7 +806,7 @@ namespace chaiscript virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss) { Boxed_Value match_value; bool breaking = false; - int currentCase = 1; + size_t currentCase = 1; bool hasMatched = false; chaiscript::eval::detail::Scope_Push_Pop spp(t_ss); diff --git a/unittests/boxed_cast_test.cpp b/unittests/boxed_cast_test.cpp index 2e6edd9..0064e0d 100644 --- a/unittests/boxed_cast_test.cpp +++ b/unittests/boxed_cast_test.cpp @@ -301,8 +301,8 @@ int main() passed &= built_in_type_test(5, true); passed &= built_in_type_test(1.1, true); passed &= built_in_type_test('a', true); - passed &= built_in_type_test('a', true); - passed &= built_in_type_test('a', true); + passed &= built_in_type_test('a', true); + passed &= built_in_type_test('a', true); passed &= built_in_type_test(false, false); passed &= built_in_type_test("Hello World", false); diff --git a/unittests/eval_catch_exception_test.cpp b/unittests/eval_catch_exception_test.cpp index c599c09..21510d7 100644 --- a/unittests/eval_catch_exception_test.cpp +++ b/unittests/eval_catch_exception_test.cpp @@ -60,7 +60,7 @@ int test_5() try { chai.eval("throw(runtime_error(\"error\"))", chaiscript::exception_specification()); - } catch (const double e) { + } catch (const double) { std::cout << "test_5 failed with double" << std::endl; return EXIT_FAILURE; } catch (int) { @@ -72,7 +72,7 @@ int test_5() } catch (const std::string &) { std::cout << "test_5 failed with string" << std::endl; return EXIT_FAILURE; - } catch (const std::exception &e) { + } catch (const std::exception &) { return EXIT_SUCCESS; } @@ -95,10 +95,10 @@ int test_unhandled() } catch (float) { std::cout << "test_unhandled failed with float" << std::endl; return EXIT_FAILURE; - } catch (const std::exception &e) { + } catch (const std::exception &) { std::cout << "test_unhandled failed with std::exception" << std::endl; return EXIT_FAILURE; - } catch (const chaiscript::Boxed_Value &bv) { + } catch (const chaiscript::Boxed_Value &) { return EXIT_SUCCESS; } From 7cbd494123abaa92c394e4062b4725419145f407 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Mon, 28 May 2012 11:35:53 -0600 Subject: [PATCH 3/3] It seems boost dropped the BOOST_GCC define? --- include/chaiscript/dispatchkit/boxed_number.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/chaiscript/dispatchkit/boxed_number.hpp b/include/chaiscript/dispatchkit/boxed_number.hpp index 628d6e3..89775d3 100644 --- a/include/chaiscript/dispatchkit/boxed_number.hpp +++ b/include/chaiscript/dispatchkit/boxed_number.hpp @@ -26,7 +26,7 @@ namespace chaiscript struct boolean { -#ifdef BOOST_GCC +#ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wsign-compare" #endif template