Chris@16: /* Chris@101: * Copyright Andrey Semashev 2007 - 2015. Chris@16: * Distributed under the Boost Software License, Version 1.0. Chris@16: * (See accompanying file LICENSE_1_0.txt or copy at Chris@16: * http://www.boost.org/LICENSE_1_0.txt) Chris@16: */ Chris@16: /*! Chris@16: * \file unused_variable.hpp Chris@16: * \author Andrey Semashev Chris@16: * \date 10.05.2008 Chris@16: * Chris@16: * The header contains definition of a macro to suppress compiler warnings about unused variables. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_LOG_UTILITY_UNUSED_VARIABLE_HPP_INCLUDED_ Chris@16: #define BOOST_LOG_UTILITY_UNUSED_VARIABLE_HPP_INCLUDED_ Chris@16: Chris@16: #include Chris@16: Chris@16: #ifdef BOOST_HAS_PRAGMA_ONCE Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #if defined(__GNUC__) Chris@16: Chris@16: //! The macro suppresses compiler warnings for \c var being unused Chris@16: #define BOOST_LOG_UNUSED_VARIABLE(type, var, initializer) __attribute__((unused)) type var initializer Chris@16: Chris@16: #else Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: BOOST_LOG_OPEN_NAMESPACE Chris@16: Chris@16: namespace aux { Chris@16: Chris@16: template< typename T > Chris@101: BOOST_FORCEINLINE void no_unused_warnings(T const&) BOOST_NOEXCEPT {} Chris@16: Chris@16: } // namespace aux Chris@16: Chris@16: BOOST_LOG_CLOSE_NAMESPACE // namespace log Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: //! The macro suppresses compiler warnings for \c var being unused Chris@16: #define BOOST_LOG_UNUSED_VARIABLE(type, var, initializer) type var initializer; ::boost::log::aux::no_unused_warnings(var) Chris@16: Chris@16: #endif Chris@16: Chris@16: #endif // BOOST_LOG_UTILITY_UNUSED_VARIABLE_HPP_INCLUDED_