Silence MSVC

This commit is contained in:
Thomas Geymayer
2013-03-04 18:03:53 +01:00
parent 9fecb69b84
commit 6eff167a28
4 changed files with 26 additions and 7 deletions

View File

@@ -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&) {}

View File

@@ -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

View File

@@ -110,8 +110,8 @@ namespace nasal
to_nasal_helper(naContext c, const Vector<T, Alloc>& 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<int>(vec.size()));
for(int i = 0; i < static_cast<int>(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<int>(N));
for(int i = 0; i < static_cast<int>(N); ++i)
naVec_set(ret, i, to_nasal_helper(c, array[i]));
return ret;
}

View File

@@ -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<typename T>
class SGWeakPtr;
@@ -100,4 +107,8 @@ private:
friend class SGWeakPtr;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif