From 977da7615056496b19559fcb4879dad8908a4189 Mon Sep 17 00:00:00 2001 From: bemandawes Date: Mon, 23 May 2011 16:32:15 +0000 Subject: [PATCH] Eliminate warnings git-svn-id: http://svn.boost.org/svn/boost/sandbox/endian@72124 b8fc166d-592f-0410-95f2-cb63ce0dd405 --- boost/endian/conversion.hpp | 81 +++++--------------- boost/endian/detail/disable_warnings.hpp | 23 ++++++ boost/endian/detail/disable_warnings_pop.hpp | 12 +++ 3 files changed, 54 insertions(+), 62 deletions(-) create mode 100644 boost/endian/detail/disable_warnings.hpp create mode 100644 boost/endian/detail/disable_warnings_pop.hpp diff --git a/boost/endian/conversion.hpp b/boost/endian/conversion.hpp index 50d95d4..0b825b2 100644 --- a/boost/endian/conversion.hpp +++ b/boost/endian/conversion.hpp @@ -196,69 +196,26 @@ namespace endian *--t = *++s; } - template inline void to_big(T& x) - { -# ifdef BOOST_LITTLE_ENDIAN - flip(x); -# endif - } +#ifdef BOOST_LITTLE_ENDIAN + template inline void to_big(T& x) { flip(x); } + template inline void to_little(T&) {} + template inline void from_big(T& x) { flip(x); } + template inline void from_little(T&) {} + template inline void to_big(T native, T& big) { flip(native, big); } + template inline void to_little(T native, T& little) { little = native; } + template inline void from_big(T big, T& native) { flip(big, native); } + template inline void from_little(T little, T& native) { native = little; } +#else + template inline void to_big(T&) {} + template inline void to_little(T& x) { flip(x); } + template inline void from_big(T&) {} + template inline void from_little(T& x) { flip(x); } + template inline void to_big(T native, T& big) { big = native; } + template inline void to_little(T native, T& little) { flip(native, little); } + template inline void from_big(T big, T& native) { native = big; } + template inline void from_little(T little, T& native) { flip(little, native); } +#endif - template inline void to_little(T& x) - { -# ifdef BOOST_BIG_ENDIAN - flip(x); -# endif - } - - template inline void from_big(T& x) - { -# ifdef BOOST_LITTLE_ENDIAN - flip(x); -# endif - } - - template inline void from_little(T& x) - { -# ifdef BOOST_BIG_ENDIAN - flip(x); -# endif - } - - template inline void to_big(T native, T& big) - { -# ifdef BOOST_LITTLE_ENDIAN - flip(native, big); -# else - big = native; -# endif - } - - template inline void to_little(T native, T& little) - { -# ifdef BOOST_BIG_ENDIAN - flip(native, little); -# else - little = native; -# endif - } - - template inline void from_big(T big, T& native) - { -# ifdef BOOST_LITTLE_ENDIAN - flip(big, native); -# else - native = big; -# endif - } - - template inline void from_little(T little, T& native) - { -# ifdef BOOST_BIG_ENDIAN - flip(little, native); -# else - native = little; -# endif - } } // namespace endian } // namespace boost diff --git a/boost/endian/detail/disable_warnings.hpp b/boost/endian/detail/disable_warnings.hpp new file mode 100644 index 0000000..e2da8c6 --- /dev/null +++ b/boost/endian/detail/disable_warnings.hpp @@ -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 diff --git a/boost/endian/detail/disable_warnings_pop.hpp b/boost/endian/detail/disable_warnings_pop.hpp new file mode 100644 index 0000000..0ebc74a --- /dev/null +++ b/boost/endian/detail/disable_warnings_pop.hpp @@ -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