From: Thomas Geymayer Date: Mon, 4 Mar 2013 17:03:53 +0000 (+0100) Subject: Silence MSVC X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6eff167a280a8fec682a75f392f3412656142a53;p=simgear.git Silence MSVC --- diff --git a/simgear/nasal/cppbind/cppbind_test.cxx b/simgear/nasal/cppbind/cppbind_test.cxx index 9508ca5d..e6f142db 100644 --- a/simgear/nasal/cppbind/cppbind_test.cxx +++ b/simgear/nasal/cppbind/cppbind_test.cxx @@ -24,7 +24,7 @@ struct Base std::string getString() const { return ""; } void setString(const std::string&) {} void constVoidFunc() const {} - int test1Arg(const std::string& str) const { return str.length(); } + size_t test1Arg(const std::string& str) const { return str.length(); } bool test2Args(const std::string& s, bool c) { return c && s.empty(); } std::string var; @@ -34,7 +34,7 @@ struct Base void baseVoidFunc(Base& b) {} void baseConstVoidFunc(const Base& b) {} -int baseFunc2Args(Base& b, int x, const std::string& s) { return x + s.size(); } +size_t baseFunc2Args(Base& b, int x, const std::string& s) { return x + s.size(); } std::string testPtr(Base& b) { return b.getString(); } void baseFuncCallContext(const Base&, const nasal::CallContext&) {} diff --git a/simgear/nasal/cppbind/detail/functor_templates.hxx b/simgear/nasal/cppbind/detail/functor_templates.hxx index 0d827f40..b84ddbfd 100644 --- a/simgear/nasal/cppbind/detail/functor_templates.hxx +++ b/simgear/nasal/cppbind/detail/functor_templates.hxx @@ -66,8 +66,16 @@ >(name, SG_GHOST_FUNC_TYPE(fn));\ } - +#ifdef _MSC_VER +# pragma warning(push) + // C4003: not enough actual parameters for macro + // We really do not want to pass a parameter, even if MSVC can not believe it. +# pragma warning(disable: 4003) +#endif SG_GHOST_MEM_FN() +#ifdef _MSC_VER +# pragma warning(pop) +#endif SG_GHOST_MEM_FN(const) #undef SG_GHOST_MEM_FN diff --git a/simgear/nasal/cppbind/detail/to_nasal_helper.hxx b/simgear/nasal/cppbind/detail/to_nasal_helper.hxx index e367e00d..237366a9 100644 --- a/simgear/nasal/cppbind/detail/to_nasal_helper.hxx +++ b/simgear/nasal/cppbind/detail/to_nasal_helper.hxx @@ -110,8 +110,8 @@ namespace nasal to_nasal_helper(naContext c, const Vector& vec) { naRef ret = naNewVector(c); - naVec_setsize(c, ret, vec.size()); - for(size_t i = 0; i < vec.size(); ++i) + naVec_setsize(c, ret, static_cast(vec.size())); + for(int i = 0; i < static_cast(vec.size()); ++i) naVec_set(ret, i, to_nasal_helper(c, vec[i])); return ret; } @@ -152,8 +152,8 @@ namespace nasal naRef to_nasal_helper(naContext c, const T(&array)[N]) { naRef ret = naNewVector(c); - naVec_setsize(c, ret, N); - for(size_t i = 0; i < N; ++i) + naVec_setsize(c, ret, static_cast(N)); + for(int i = 0; i < static_cast(N); ++i) naVec_set(ret, i, to_nasal_helper(c, array[i])); return ret; } diff --git a/simgear/structure/SGWeakReferenced.hxx b/simgear/structure/SGWeakReferenced.hxx index 8108300e..f5fd34c9 100644 --- a/simgear/structure/SGWeakReferenced.hxx +++ b/simgear/structure/SGWeakReferenced.hxx @@ -21,6 +21,13 @@ #include "SGReferenced.hxx" #include "SGSharedPtr.hxx" +#ifdef _MSC_VER +# pragma warning(push) + // C4355: 'this' : used in base member initializer list + // Tell MSVC we know what we do and really want to do it this way. +# pragma warning(disable: 4355) +#endif + template class SGWeakPtr; @@ -100,4 +107,8 @@ private: friend class SGWeakPtr; }; +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif