2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 * \file unused_variable.hpp
9 * \author Andrey Semashev
12 * The header contains definition of a macro to suppress compiler warnings about unused variables.
15 #ifndef BOOST_LOG_UTILITY_UNUSED_VARIABLE_HPP_INCLUDED_
16 #define BOOST_LOG_UTILITY_UNUSED_VARIABLE_HPP_INCLUDED_
18 #include <boost/log/detail/config.hpp>
20 #ifdef BOOST_HAS_PRAGMA_ONCE
26 //! The macro suppresses compiler warnings for \c var being unused
27 #define BOOST_LOG_UNUSED_VARIABLE(type, var, initializer) __attribute__((unused)) type var initializer
33 BOOST_LOG_OPEN_NAMESPACE
37 template< typename T >
38 BOOST_FORCEINLINE void no_unused_warnings(T const&) BOOST_NOEXCEPT {}
42 BOOST_LOG_CLOSE_NAMESPACE // namespace log
46 //! The macro suppresses compiler warnings for \c var being unused
47 #define BOOST_LOG_UNUSED_VARIABLE(type, var, initializer) type var initializer; ::boost::log::aux::no_unused_warnings(var)
51 #endif // BOOST_LOG_UTILITY_UNUSED_VARIABLE_HPP_INCLUDED_