diff options
author | Remko Tronçon <git@el-tramo.be> | 2013-08-21 18:24:42 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2013-08-22 20:27:22 (GMT) |
commit | 099c4028d6b357fd1de7e2d6296628c1367bf30d (patch) | |
tree | 6a6c3133a328d19518993ccf7982c26b269050e2 /3rdParty/Boost/src/boost/local_function/detail/preprocessor | |
parent | 07e9627cc7556d34c6fa5bd25ac8f34cd975d6bb (diff) | |
download | swift-099c4028d6b357fd1de7e2d6296628c1367bf30d.zip swift-099c4028d6b357fd1de7e2d6296628c1367bf30d.tar.bz2 |
Add boost/scope_exit.
Change-Id: I6a38e842252aa24f456465d181ccf0aae763abb5
Diffstat (limited to '3rdParty/Boost/src/boost/local_function/detail/preprocessor')
7 files changed, 398 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/facility/add.hpp b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/facility/add.hpp new file mode 100644 index 0000000..13f5699 --- /dev/null +++ b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/facility/add.hpp @@ -0,0 +1,25 @@ + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_ADD_HPP_ +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_ADD_HPP_ + +#include <boost/preprocessor/control/expr_iif.hpp> +#include <boost/preprocessor/logical/compl.hpp> + +// `is_front_macro(tokens)` is 1 if `tokens` start w/ `keyword` to add, else 0. +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_ADD_FRONT( \ + tokens, is_front_macro, keyword) \ + BOOST_PP_EXPR_IIF(BOOST_PP_COMPL(is_front_macro(tokens)), keyword) tokens + +// `is_back_macro(tokens)` is 1 if `tokens` end with `keyword` to add, else 0. +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_ADD_BACK( \ + tokens, is_back_macro, keyword) \ + tokens BOOST_PP_EXPR_IIF(BOOST_PP_COMPL(is_back_macro(tokens)), keyword) + +#endif // #include guard + diff --git a/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/facility/is.hpp b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/facility/is.hpp new file mode 100644 index 0000000..a5a1151 --- /dev/null +++ b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/facility/is.hpp @@ -0,0 +1,51 @@ + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_HPP_ +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_HPP_ + +// Boost.Preprocessor author P. Mensodines confirmed on an Boost email thread +// (subject ``check if a token is a keyword (was "BOOST_PP_IS_UNARY()")'') +// that it is OK to used `PP_IS_UNARY()` to check if tokens match predefined +// "keyword" as it is done by the macros below (even if `PP_IS_UNARY()` is +// technically only part of Boost.Preprocessor private API). +#include <boost/preprocessor/detail/is_unary.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/control/iif.hpp> +#include <boost/preprocessor/tuple/eat.hpp> + +// PRIVATE // + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_(a, b) \ + BOOST_PP_IS_UNARY(BOOST_PP_CAT(a, b)) + +// PUBLIC // + +// `checking_prefix ## tokens` expand to unary (e.g., `(1)`) iff `tokens` start +// with keyword to check. +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_FRONT( \ + tokens, checking_prefix) \ + BOOST_PP_IIF(BOOST_PP_IS_UNARY(tokens), \ + /* on MSVC this check works even if tokens already unary but on */ \ + /* C++03 (including GCC) this check on non-unary tokens gives */ \ + /* a concatenation error -- so return false is tokens is not unary */ \ + 0 BOOST_PP_TUPLE_EAT(2) \ + , \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_ \ + )(checking_prefix, tokens) + +// `token ## checking_postfix` expand to unary (e.g., `(1)`) iff `token` is the +// keyword to check. This check only works if `token` is a single token, it +// will always expand to 0 if token is multiple tokens (e.g., `const *this`). +// This check will expand to 0 with no error if `token` starts with a +// non-alphanumeric symbol (e.g., `*this`). +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_BACK( \ + token, checking_postfix) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_(token, checking_postfix) + +#endif // #include guard + diff --git a/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/facility/remove.hpp b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/facility/remove.hpp new file mode 100644 index 0000000..e2d2daa --- /dev/null +++ b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/facility/remove.hpp @@ -0,0 +1,58 @@ + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_HPP_ +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_HPP_ + +#include <boost/preprocessor/control/iif.hpp> +#include <boost/preprocessor/tuple/eat.hpp> +#include <boost/preprocessor/config/config.hpp> +#include <boost/preprocessor/cat.hpp> + +// PRIVATE // + +// From PP_EXPAND (my own reentrant version). +#if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() && \ + ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_DMC() +# define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_EXPAND_(x) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_EXPAND_I_(x) +#else +# define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_EXPAND_(x) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_EXPAND_OO_((x)) +# define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_EXPAND_OO_( \ + par) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_EXPAND_I_ ## par +#endif +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_EXPAND_I_(x) x + +// PUBLIC // + +// `is_front_macro(tokens)` is 1 if `tokens` start with keyword to remove. +// `removing_prefix ## <keyword-to-remove>` must expand to nothing, else 0. +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_FRONT( \ + tokens, is_front_macro, removing_prefix) \ + /* without EXPAND doesn't expand on MSVC */ \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_EXPAND_( \ + BOOST_PP_IIF(is_front_macro(tokens), \ + BOOST_PP_CAT \ + , \ + tokens BOOST_PP_TUPLE_EAT(2) \ + )(removing_prefix, tokens) \ + ) + +// `is_back_macro(tokens)` is 1 iff `tokens` end with keyword to remove. +// `<keyword-to-remove> ## removing_postfix` must expand to nothing, else 0. +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_BACK( \ + tokens, is_back_macro, removing_prefix) \ + BOOST_PP_IIF(is_back_macro(tokens), \ + BOOST_PP_CAT \ + , \ + tokens BOOST_PP_TUPLE_EAT(2) \ + )(tokens, removing_postfix) + +#endif // #include guard + diff --git a/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/thisunderscore.hpp b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/thisunderscore.hpp new file mode 100644 index 0000000..9bf543b --- /dev/null +++ b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/thisunderscore.hpp @@ -0,0 +1,63 @@ + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_HPP_ +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_HPP_ + +#include <boost/local_function/detail/preprocessor/keyword/facility/is.hpp> +#include <boost/local_function/detail/preprocessor/keyword/facility/add.hpp> +#include <boost/local_function/detail/preprocessor/keyword/facility/remove.hpp> + +// PRIVATE // + +// These are not local macros -- DO NOT #UNDEF. +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_ISthis_ (1) +#define this_BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_IS (1) +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_REMOVEthis_ +#define this_BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_REMOVE + +// PUBLIC // + +// Is. + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_THISUNDERSCORE_FRONT(tokens) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_FRONT(tokens, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_IS) + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_THISUNDERSCORE_BACK(token) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_BACK(token, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_IS) + +// Remove. + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_REMOVE_FRONT( \ + tokens) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_FRONT(tokens, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_THISUNDERSCORE_FRONT, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_REMOVE) + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_REMOVE_BACK( \ + tokens) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_BACK(tokens, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_THISUNDERSCORE_BACK, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_REMOVE) + +// Add. + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_ADD_FRONT( \ + tokens) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_ADD_FRONT(tokens, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_THISUNDERSCORE_FRONT, \ + this_) + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_THISUNDERSCORE_ADD_BACK(tokens) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_ADD_BACK(tokens, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_THISUNDERSCORE_BACK, \ + this_) + +#endif // #include guard + diff --git a/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/void.hpp b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/void.hpp new file mode 100644 index 0000000..14d4669 --- /dev/null +++ b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/keyword/void.hpp @@ -0,0 +1,58 @@ + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_HPP_ +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_HPP_ + +#include <boost/local_function/detail/preprocessor/keyword/facility/is.hpp> +#include <boost/local_function/detail/preprocessor/keyword/facility/add.hpp> +#include <boost/local_function/detail/preprocessor/keyword/facility/remove.hpp> + +// PRIVATE // + +// These are not local macros -- DO NOT #UNDEF. +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_IS_void (1) /* unary */ +#define void_BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_IS (1) /* unary */ +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_REMOVE_void /* nothing */ +#define void_BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_REMOVE /* nothing */ + +// PUBLIC // + +// Is. + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_VOID_FRONT(tokens) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_FRONT(tokens, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_IS_) + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_VOID_BACK(token) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_BACK(token, \ + _BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_IS) + +// Remove. + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_REMOVE_FRONT(tokens) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_FRONT(tokens, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_VOID_FRONT, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_REMOVE_) + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_REMOVE_BACK(tokens) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_REMOVE_BACK(tokens, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_VOID_BACK, \ + _BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_REMOVE) + +// Add. + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_ADD_FRONT(tokens) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_ADD_FRONT(tokens, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_VOID_FRONT, void) + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_VOID_ADD_BACK(tokens) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_ADD_BACK(tokens, \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_VOID_BACK, void) + +#endif // #include guard + diff --git a/3rdParty/Boost/src/boost/local_function/detail/preprocessor/line_counter.hpp b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/line_counter.hpp new file mode 100644 index 0000000..ffb90a6 --- /dev/null +++ b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/line_counter.hpp @@ -0,0 +1,23 @@ + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER_HPP_ +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER_HPP_ + +#include <boost/config.hpp> + +// PUBLIC // + +// MSVC has problems expanding __LINE__ so use (the non standard) __COUNTER__. +#ifdef BOOST_MSVC +# define BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER __COUNTER__ +#else +# define BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER __LINE__ +#endif + +#endif // #include guard + diff --git a/3rdParty/Boost/src/boost/local_function/detail/preprocessor/void_list.hpp b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/void_list.hpp new file mode 100644 index 0000000..2a302c6 --- /dev/null +++ b/3rdParty/Boost/src/boost/local_function/detail/preprocessor/void_list.hpp @@ -0,0 +1,120 @@ + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_HPP_ +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_HPP_ + +#include <boost/local_function/detail/preprocessor/keyword/void.hpp> +#include <boost/config.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/control/iif.hpp> +#include <boost/preprocessor/comparison/equal.hpp> +#include <boost/preprocessor/tuple/to_list.hpp> +#include <boost/preprocessor/seq/size.hpp> +#include <boost/preprocessor/seq/to_tuple.hpp> + +// PRIVATE // + +// Argument: (token1)... +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_FROM_SEQ_(unused, seq) \ + BOOST_PP_TUPLE_TO_LIST(BOOST_PP_SEQ_SIZE(seq), BOOST_PP_SEQ_TO_TUPLE(seq)) + +// Token: void | token1 +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_HANDLE_VOID_( \ + is_void_macro, token) \ + BOOST_PP_IIF(is_void_macro(token), \ + BOOST_PP_NIL \ + , \ + (token, BOOST_PP_NIL) \ + ) + +// Token: (a)(b)... | empty | void | token +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_HANDLE_SEQ_( \ + is_void_macro, token) \ + BOOST_PP_IIF(BOOST_PP_IS_UNARY(token), /* unary paren (a)... */ \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_FROM_SEQ_ \ + , \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_HANDLE_VOID_ \ + )(is_void_macro, token) + +#ifdef BOOST_NO_VARIADIC_MACROS + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_(is_void_macro, seq) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_HANDLE_SEQ_(is_void_macro, seq) + +#else // VARIADICS + +// FUTURE: Replace this with BOOST_PP_VARIADIC_SIZE when and if +// BOOST_PP_VARIAIDCS detection will match !BOOST_NO_VARIADIC_MACROS (for now +// Boost.Preprocessor and Boost.Config disagree on detecting compiler variadic +// support while this VARIADIC_SIZE works on compilers not detected by PP). +#if BOOST_MSVC +# define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_VARIADIC_SIZE_(...) \ + BOOST_PP_CAT(BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_VARIADIC_SIZE_I_(__VA_ARGS__, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,),) +#else // MSVC +# define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_VARIADIC_SIZE_(...) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_VARIADIC_SIZE_I_(__VA_ARGS__, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,) +#endif // MSVC +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_VARIADIC_SIZE_I_(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63, size, ...) size + +// Argument: token1, ... +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_FROM_VARIADIC_(unused, ...) \ + BOOST_PP_TUPLE_TO_LIST( \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_VARIADIC_SIZE_( \ + __VA_ARGS__), (__VA_ARGS__)) + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_(is_void_macro, ...) \ + BOOST_PP_IIF(BOOST_PP_EQUAL( \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_VARIADIC_SIZE_( \ + __VA_ARGS__), 1), \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_HANDLE_SEQ_ \ + , \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_FROM_VARIADIC_ \ + )(is_void_macro, __VA_ARGS__) + +#endif // VARIADICS + +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_NEVER_(tokens) \ + 0 /* void check always returns false */ + +// PUBLIC // + +// NOTE: Empty list must always be represented is void (which is also a way to +// specify no function parameter) and it can never be empty because (1) +// IS_EMPTY(&var) fails (because of the leading non alphanumeric symbol) and +// (2) some compilers (MSVC) fail to correctly pass empty macro parameters +// even if they support variadic macros. Therefore, always using void to +// represent is more portable. + +#ifdef BOOST_NO_VARIADIC_MACROS + +// Expand `void | (a)(b)...` to pp-list `NIL | (a, (b, NIL))`. +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST(sign) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_( \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_VOID_BACK, sign) + +// Expand `(a)(b)...` to pp-list `(a, (b, NIL))`. +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_NON_VOID_LIST(seq) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_( \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_NEVER_, seq) + +#else // VARIADICS + +// Expand `void | (a)(b)... | a, b, ...` to pp-list `NIL | (a, (b, NIL))`. +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST(...) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_( \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_VOID_BACK, __VA_ARGS__) + +// Expand `(a)(b)... | a, b, ...` to pp-list `(a, (b, NIL))`. +#define BOOST_LOCAL_FUNCTION_DETAIL_PP_NON_VOID_LIST(...) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_( \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_NEVER_, __VA_ARGS__) + +#endif // VARIADICS + +#endif // #include guard + |