]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/local_function/include/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate_/defaults.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / local_function / include / boost / local_function / aux_ / preprocessor / traits / decl_sign_ / validate_ / defaults.hpp
CommitLineData
7c673cae
FG
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_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_HPP_
9#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_HPP_
10
11#include <boost/local_function/detail/preprocessor/keyword/const_bind.hpp>
12#include <boost/local_function/detail/preprocessor/keyword/bind.hpp>
13#include <boost/local_function/detail/preprocessor/keyword/default.hpp>
14#include <boost/preprocessor/cat.hpp>
15#include <boost/preprocessor/control/while.hpp>
16#include <boost/preprocessor/control/iif.hpp>
17#include <boost/preprocessor/control/if.hpp>
18#include <boost/preprocessor/facilities/expand.hpp>
19#include <boost/preprocessor/facilities/empty.hpp>
20#include <boost/preprocessor/facilities/is_empty.hpp>
21#include <boost/preprocessor/logical/bitand.hpp>
22#include <boost/preprocessor/logical/bitor.hpp>
23#include <boost/preprocessor/logical/not.hpp>
24#include <boost/preprocessor/comparison/less.hpp>
25#include <boost/preprocessor/arithmetic/inc.hpp>
26#include <boost/preprocessor/arithmetic/dec.hpp>
27#include <boost/preprocessor/tuple/eat.hpp>
28#include <boost/preprocessor/tuple/elem.hpp>
29#include <boost/preprocessor/list/size.hpp>
30#include <boost/preprocessor/list/at.hpp>
31
32// PRIVATE //
33
34#define \
35BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_IS_UNBIND_( \
36 sign) \
37 /* PP_OR/PP_BITOR (instead of IIF) don't expand on MSVC */ \
38 BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_DEFAULT_FRONT(sign),\
39 0 \
40 , BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_CONST_BIND_FRONT( \
41 sign), \
42 0 \
43 , BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_BIND_FRONT(sign), \
44 0 \
45 , \
46 1 \
47 )))
48
49#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_PREV_( \
50 sign, index, error) \
51 BOOST_PP_IIF( \
52 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_IS_UNBIND_( \
53 BOOST_PP_LIST_AT(sign, BOOST_PP_DEC(index))), \
54 error /* no err, fwd existing one if any */ \
55 , \
56 BOOST_PP_CAT(BOOST_PP_CAT(ERROR_default_value_at_element_, \
57 BOOST_PP_INC(index)), _must_follow_an_unbound_parameter) \
58 BOOST_PP_EMPTY /* because error might not be present */ \
59 )
60
61#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_INDEX_( \
62 sign, index, error) \
63 BOOST_PP_IF(index, /* can't use IIF because index can be any number */ \
64 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_PREV_ \
65 , \
66 ERROR_default_value_cannot_be_specified_as_the_first_element \
67 BOOST_PP_EMPTY /* because error might not be present */ \
68 BOOST_PP_TUPLE_EAT(3) \
69 )(sign, index, error)
70
71// While's operation.
72
73#define \
74BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_OP_DATA_( \
75 sign, index, error) \
76 ( \
77 sign \
78 , \
79 BOOST_PP_INC(index) \
80 , \
81 BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_DEFAULT_FRONT( \
82 BOOST_PP_LIST_AT(sign, index)), \
83 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_INDEX_ \
84 , \
85 error BOOST_PP_TUPLE_EAT(3) /* no err, fwd existing one if any */\
86 )(sign, index, error) \
87 )
88
89#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_OP_(d, \
90 sign_index_error) \
91 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_OP_DATA_( \
92 BOOST_PP_TUPLE_ELEM(3, 0, sign_index_error), \
93 BOOST_PP_TUPLE_ELEM(3, 1, sign_index_error), \
94 BOOST_PP_TUPLE_ELEM(3, 2, sign_index_error))
95
96// While predicate.
97
98#define \
99BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_PRED_DATA_( \
100 sign, index, error) \
101 BOOST_PP_BITAND( \
102 BOOST_PP_IS_EMPTY(error (/* expand empty */) ) \
103 , BOOST_PP_LESS(index, BOOST_PP_LIST_SIZE(sign)) \
104 )
105
106#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_PRED_( \
107 d, sign_index_error) \
108 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_PRED_DATA_( \
109 BOOST_PP_TUPLE_ELEM(3, 0, sign_index_error), \
110 BOOST_PP_TUPLE_ELEM(3, 1, sign_index_error), \
111 BOOST_PP_TUPLE_ELEM(3, 2, sign_index_error))
112
113// PUBLIC //
114
115// Validate parameters default values: `default ...` cannot be 1st element and
116// it must follow an unbind param. Expand to `EMPTY` if no error, or
117// `ERROR_message EMPTY` if error.
118#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS(sign) \
119 BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_WHILE( \
120 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_PRED_, \
121 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_OP_,\
122 (sign, 0, BOOST_PP_EMPTY)))
123
124#endif // #include guard
125