Eliminate warnings

git-svn-id: http://svn.boost.org/svn/boost/sandbox/endian@72124 b8fc166d-592f-0410-95f2-cb63ce0dd405
This commit is contained in:
bemandawes
2011-05-23 16:32:15 +00:00
parent 20b8bd58f8
commit 977da76150
3 changed files with 54 additions and 62 deletions

View File

@@ -196,69 +196,26 @@ namespace endian
*--t = *++s;
}
template <class T> inline void to_big(T& x)
{
# ifdef BOOST_LITTLE_ENDIAN
flip(x);
# endif
}
#ifdef BOOST_LITTLE_ENDIAN
template <class T> inline void to_big(T& x) { flip(x); }
template <class T> inline void to_little(T&) {}
template <class T> inline void from_big(T& x) { flip(x); }
template <class T> inline void from_little(T&) {}
template <class T> inline void to_big(T native, T& big) { flip(native, big); }
template <class T> inline void to_little(T native, T& little) { little = native; }
template <class T> inline void from_big(T big, T& native) { flip(big, native); }
template <class T> inline void from_little(T little, T& native) { native = little; }
#else
template <class T> inline void to_big(T&) {}
template <class T> inline void to_little(T& x) { flip(x); }
template <class T> inline void from_big(T&) {}
template <class T> inline void from_little(T& x) { flip(x); }
template <class T> inline void to_big(T native, T& big) { big = native; }
template <class T> inline void to_little(T native, T& little) { flip(native, little); }
template <class T> inline void from_big(T big, T& native) { native = big; }
template <class T> inline void from_little(T little, T& native) { flip(little, native); }
#endif
template <class T> inline void to_little(T& x)
{
# ifdef BOOST_BIG_ENDIAN
flip(x);
# endif
}
template <class T> inline void from_big(T& x)
{
# ifdef BOOST_LITTLE_ENDIAN
flip(x);
# endif
}
template <class T> inline void from_little(T& x)
{
# ifdef BOOST_BIG_ENDIAN
flip(x);
# endif
}
template <class T> inline void to_big(T native, T& big)
{
# ifdef BOOST_LITTLE_ENDIAN
flip(native, big);
# else
big = native;
# endif
}
template <class T> inline void to_little(T native, T& little)
{
# ifdef BOOST_BIG_ENDIAN
flip(native, little);
# else
little = native;
# endif
}
template <class T> inline void from_big(T big, T& native)
{
# ifdef BOOST_LITTLE_ENDIAN
flip(big, native);
# else
native = big;
# endif
}
template <class T> inline void from_little(T little, T& native)
{
# ifdef BOOST_BIG_ENDIAN
flip(little, native);
# else
native = little;
# endif
}
} // namespace endian
} // namespace boost

View File

@@ -0,0 +1,23 @@
// disable_warnings.hpp --------------------------------------------------------------//
// Copyright Beman Dawes 2011
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
//--------------------------------------------------------------------------------------//
#ifdef _MSC_VER
# pragma warning(push)
// triggered by boost/detail/lightweight_test.hpp
# pragma warning( disable : 4640 ) // ... construction of local static object is not thread-safe
// triggered by Microsoft's own headers, so disable
# pragma warning( disable : 4820 ) // padding added after data member
# pragma warning( disable : 4548 ) // expression before comma has no effect
# pragma warning( disable : 4668 ) // ... is not defined as a preprocessor macro
# pragma warning( disable : 4514 ) // ... unreferenced inline function has been removed
# pragma warning( disable : 4710 ) // ... function not inlined
# pragma warning( disable : 4986 ) // ... exception specification does not match previous declaration
#endif

View File

@@ -0,0 +1,12 @@
// disable_warnings_pop.hpp ----------------------------------------------------------//
// Copyright Beman Dawes 2011
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
//--------------------------------------------------------------------------------------//
#ifdef _MSC_VER
# pragma warning(push)
#endif