diff --git a/include/boost/dll/detail/aggressive_ptr_cast.hpp b/include/boost/dll/detail/aggressive_ptr_cast.hpp index a882cd9b..ef938b30 100644 --- a/include/boost/dll/detail/aggressive_ptr_cast.hpp +++ b/include/boost/dll/detail/aggressive_ptr_cast.hpp @@ -1,5 +1,5 @@ // Copyright 2014 Renato Tegon Forti, Antony Polukhin. -// Copyright 2015-2016 Antony Polukhin. +// Copyright 2015-2017 Antony Polukhin. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt @@ -21,9 +21,14 @@ #include #include #include -#include // boost::uintptr_t #include // std::memcpy +// Logic from boost/log/detail/header.hpp +#if defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) \ + && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" +#endif namespace boost { namespace dll { namespace detail { // GCC warns when reinterpret_cast between function pointer and object pointer occur. @@ -48,9 +53,7 @@ BOOST_FORCEINLINE typename boost::disable_if_c::val "Pointer to function and pointer to object differ in size on your platform." ); - return reinterpret_cast( - reinterpret_cast(v) - ); + return reinterpret_cast(v); } template @@ -73,12 +76,8 @@ BOOST_FORCEINLINE typename boost::disable_if_c::value | ); return static_cast( - *reinterpret_cast::type*>( - *reinterpret_cast( - reinterpret_cast( - v - ) - ) + **reinterpret_cast::type**>( + v ) ); } @@ -124,6 +123,11 @@ BOOST_FORCEINLINE typename boost::disable_if_c::val return 0; } +#if defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) \ + && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 +# pragma GCC diagnostic pop +#endif + }}} // boost::dll::detail #endif // BOOST_DLL_DETAIL_AGGRESSIVE_PTR_CAST_HPP