| 1 | /* |
| 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) |
| 6 | */ |
| 7 | /*! |
| 8 | * \file unique_identifier_name.hpp |
| 9 | * \author Andrey Semashev |
| 10 | * \date 30.04.2008 |
| 11 | * |
| 12 | * The header contains \c BOOST_LOG_UNIQUE_IDENTIFIER_NAME macro definition. |
| 13 | */ |
| 14 | |
| 15 | #ifndef BOOST_LOG_UTILITY_UNIQUE_IDENTIFIER_NAME_HPP_INCLUDED_ |
| 16 | #define BOOST_LOG_UTILITY_UNIQUE_IDENTIFIER_NAME_HPP_INCLUDED_ |
| 17 | |
| 18 | #include <boost/preprocessor/cat.hpp> |
| 19 | #include <boost/log/detail/config.hpp> |
| 20 | |
| 21 | #ifdef BOOST_HAS_PRAGMA_ONCE |
| 22 | #pragma once |
| 23 | #endif |
| 24 | |
| 25 | #ifndef BOOST_LOG_DOXYGEN_PASS |
| 26 | |
| 27 | #define BOOST_LOG_UNIQUE_IDENTIFIER_NAME_INTERNAL_(prefix, postfix)\ |
| 28 | BOOST_PP_CAT(prefix, postfix) |
| 29 | #define BOOST_LOG_UNIQUE_IDENTIFIER_NAME_INTERNAL(prefix, postfix)\ |
| 30 | BOOST_LOG_UNIQUE_IDENTIFIER_NAME_INTERNAL_(prefix, postfix) |
| 31 | |
| 32 | #endif // BOOST_LOG_DOXYGEN_PASS |
| 33 | |
| 34 | /*! |
| 35 | * \def BOOST_LOG_UNIQUE_IDENTIFIER_NAME(prefix) |
| 36 | * |
| 37 | * Constructs a unique (in the current file scope) token that can be used as a variable name. |
| 38 | * The name will contain a prefix passed in the \a prefix argument. This allows to use the |
| 39 | * macro multiple times on a single line. |
| 40 | */ |
| 41 | |
| 42 | // In VC 7.0 and later when compiling with /ZI option __LINE__ macro is corrupted |
| 43 | #ifdef BOOST_MSVC |
| 44 | # define BOOST_LOG_UNIQUE_IDENTIFIER_NAME(prefix)\ |
| 45 | BOOST_LOG_UNIQUE_IDENTIFIER_NAME_INTERNAL(prefix, __COUNTER__) |
| 46 | #else |
| 47 | # define BOOST_LOG_UNIQUE_IDENTIFIER_NAME(prefix)\ |
| 48 | BOOST_LOG_UNIQUE_IDENTIFIER_NAME_INTERNAL(prefix, __LINE__) |
| 49 | #endif // BOOST_MSVC |
| 50 | |
| 51 | #endif // BOOST_LOG_UTILITY_UNIQUE_IDENTIFIER_NAME_HPP_INCLUDED_ |
| 52 | |