1 /*============================================================================= 2 Copyright (c) 2001-2011 Joel de Guzman 3 Copyright (c) 2007-2019 Hartmut Kaiser 4 5 Distributed under the Boost Software License, Version 1.0. (See accompanying 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 ==============================================================================*/ 8 #if !defined(HPX_UNUSED_FEB_01_2009_1217PM) 9 #define HPX_UNUSED_FEB_01_2009_1217PM 10 11 #include <hpx/config.hpp> 12 #if defined(HPX_MSVC) 13 # pragma warning(push) 14 # pragma warning(disable: 4522) // multiple assignment operators specified warning 15 #endif 16 17 namespace hpx { namespace util 18 { 19 /////////////////////////////////////////////////////////////////////////// 20 // We do not import fusion::unused_type anymore to avoid boost::fusion 21 // being turned into an associate namespace, as this interferes with ADL 22 // in unexpected ways. We rather copy the full unused_type implementation. 23 /////////////////////////////////////////////////////////////////////////// 24 struct unused_type 25 { unused_typehpx::util::unused_type26 HPX_CONSTEXPR HPX_HOST_DEVICE HPX_FORCEINLINE unused_type() noexcept {} 27 unused_typehpx::util::unused_type28 HPX_CONSTEXPR HPX_HOST_DEVICE HPX_FORCEINLINE unused_type( 29 unused_type const&) 30 { 31 } unused_typehpx::util::unused_type32 HPX_CONSTEXPR HPX_HOST_DEVICE HPX_FORCEINLINE unused_type(unused_type&&) 33 { 34 } 35 36 template <typename T> unused_typehpx::util::unused_type37 HPX_CONSTEXPR HPX_HOST_DEVICE HPX_FORCEINLINE unused_type( 38 T const&) noexcept 39 { 40 } 41 42 template <typename T> 43 HPX_CONSTEXPR HPX_HOST_DEVICE HPX_FORCEINLINE unused_type const& operator =hpx::util::unused_type44 operator=(T const&) const noexcept 45 { 46 return *this; 47 } 48 49 template <typename T> 50 HPX_HOST_DEVICE HPX_FORCEINLINE unused_type& operator =hpx::util::unused_type51 operator=(T const&) noexcept 52 { 53 return *this; 54 } 55 56 HPX_CONSTEXPR HPX_HOST_DEVICE HPX_FORCEINLINE unused_type const& operator =hpx::util::unused_type57 operator=(unused_type const&) const noexcept 58 { 59 return *this; 60 } 61 62 HPX_HOST_DEVICE HPX_FORCEINLINE unused_type& operator =hpx::util::unused_type63 operator=(unused_type const&) noexcept 64 { 65 return *this; 66 } 67 68 HPX_CONSTEXPR HPX_HOST_DEVICE HPX_FORCEINLINE unused_type const& operator =hpx::util::unused_type69 operator=(unused_type&&) const noexcept 70 { 71 return *this; 72 } 73 74 HPX_HOST_DEVICE HPX_FORCEINLINE unused_type& operator =hpx::util::unused_type75 operator=(unused_type&&) noexcept 76 { 77 return *this; 78 } 79 }; 80 81 #if defined(HPX_MSVC_NVCC) 82 HPX_CONSTANT 83 #endif 84 HPX_CONSTEXPR_OR_CONST unused_type unused = unused_type(); 85 }} 86 87 ////////////////////////////////////////////////////////////////////////////// 88 // use this to silence compiler warnings related to unused function arguments. 89 #if defined(__CUDA_ARCH__) 90 #define HPX_UNUSED(x) (void)x 91 #else 92 #define HPX_UNUSED(x) ::hpx::util::unused = (x) 93 #endif 94 95 #if defined(HPX_MSVC) 96 # pragma warning(pop) 97 #endif 98 99 #endif 100