]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/local_function/aux_/macro/decl.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / local_function / aux_ / macro / decl.hpp
1
2 // Copyright (C) 2009-2012 Lorenzo Caminiti
3 // Distributed under the Boost Software License, Version 1.0
4 // (see accompanying file LICENSE_1_0.txt or a copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 // Home at http://www.boost.org/libs/local_function
7
8 #ifndef BOOST_LOCAL_FUNCTION_AUX_DECL_HPP_
9 #define BOOST_LOCAL_FUNCTION_AUX_DECL_HPP_
10
11 #include <boost/local_function/aux_/macro/code_/result.hpp>
12 #include <boost/local_function/aux_/macro/code_/bind.hpp>
13 #include <boost/local_function/aux_/macro/code_/functor.hpp>
14 #include <boost/local_function/aux_/preprocessor/traits/decl.hpp>
15 #include <boost/local_function/aux_/preprocessor/traits/decl_error.hpp>
16 #include <boost/scope_exit.hpp>
17 #include <boost/mpl/assert.hpp>
18 #include <boost/preprocessor/control/iif.hpp>
19 #include <boost/preprocessor/facilities/is_empty.hpp>
20 #include <boost/preprocessor/list/adt.hpp>
21 #include <boost/preprocessor/tuple/eat.hpp>
22
23 // PRIVATE //
24
25 #define BOOST_LOCAL_FUNCTION_AUX_DECL_OK_(id, typename01, decl_traits) \
26 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT(id, typename01, decl_traits) \
27 BOOST_LOCAL_FUNCTION_AUX_CODE_BIND(id, typename01, decl_traits) \
28 BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR(id, typename01, decl_traits)
29
30 #define BOOST_LOCAL_FUNCTION_AUX_DECL_ERROR_(id, typename01, decl_traits) \
31 BOOST_PP_IIF(BOOST_PP_LIST_IS_CONS( \
32 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits)), \
33 /* return specified, so no result type before this macro expansion */ \
34 BOOST_PP_TUPLE_EAT(1) \
35 , \
36 /* even if error, must declare result type to prevent additional */ \
37 /* error due to result type appearing before this macro expansion */ \
38 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_DECL \
39 )(id) \
40 ; /* close eventual previous statements, otherwise it has no effect */ \
41 BOOST_MPL_ASSERT_MSG(false, /* always fails (there's an error) */ \
42 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR_MSG(decl_traits), ())\
43 ; /* must close ASSERT macro for eventual use within class scope */
44
45 // PUBLIC //
46
47 #define BOOST_LOCAL_FUNCTION_AUX_DECL_ARGS_VAR \
48 BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (args) )
49
50 // Undefine local function bound args global variable. Actual declaration of
51 // this variable is made using SFINAE mechanisms by each local function macro.
52 extern boost::scope_exit::detail::undeclared
53 BOOST_LOCAL_FUNCTION_AUX_DECL_ARGS_VAR;
54
55 // sign_params: parsed parenthesized params.
56 #define BOOST_LOCAL_FUNCTION_AUX_DECL(id, typename01, decl_traits) \
57 BOOST_PP_IIF(BOOST_PP_IS_EMPTY( \
58 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR_MSG(decl_traits)), \
59 BOOST_LOCAL_FUNCTION_AUX_DECL_OK_ \
60 , \
61 BOOST_LOCAL_FUNCTION_AUX_DECL_ERROR_ \
62 )(id, typename01, decl_traits)
63
64 #endif // #include guard
65