From 9b3bb493e9df44c1abd4a6dc609899f502ace8ec Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Sat, 10 Jan 2015 07:18:10 -0700 Subject: [PATCH] Clean up some MSVC warnings --- include/chaiscript/dispatchkit/boxed_number.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/chaiscript/dispatchkit/boxed_number.hpp b/include/chaiscript/dispatchkit/boxed_number.hpp index 6000468..c00911c 100644 --- a/include/chaiscript/dispatchkit/boxed_number.hpp +++ b/include/chaiscript/dispatchkit/boxed_number.hpp @@ -53,9 +53,21 @@ namespace chaiscript template static void check_divide_by_zero(T t) { + +#ifdef CHAISCRIPT_MSVC + // MSVC complains that this expression is both constant and the value t is unused + // in the cases of integral expressions. Seems a bit overzealous to me, the parameter + // is only unreferenced because they are eliminating the dead code. +#pragma warning(push) +#pragma warning(disable : 4100 4127) +#endif if(std::is_integral::value && std::is_arithmetic::value && t==0) { throw chaiscript::exception::arithmetic_error("divide by zero"); } +#ifdef CHAISCRIPT_MSVC +#pragma warning(pop) +#endif + } #else template