Fix warnings and errors on VisualStudio 2013

Interestingly, VS2013 with Boost 1.55 exhibited the issues complained
about in issue #92, so I was able to provide an appropriate fix. It would
appear to be bugs in both compilers, which seems very odd.
This commit is contained in:
Jason Turner
2014-02-22 16:09:34 -07:00
parent 04131d208b
commit af44da916a
5 changed files with 43 additions and 4 deletions

View File

@@ -279,7 +279,11 @@ namespace chaiscript
boost::shared_ptr<const dispatch::Dynamic_Proxy_Function> pf = boost::dynamic_pointer_cast<const dispatch::Dynamic_Proxy_Function>(t_pf);
if (pf)
{
return pf->get_guard();
if (pf->get_guard()) {
return true;
} else {
return false;
}
} else {
return false;
}

View File

@@ -86,13 +86,20 @@ namespace chaiscript
* if any unboxing fails the execution of the function fails and
* the bad_boxed_cast is passed up to the caller.
*/
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4100)
#endif
#ifdef __llvm__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
template<typename Ret BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename Param)>
Ret call_func(const boost::function<Ret (BOOST_PP_ENUM_PARAMS(n, Param))> &f,
const std::vector<Boxed_Value> &params, const Dynamic_Cast_Conversions & BOOST_PP_IF(n, t_conversions, BOOST_PP_EMPTY))
#ifdef __llvm__
#pragma clang diagnostic pop
#endif
@@ -105,19 +112,31 @@ namespace chaiscript
}
}
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
/**
* Used by Proxy_Function_Impl to determine if it is equivalent to another
* Proxy_Function_Impl object. This function is primarly used to prevent
* registration of two functions with the exact same signatures
*/
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4100)
#endif
#ifdef __llvm__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
template<typename Ret BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename Param)>
bool compare_types_cast(Ret (*)(BOOST_PP_ENUM_PARAMS(n, Param)),
const std::vector<Boxed_Value> & BOOST_PP_IF(n, params, BOOST_PP_EMPTY), const Dynamic_Cast_Conversions &t_conversions)
#ifdef __llvm__
#pragma clang diagnostic pop
#endif
@@ -131,6 +150,11 @@ namespace chaiscript
return true;
}
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
}
}
}

View File

@@ -46,7 +46,7 @@ void *cast_module_symbol(std::string (*t_path)())
std::string default_search_path()
{
#ifdef CHAISCRIPT_WINDOWS // force no unicode
#ifdef BOOST_WINDOWS // force no unicode
CHAR path[4096];
int size = GetModuleFileNameA(0, path, sizeof(path)-1);
@@ -60,8 +60,8 @@ std::string default_search_path()
return "";
}
#else
std::string exepath;
std::vector<char> buf(2048);

View File

@@ -24,7 +24,12 @@ bool has_parse_tree(const chaiscript::Const_Proxy_Function &t_pf)
= boost::dynamic_pointer_cast<const chaiscript::dispatch::Dynamic_Proxy_Function>(t_pf);
if (pf)
{
return pf->get_parse_tree();
if (pf->get_parse_tree())
{
return true;
} else {
return false;
}
} else {
return false;
}

View File

@@ -15,6 +15,9 @@ class TestBaseType
int val;
const int const_val;
private:
TestBaseType &operator=(const TestBaseType &);
};
enum TestEnum
@@ -32,6 +35,9 @@ class TestDerivedType : public TestBaseType
public:
virtual ~TestDerivedType() {}
virtual int func() { return 1; }
private:
TestDerivedType &operator=(const TestDerivedType &);
};
std::string hello_world()