mirror of
https://github.com/boostorg/contract.git
synced 2026-02-27 04:52:22 +00:00
pasring postconditions
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/alias/parse/typedef.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/alias/parse/using.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/alias/parse/namespace.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/namespace.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/using.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/template.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/typedef.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/functional/invoke.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/paren/has.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/expand.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_D_(d, parse_macro, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_DECL_TRAITS_DONE(parse_macro(d, \
|
||||
BOOST_CONTRACT_EXT_PP_DECL_TRAITS_INIT(decl)))
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_(unsued, parse_macro, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_DECL_TRAITS_DONE(parse_macro( \
|
||||
BOOST_CONTRACT_EXT_PP_DECL_TRAITS_INIT(decl)))
|
||||
|
||||
// Implementation: This must expand to empty.
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_EMPTY_(unsued1, unused2, unsued3)
|
||||
|
||||
// Precondition: decl = `(,,,) ...`
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_IS_USING_TEMPLATE_PAREN_(decl) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_USING_FRONT( \
|
||||
BOOST_PP_TUPLE_EAT(0) decl), 1, 0)
|
||||
|
||||
// Precondition: decl = `template ...`
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_IS_USING_TEMPLATE_(decl) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_HAS_PAREN( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_TEMPLATE_REMOVE_FRONT(decl)), \
|
||||
BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_IS_USING_TEMPLATE_PAREN_ \
|
||||
, \
|
||||
0 BOOST_PP_TUPLE_EAT(1) \
|
||||
)(BOOST_CONTRACT_EXT_PP_KEYWORD_TEMPLATE_REMOVE_FRONT(decl))
|
||||
|
||||
// Expand to 1 if decl = `[template(,,,)] using ...`, otherwise to 0.
|
||||
// Implementation: EXPAND needed for proper expansion (on MSVC).
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_IS_USING_(decl) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_USING_FRONT(decl), \
|
||||
1 BOOST_PP_TUPLE_EAT(1) \
|
||||
, BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_TEMPLATE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_IS_USING_TEMPLATE_ \
|
||||
, \
|
||||
0 BOOST_PP_TUPLE_EAT(1) \
|
||||
))(decl)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Expand to EMPTY() if decl is not an alias declaration, otherwise expand to
|
||||
// alias traits.
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_D(d, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_EXPAND_ONCE( \
|
||||
BOOST_CONTRACT_EXT_PP_INVOKE3 \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_NAMESPACE_FRONT(decl), \
|
||||
(BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_, ~, \
|
||||
BOOST_CONTRACT_EXT_PP_NAMESPACE_ALIAS_TRAITS_PARSE, decl) \
|
||||
, BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_IS_USING_(decl), \
|
||||
(BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_, ~, \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_PARSE, decl) \
|
||||
, BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_TYPEDEF_FRONT(decl), \
|
||||
(BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_D_, d, \
|
||||
BOOST_CONTRACT_EXT_PP_TYPEDEF_ALIAS_TRAITS_PARSE_D, decl) \
|
||||
, \
|
||||
(BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_EMPTY_, ~, ~, ~) \
|
||||
))) \
|
||||
)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_AUX_INDEX_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_AUX_INDEX_HPP_
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_AUX_KIND_INDEX 0
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_AUX_TEMPLATE_PARAMS_INDEX 1
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_AUX_NAMESPACE_INDEX 2
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_AUX_NEW_NAME_INDEX 3
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_AUX_NAME_INDEX 4
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_KIND_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_KIND_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/alias/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Expand to `namespace | using | typedef`.
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_KIND(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_AUX_KIND_INDEX, traits)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_NAME_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_NAME_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/alias/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Expand to `(name,,,)` (wrapped within parenthesis because in general this
|
||||
// name/type can contain unwrapped commas).
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_NAME(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_AUX_NAME_INDEX, traits)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_NAMESPACE_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_NAMESPACE_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/alias/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Expand to `namespace | EMPTY()` (can be not empty only for using aliases).
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_NAMESPACE(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_AUX_NAMESPACE_INDEX, traits)()
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_NEW_NAME_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_NEW_NAME_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/alias/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Expand to `new-name | EMPTY()` (can be not empty only for both using
|
||||
// and typedef aliases).
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_NEW_NAME(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_AUX_NEW_NAME_INDEX, traits)()
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_NAMESPACE_ALIAS_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ALIAS_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/namespace.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/contract/as.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/paren/front.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/expand.hpp>
|
||||
#include <boost/preprocessor/tuple/rem.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `name` (this name must be wrapped with extra paren.
|
||||
// because in general (i.e., for other aliases) it can contain commas.
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ALIAS_TRAITS_NAME_(decl, traits) \
|
||||
( \
|
||||
BOOST_PP_NIL \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, (decl)) \
|
||||
)
|
||||
|
||||
// Precondition: decl = `(new-name) as ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ALIAS_TRAITS_NEW_NAME_(decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_NAMESPACE_ALIAS_TRAITS_NAME_( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_AS_REMOVE_FRONT(BOOST_PP_TUPLE_EAT(1) \
|
||||
decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
BOOST_PP_TUPLE_REM_CTOR(1, BOOST_CONTRACT_EXT_PP_PAREN_FRONT(decl))\
|
||||
BOOST_PP_EMPTY \
|
||||
) \
|
||||
)
|
||||
|
||||
// Precondition: decl = `namespace ...`.
|
||||
// Implementation: Pushes back traits: kind = `namespace`, template-params =
|
||||
// EMPTY, and namespace = EMPTY (then ready for new-name and name traits).
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ALIAS_TRAITS_PARSE_ARGS_(decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_NAMESPACE_ALIAS_TRAITS_NEW_NAME_( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_NAMESPACE_REMOVE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
namespace \
|
||||
), \
|
||||
BOOST_PP_EMPTY \
|
||||
), \
|
||||
BOOST_PP_EMPTY \
|
||||
) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `namespace (new-name) as name`.
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ALIAS_TRAITS_PARSE(decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_EXPAND_ONCE( \
|
||||
BOOST_CONTRACT_EXT_PP_NAMESPACE_ALIAS_TRAITS_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
// Inspect these traits using PP_ALIAS_TRAITS_... macros.
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_TYPEDEF_ALIAS_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ALIAS_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/type.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/typedef.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `new-name`.
|
||||
// Implementation: First we have to push back the new name that is parsed now.
|
||||
// After that, we push back the previously parsed type as the name (this is
|
||||
// because the new name trait must come before the name trait, see also
|
||||
// index.hpp).
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ALIAS_TRAITS_NEW_NAME_AND_NAME_( \
|
||||
decl_type, traits) \
|
||||
( \
|
||||
BOOST_PP_NIL \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
BOOST_CONTRACT_EXT_PP_DECL_TRAITS_FIRST(decl_type) \
|
||||
BOOST_PP_EMPTY \
|
||||
), \
|
||||
BOOST_CONTRACT_EXT_PP_DECL_TRAITS_SECOND(decl_type) \
|
||||
) \
|
||||
)
|
||||
|
||||
// Precondition: decl = `wrapped-type ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ALIAS_TRAITS_TYPE_(d, decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TYPEDEF_ALIAS_TRAITS_NEW_NAME_AND_NAME_( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_AUX_TYPE_D(d, decl), traits)
|
||||
|
||||
// Precondition: decl = `typedef ...`.
|
||||
// Implementation: Pushes back traits: kind = `typedef`, template-params =
|
||||
// EMPTY, and namespace = EMPTY (then ready for new-name and name traits).
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ALIAS_TRAITS_PARSE_(d, decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TYPEDEF_ALIAS_TRAITS_TYPE_( \
|
||||
d, \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_TYPEDEF_REMOVE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
typedef \
|
||||
), \
|
||||
BOOST_PP_EMPTY \
|
||||
), \
|
||||
BOOST_PP_EMPTY \
|
||||
) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `typedef wrapped-type new-name`.
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ALIAS_TRAITS_PARSE_D(d, decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TYPEDEF_ALIAS_TRAITS_PARSE_( \
|
||||
d, \
|
||||
BOOST_CONTRACT_EXT_PP_DECL_TRAITS_FIRST(decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_DECL_TRAITS_SECOND(decl_traits) \
|
||||
)
|
||||
|
||||
// Inspect these traits using PP_ALIAS_TRAITS_... macros.
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/template.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/using.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/namespace.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/contract/as.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/paren/has.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/paren/front.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/expand.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Name.
|
||||
|
||||
// Precondition: decl = `(name,,,)`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NAME_(decl, traits) \
|
||||
( \
|
||||
BOOST_PP_NIL \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_HAS_PAREN(decl), \
|
||||
decl \
|
||||
, \
|
||||
(decl) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
// New name.
|
||||
|
||||
// Precondition: decl = `(new-name) as ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NEW_NAME_YES_(decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NAME_( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_AS_REMOVE_FRONT(BOOST_PP_TUPLE_EAT(1) \
|
||||
decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_CONTRACT_EXT_PP_PAREN_FRONT(decl) BOOST_PP_EMPTY) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NEW_NAME_NO_(decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NAME_(decl, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, BOOST_PP_EMPTY))
|
||||
|
||||
// TODO: Remove the trailing NIL from `EAT(1) decl NIL` below once NIL is added
|
||||
// to the end of *all* decl by DECL_TRAITS_INIT.
|
||||
|
||||
// Precondition: decl = `(new-name) [as] ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NEW_NAME_CHECK_(decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_AS_FRONT( \
|
||||
BOOST_PP_TUPLE_EAT(1) decl BOOST_PP_NIL), \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NEW_NAME_YES_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NEW_NAME_NO_ \
|
||||
)(decl, traits)
|
||||
|
||||
// Precondition: decl = `[(new-name) [as]] ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NEW_NAME_(decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_HAS_PAREN(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NEW_NAME_CHECK_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NEW_NAME_NO_ \
|
||||
)(decl, traits)
|
||||
|
||||
// Namespace.
|
||||
|
||||
// Precondition: decl = `namespace ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NAMESPACE_YES_(decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NEW_NAME_( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_NAMESPACE_REMOVE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
namespace BOOST_PP_EMPTY) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NAMESPACE_NO_(decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NEW_NAME_(decl, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, BOOST_PP_EMPTY))
|
||||
|
||||
// Precondition: decl = `[namespace] ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NAMESPACE_(decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_NAMESPACE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NAMESPACE_YES_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NAMESPACE_NO_ \
|
||||
)(decl, traits) \
|
||||
|
||||
// Template parameters.
|
||||
|
||||
// Precondition: decl = `( c++-template-parameter, ... ) using ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_TEMPLATE_PARAMS_PUSH_BACK_( \
|
||||
decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NAMESPACE_( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_USING_REMOVE_FRONT( \
|
||||
BOOST_PP_TUPLE_EAT(0) decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_CONTRACT_EXT_PP_PAREN_FRONT(decl) BOOST_PP_EMPTY) \
|
||||
)
|
||||
|
||||
// Precondition: decl = `template( c++-template-parameter, ... ) using ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_TEMPLATE_PARAMS_YES_( \
|
||||
decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_TEMPLATE_PARAMS_PUSH_BACK_( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_TEMPLATE_REMOVE_FRONT(decl), traits)
|
||||
|
||||
// Precondition: decl = `using ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_TEMPLATE_PARAMS_NO_( \
|
||||
decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_NAMESPACE_( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_USING_REMOVE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, BOOST_PP_EMPTY) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_TEMPLATE_PARAMS_( \
|
||||
decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_TEMPLATE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_TEMPLATE_PARAMS_YES_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_TEMPLATE_PARAMS_NO_ \
|
||||
)(decl, traits)
|
||||
|
||||
// Kind.
|
||||
|
||||
// Implementation: Pushes back kind = `using`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_PARSE_ARGS_(decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_TEMPLATE_PARAMS_(decl, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, using))
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `[template( c++-template-parameter, ... )]
|
||||
// using [namespace | (new-name) as] wrapped-name`.
|
||||
// Implementation: Invocation of these parsing macros must follow index.hpp.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_PARSE(decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_EXPAND_ONCE( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ALIAS_TRAITS_PARSE_ARGS_ decl_traits)
|
||||
|
||||
// Inspect these traits using PP_ALIAS_TRAITS_... macros.
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_TEMPLATE_PARAMS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_TEMPLATE_PARAMS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/alias/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Expand to `( c++-template-params,,, ) | EMPTY()` (can be not empty only for
|
||||
// using aliases).
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_TEMPLATE_PARAMS(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_AUX_TEMPLATE_PARAMS_INDEX, \
|
||||
traits \
|
||||
)()
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/alias.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/functional/invoke.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/empty.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/expand.hpp>
|
||||
#include <boost/preprocessor/seq/seq.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/control/while.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_PUSH_BACK_( \
|
||||
decl_seq, traits, alias) \
|
||||
( \
|
||||
1, \
|
||||
BOOST_PP_SEQ_TAIL(decl_seq), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, alias) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_DONE_(decl_seq, traits, unused) \
|
||||
(0, decl_seq, traits)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_OP_ARGS_( \
|
||||
d, continue_, decl_seq, traits, alias) \
|
||||
BOOST_CONTRACT_EXT_PP_EXPAND_ONCE( \
|
||||
BOOST_CONTRACT_EXT_PP_INVOKE3 \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_IS_EMPTY(alias), \
|
||||
(BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_DONE_, decl_seq, traits, ~) \
|
||||
, \
|
||||
(BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_PUSH_BACK_, decl_seq, \
|
||||
traits, alias) \
|
||||
) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_OP_(d, continue_decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_OP_ARGS_( \
|
||||
d, \
|
||||
BOOST_PP_TUPLE_ELEM(3, 0, continue_decl_traits), \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, continue_decl_traits), \
|
||||
BOOST_PP_TUPLE_ELEM(3, 2, continue_decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_ALIAS_TRAITS_D(d, BOOST_PP_SEQ_HEAD( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, continue_decl_traits))) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_PRED_(d, continue_decl_traits) \
|
||||
BOOST_PP_TUPLE_ELEM(3, 0, continue_decl_traits)
|
||||
|
||||
// Implementation: SEQ_POP_BACK removes trailing NIL just added below.
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_RETURN_(continue_decl_traits) \
|
||||
( \
|
||||
BOOST_PP_SEQ_POP_BACK( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, continue_decl_traits)), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_DONE(BOOST_PP_TUPLE_ELEM(3, 2, \
|
||||
continue_decl_traits)) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_(d, decl_seq) \
|
||||
BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_RETURN_( \
|
||||
BOOST_PP_WHILE_ ## d( \
|
||||
BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_PRED_, \
|
||||
BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_OP_, \
|
||||
( \
|
||||
1, \
|
||||
decl_seq (BOOST_PP_NIL), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_INIT \
|
||||
) \
|
||||
), \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl is a pp-seq starting with aliases (but it can contain
|
||||
// other declarations after the aliases), no trait parsed if pp-seq is EMPTY().
|
||||
#define BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_PARSE_D(d, decl_seq) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_IS_EMPTY(decl_seq), \
|
||||
(decl_seq, BOOST_PP_EMPTY()) BOOST_PP_TUPLE_EAT(2) \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_ \
|
||||
)(d, decl_seq)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/bool.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/const.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/oldof.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/return.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/typedef.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/using.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/namespace.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/namespace.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/using.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/template.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/typedef.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/paren/has.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `(,,,) ...`
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_IS_USING_TEMPLATE_PAREN_(decl) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_USING_FRONT( \
|
||||
BOOST_PP_TUPLE_EAT(0) decl), 1, 0)
|
||||
|
||||
// Precondition: decl = `template ...`
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_IS_USING_TEMPLATE_(decl) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_HAS_PAREN( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_TEMPLATE_REMOVE_FRONT(decl)), \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_IS_USING_TEMPLATE_PAREN_ \
|
||||
, \
|
||||
0 BOOST_PP_TUPLE_EAT(1) \
|
||||
)(BOOST_CONTRACT_EXT_PP_KEYWORD_TEMPLATE_REMOVE_FRONT(decl))
|
||||
|
||||
// Expand to 1 if decl = `[template(,,,)] using ...`, otherwise to 0.
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_IS_USING_(decl) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_USING_FRONT(decl), \
|
||||
1 BOOST_PP_TUPLE_EAT(1) \
|
||||
, BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_TEMPLATE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_IS_USING_TEMPLATE_ \
|
||||
, \
|
||||
0 BOOST_PP_TUPLE_EAT(1) \
|
||||
))(decl) \
|
||||
)
|
||||
|
||||
// Discard `d`.
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_USING_PARSE_(d, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_PARSE(decl)
|
||||
|
||||
// Discard `d`.
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_NAMESPACE_PARSE_(d, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_PARSE(decl)
|
||||
|
||||
// Discard `d`.
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_BOOL_PARSE_(d, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_PARSE(decl)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Implementation: old-of assertions are first parsed as boolean assertions and
|
||||
// then replaced as old-of assertions by the overall assertions parsing alg.
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_D(d, decl) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_NAMESPACE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_NAMESPACE_PARSE_ \
|
||||
, BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_IS_USING_(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_USING_PARSE_ \
|
||||
, BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_TYPEDEF_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_PARSE_D \
|
||||
, BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_RETURN_BACK(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_PARSE_D \
|
||||
, BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_CONST_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_PARSE_D \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_BOOL_PARSE_ \
|
||||
)))))(d, decl)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_AUX_INDEX_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_AUX_INDEX_HPP_
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_AUX_KIND_INDEX 0
|
||||
|
||||
// All indexes below start from 1 (0 taken by kind, common to all assertions).
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_AUX_EXPR_INDEX 1
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_AUX_CAPTURES_INDEX 1
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_AUX_EXPR_INDEX 2
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_AUX_TYPE_INDEX 1
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_AUX_ASSIGN_INDEX 2
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_AUX_EXPR_INDEX 1
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_AUX_TYPE_INDEX 2
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_AUX_ASSIGN_INDEX 3
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_AUX_NEW_NAME_INDEX 1
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_AUX_NAME_INDEX 2
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_AUX_TEMPLATE_PARAMS_INDEX 1
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_AUX_NAMESPACE_INDEX 2
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_AUX_NEW_NAME_INDEX 3
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_AUX_NAME_INDEX 4
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_AUX_NAME_INDEX 1
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_AUX_NEW_NAME_INDEX 2
|
||||
|
||||
#endif // #include gurad
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/bool/expr.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/kind.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_DONE_(decl_traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_DONE( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `...` (includes `(,,,)`, `bool(,,,)`, etc.).
|
||||
#define BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_PARSE(decl) \
|
||||
BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_DONE_( \
|
||||
BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_EXPR_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_SET_KIND_PARSE(bool, \
|
||||
(decl BOOST_PP_NIL, BOOST_CONTRACT_EXT_PP_TRAITS_INIT) \
|
||||
)))
|
||||
|
||||
// ASSERTION_TRAITS_KIND(traits) expands to `bool` for this assertion.
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_EXPR_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_EXPR_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/aux_/index.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `... NIL`.
|
||||
#define BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_EXPR_PARSE_ARGS_( \
|
||||
decl, traits) \
|
||||
( \
|
||||
BOOST_PP_NIL, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_CONTRACT_EXT_PP_NIL_REMOVE_BACK(decl)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_EXPR_PARSE(decl_traits) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_EXPR_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
// Expand to `...` (tokens).
|
||||
#define BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_EXPR(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_AUX_EXPR_INDEX, traits)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/const/expr.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/const/captures.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/kind.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_DONE_(decl_traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_DONE( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `const( [[(wrapped-type)] name, ...] ) expr`.
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_PARSE_D(d, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_DONE_( \
|
||||
BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_EXPR_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_CAPTURES_PARSE_D(d, \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_SET_KIND_PARSE(const, \
|
||||
(decl BOOST_PP_NIL, BOOST_CONTRACT_EXT_PP_TRAITS_INIT) \
|
||||
))))
|
||||
|
||||
// ASSERTION_TRAITS_KIND(traits) expands to `const` for this assertion.
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
58
include/boost/contract/ext_/preprocessor/traits/assertion/const/captures.hpp
Executable file
58
include/boost/contract/ext_/preprocessor/traits/assertion/const/captures.hpp
Executable file
@@ -0,0 +1,58 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_CAPTURES_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_CAPTURES_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/captures.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Extra level of indirection needed for proper macro expansion (on MSVC).
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_PARAMS_EXPAND_TRAITS_( \
|
||||
decl_traits) \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits)
|
||||
|
||||
// Precondition: decl = `( ,,, ) ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_CAPTURES_( \
|
||||
d, decl, traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_EAT(0) decl, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_PARAMS_EXPAND_TRAITS_(\
|
||||
BOOST_CONTRACT_EXT_PP_CAPTURES_TRAITS_PARSE_D(d, \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_VARIADIC_TO_SEQ \
|
||||
BOOST_CONTRACT_EXT_PP_PAREN_FRONT(decl) \
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
// Precondition: decl = `const( ,,, ) ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_CAPTURES_PARSE_ARGS_( \
|
||||
d, decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_CAPTURES_(d, \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_CONST_REMOVE_FRONT(decl), \
|
||||
traits \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_CAPTURES_PARSE_D( \
|
||||
d, decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_CAPTURES_PARSE_ARGS_(d, \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits) \
|
||||
)
|
||||
|
||||
// Expand to `pp-seq | EMPTY()`, pp-seq of capture traits to be inspected via
|
||||
// PP_CAPTURE_TRAITS macros.
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_CAPTURES(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_AUX_CAPTURES_INDEX, \
|
||||
traits \
|
||||
)
|
||||
|
||||
#endif // #include gaurd
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_EXPR_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_EXPR_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/aux_/index.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `... NIL`.
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_EXPR_PARSE_ARGS_( \
|
||||
decl, traits) \
|
||||
( \
|
||||
BOOST_PP_NIL, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_CONTRACT_EXT_PP_NIL_REMOVE_BACK(decl)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_EXPR_PARSE(decl_traits) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_EXPR_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
// Expand to `expr` (expr might or not be in parenthesis, like all bool expr).
|
||||
#define BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_EXPR(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_CONST_ASSERTION_TRAITS_AUX_EXPR_INDEX, traits)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_ASSERTION_KIND_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_KIND_HPP_
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_SET_KIND_PARSE( \
|
||||
kind, decl_traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits), kind) \
|
||||
)
|
||||
|
||||
// Expand to `namespace | using | typedef | return | ...oldof... | bool |
|
||||
// const | if | static if` related assertion traits to be inspected with
|
||||
// NAMESPACE_ASSERTION_TRAITS, USING_ASSERTION_TRAITS, etc. macros.
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_KIND(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_AUX_KIND_INDEX, traits)
|
||||
|
||||
#endif // #incldue guard
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/namespace/name.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/namespace/new_name.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/kind.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_DONE_(decl_traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_DONE( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `namespace (new-name) as name`.
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_PARSE(decl) \
|
||||
BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_DONE_( \
|
||||
BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_NAME_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_NEW_NAME_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_SET_KIND_PARSE(namespace, \
|
||||
(decl BOOST_PP_NIL, BOOST_CONTRACT_EXT_PP_TRAITS_INIT) \
|
||||
))))
|
||||
|
||||
// ASSERTION_TRAITS_KIND(traits) expands to `namespace` for this assertion.
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_NAME_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_NAME_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `name NIL`.
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_NAME_PARSE_ARGS_( \
|
||||
decl, traits) \
|
||||
( \
|
||||
BOOST_PP_NIL, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_CONTRACT_EXT_PP_NIL_REMOVE_BACK(decl)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_NAME_PARSE( \
|
||||
decl_traits) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_NAME_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
// Expand to `name`.
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_NAME(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_AUX_NAME_INDEX, \
|
||||
traits \
|
||||
)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_NEW_NAME_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_NEW_NAME_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/keyword/contract/as.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `(new-name) as ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_NEW_NAME_( \
|
||||
decl, traits) \
|
||||
( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_AS_REMOVE_FRONT(BOOST_PP_TUPLE_EAT(1) \
|
||||
decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
BOOST_PP_TUPLE_REM_CTOR(1, \
|
||||
BOOST_CONTRACT_EXT_PP_PAREN_FRONT(decl)) \
|
||||
) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `namespace (new-name) as ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_NEW_NAME_PARSE( \
|
||||
decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_NEW_NAME_( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_NAMESPACE_REMOVE_FRONT( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits)), \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits) \
|
||||
)
|
||||
|
||||
// Expand to `new-name`.
|
||||
#define BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_NEW_NAME(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_NAMESPACE_ASSERTION_TRAITS_AUX_NEW_NAME_INDEX, \
|
||||
traits \
|
||||
)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/oldof.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/oldof/assign.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/oldof/type.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/oldof/expr.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/bool/expr.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_DONE_(decl_traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_DONE( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: oldofdecl_booltraits =
|
||||
// `(OLDOF expr, (bool) (auto-wrapped-type assign =)` (which is here transformed
|
||||
// to the parsalbe decl = `(OLDOF expr) auto-wrapped-type assign =`).
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_REPLACE_PARSE_D( \
|
||||
d, oldofdecl_booltraits) \
|
||||
BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_DONE_( \
|
||||
BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_ASSIGN_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_TYPE_PARSE_D(d, \
|
||||
BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_EXPR_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_SET_KIND_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_OLDOF, \
|
||||
( \
|
||||
(BOOST_PP_TUPLE_ELEM(2, 0, oldofdecl_booltraits)) \
|
||||
BOOST_CONTRACT_EXT_PP_BOOL_ASSERTION_TRAITS_EXPR( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, oldofdecl_booltraits)) \
|
||||
BOOST_PP_NIL, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_INIT \
|
||||
) \
|
||||
)))))
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_ASSIGN_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_ASSIGN_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `name = NIL`.
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_ASSIGN_PARSE_ARGS_( \
|
||||
decl, traits) \
|
||||
( \
|
||||
BOOST_PP_NIL, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_CONTRACT_EXT_PP_NIL_REMOVE_BACK(decl)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_ASSIGN_PARSE( \
|
||||
decl_traits) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_ASSIGN_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
// Expand to `name = ` (note trailing `=` that cannot be removed via pp).
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_ASSIGN(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_AUX_ASSIGN_INDEX, \
|
||||
traits \
|
||||
)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_EXPR_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_EXPR_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `(OLDOF expr) ...`
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_EXPR_PARSE_ARGS_( \
|
||||
decl, traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_EAT(1) decl, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_OLDOF_REMOVE_FRONT( \
|
||||
BOOST_PP_TUPLE_REM_CTOR( \
|
||||
1, BOOST_CONTRACT_EXT_PP_PAREN_FRONT(decl) \
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_EXPR_PARSE(decl_traits) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_EXPR_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
// Expand to `...` (tokens).
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_EXPR(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_AUX_EXPR_INDEX, traits)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TYPE_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TYPE_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// TODO: This pattern seems to be used a lot... maybe commonize it into some
|
||||
// utility/* (something like DECL_TRAITS_PUSH_FRONT(decl_trait, traits) -->
|
||||
// `(decl, push_back(traits, trait))`.
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_TYPE_( \
|
||||
decl_type, traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_type), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_type)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `{auto | wrapped-type} ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_TYPE_PARSE_D(d, \
|
||||
decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_TYPE_( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_AUTO_TYPE_PARSE_D(d, \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits)), \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits) \
|
||||
)
|
||||
|
||||
// Expand to `auto | (type,,,)`.
|
||||
#define BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_TYPE(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_AUX_TYPE_INDEX, \
|
||||
traits \
|
||||
)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/return/assign.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/return/type.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/kind.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_DONE_(decl_traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_DONE( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `typedef wrapped-type new-name`.
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_PARSE_D(d, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_DONE_( \
|
||||
BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_ASSIGN_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_TYPE_PARSE_D(d, \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_SET_KIND_PARSE(return, \
|
||||
(decl BOOST_PP_NIL, BOOST_CONTRACT_EXT_PP_TRAITS_INIT) \
|
||||
))))
|
||||
|
||||
// ASSERTION_TRAITS_KIND(traits) expands to `return` for this assertion.
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_ASSIGN_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_ASSIGN_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `name = return NIL`.
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_ASSIGN_PARSE_ARGS_( \
|
||||
decl, traits) \
|
||||
( \
|
||||
BOOST_PP_NIL, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_RETURN_REMOVE_BACK( \
|
||||
BOOST_CONTRACT_EXT_PP_NIL_REMOVE_BACK( \
|
||||
decl \
|
||||
)) \
|
||||
) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_ASSIGN_PARSE( \
|
||||
decl_traits) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_ASSIGN_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
// Expand to `name =` (note trailing `=` that cannot be removed via pp).
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_ASSIGN(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_AUX_ASSIGN_INDEX, \
|
||||
traits \
|
||||
)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TYPE_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TYPE_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_TYPE_( \
|
||||
decl_type, traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_type), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_type)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `{auto | wrapped-type} ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_TYPE_PARSE_D(d, \
|
||||
decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_TYPE_( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_AUTO_TYPE_PARSE_D(d, \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits)), \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits) \
|
||||
)
|
||||
|
||||
// Expand to `auto | (type,,,)`.
|
||||
#define BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_TYPE(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_RETURN_ASSERTION_TRAITS_AUX_TYPE_INDEX, \
|
||||
traits \
|
||||
)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/typedef/new_name.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/typedef/name.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/kind.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_DONE_(decl_traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_DONE( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// TODO: I cannot keep repeating this DONE macro everywhere... in
|
||||
// utility/adt.hpp (rename it back to that from traits.hpp) provide INIT and
|
||||
// DONE macros that do not alter decl but INIT and DONE traits:
|
||||
// #define DECL_TRAITS_INIT(decl) (decl, TRAITS_INIT)
|
||||
// #define DECL_TRAITS_DONE(decl_traits) (decl, TRAITS_DONE(traits))
|
||||
// Then ideally, I'd remove TRAITS_INIT/DONE and always force the user to use
|
||||
// DECL_TRAITS_INIT/DONE... but can I do this?
|
||||
|
||||
// Precondition: decl = `typedef wrapped-type new-name`.
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_PARSE_D(d, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_DONE_( \
|
||||
BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_NEW_NAME_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_NAME_PARSE_D(d, \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_SET_KIND_PARSE(typedef, \
|
||||
(decl BOOST_PP_NIL, BOOST_CONTRACT_EXT_PP_TRAITS_INIT) \
|
||||
))))
|
||||
|
||||
// ASSERTION_TRAITS_KIND(traits) expands to `typedef` for this assertion.
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_NAME_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_NAME_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_NAME_( \
|
||||
decl_type, traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_type), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_type)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `typedef wrapped-type ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_NAME_PARSE_D(d, \
|
||||
decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_NAME_( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_PARSE_D(d, \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_TYPEDEF_REMOVE_FRONT( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits) \
|
||||
) \
|
||||
), \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits) \
|
||||
)
|
||||
|
||||
// Expand to `(type,,,)`.
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_NAME(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_AUX_NAME_INDEX, \
|
||||
traits \
|
||||
)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_NEW_NAME_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_NEW_NAME_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `name NIL`.
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_NEW_NAME_PARSE_ARGS_( \
|
||||
decl, traits) \
|
||||
( \
|
||||
BOOST_PP_NIL, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_CONTRACT_EXT_PP_NIL_REMOVE_BACK(decl)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_NEW_NAME_PARSE( \
|
||||
decl_traits) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_NEW_NAME_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
// Expand to `new-name`.
|
||||
#define BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_NEW_NAME(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_TYPEDEF_ASSERTION_TRAITS_AUX_NEW_NAME_INDEX, \
|
||||
traits \
|
||||
)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/using/name.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/using/new_name.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/using/namespace.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/using/template_params.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/kind.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_DONE_(decl_traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_DONE( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `[template( c++-template-parameter, ... )]
|
||||
// using [namespace | (new-name) as] wrapped-name`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_PARSE(decl) \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_DONE_( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAME_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NEW_NAME_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAMESPACE_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_SET_KIND_PARSE(using, \
|
||||
(decl BOOST_PP_NIL, BOOST_CONTRACT_EXT_PP_TRAITS_INIT) \
|
||||
))))))
|
||||
|
||||
// ASSERTION_TRAITS_KIND(traits) expands to `using` for this assertion.
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_USING_ASSERTION_NAME_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_NAME_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: name = `name | (name)`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAME_(\
|
||||
name, traits) \
|
||||
( \
|
||||
BOOST_PP_NIL, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_HAS_PAREN(name), \
|
||||
name \
|
||||
, \
|
||||
(name) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
// Precondition: decl = `name NIL`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAME_PARSE_ARGS_(\
|
||||
decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAME_( \
|
||||
BOOST_CONTRACT_EXT_PP_NIL_REMOVE_BACK(decl), traits)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAME_PARSE( \
|
||||
decl_traits) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAME_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
// Expand to `(name,,,)` (this name is wrapped within parenthesis because in
|
||||
// general it can contain commas, for example for template aliases).
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAME(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_AUX_NAME_INDEX, \
|
||||
traits \
|
||||
)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAMESPACE_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAMESPACE_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `namespace ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAMESPACE_YES_( \
|
||||
decl, traits) \
|
||||
( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_NAMESPACE_REMOVE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
namespace BOOST_PP_EMPTY) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAMESPACE_NO_( \
|
||||
decl, traits) \
|
||||
(decl, BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, BOOST_PP_EMPTY))
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAMESPACE_PARSE_ARGS_( \
|
||||
decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_NAMESPACE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAMESPACE_YES_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAMESPACE_NO_ \
|
||||
)(decl, traits)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAMESPACE_PARSE( \
|
||||
decl_traits) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAMESPACE_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
// Expand to `namespace | EMPTY()`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NAMESPACE(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_AUX_NAMESPACE_INDEX,\
|
||||
traits \
|
||||
)()
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_USING_ASSERTION_NEW_NAME_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_NEW_NAME_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/keyword/contract/as.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = (new-name) as ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NEW_NAME_YES_( \
|
||||
decl, traits) \
|
||||
( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_AS_REMOVE_FRONT(BOOST_PP_TUPLE_EAT(1) \
|
||||
decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
BOOST_PP_TUPLE_REM_CTOR(1, \
|
||||
BOOST_CONTRACT_EXT_PP_PAREN_FRONT(decl)) BOOST_PP_EMPTY \
|
||||
) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NEW_NAME_NO_( \
|
||||
decl, traits) \
|
||||
(decl, BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, BOOST_PP_EMPTY))
|
||||
|
||||
// Precondition: decl = `(,,,) ...` (in general there could be commas in leading
|
||||
// parenthesis if that is not a new-name).
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NEW_NAME_CHECK_( \
|
||||
decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_AS_FRONT( \
|
||||
BOOST_PP_TUPLE_EAT(0) decl), \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NEW_NAME_YES_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NEW_NAME_NO_ \
|
||||
)(decl, traits)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NEW_NAME_PARSE_ARGS_(\
|
||||
decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_HAS_PAREN(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NEW_NAME_CHECK_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NEW_NAME_NO_ \
|
||||
)(decl, traits)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NEW_NAME_PARSE( \
|
||||
decl_traits) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NEW_NAME_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
// Expand to `new-name | EMPTY()`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_NEW_NAME(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_AUX_NEW_NAME_INDEX, \
|
||||
traits \
|
||||
)()
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: decl = `( c++-template-parameter, ... ) using ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS_( \
|
||||
decl, traits) \
|
||||
( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_USING_REMOVE_FRONT( \
|
||||
BOOST_PP_TUPLE_EAT(0) decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_CONTRACT_EXT_PP_PAREN_FRONT(decl) BOOST_PP_EMPTY) \
|
||||
)
|
||||
|
||||
// Precondition: decl = `template( c++-template-parameter, ... ) using ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS_YES_( \
|
||||
decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS_( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_TEMPLATE_REMOVE_FRONT(decl), traits)
|
||||
|
||||
// Precondition: decl = `using ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS_NO_( \
|
||||
decl, traits) \
|
||||
( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_USING_REMOVE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, BOOST_PP_EMPTY) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS_ARGS_( \
|
||||
decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_TEMPLATE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS_YES_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS_NO_ \
|
||||
)(decl, traits)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `[template(,,,)] using ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS_PARSE( \
|
||||
decl_traits) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
// Expand to `(c++-template-parameters,,,) | EMPTY()`.
|
||||
#define BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_TEMPLATE_PARAMS(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_USING_ASSERTION_TRAITS_AUX_TEMPLATE_PARAMS_INDEX,\
|
||||
traits \
|
||||
)()
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
120
include/boost/contract/ext_/preprocessor/traits/assertions.hpp
Normal file
120
include/boost/contract/ext_/preprocessor/traits/assertions.hpp
Normal file
@@ -0,0 +1,120 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertion/oldof.hpp>
|
||||
|
||||
// TODO: Try to commonize this and params.hpp (if at all possible).
|
||||
|
||||
|
||||
// TODO: I should try to find a pattern for macro expansion that reliably works
|
||||
// on MSVC (and GCC, and CLang). Try to wrap all the IF construct below with
|
||||
// EXPAND but they look like they require a double expansion: 1st expansion to
|
||||
// the macro to execute, and 2nd expansion to execute it.
|
||||
// In theory instead, constructs like `M args` do not need EXPAND because they
|
||||
// do not require a double expansion. Maybe, after EXPAND is added to all
|
||||
// `IF(cond, M1, M2)(args)` then EXPAND will not longer be needed by `M args`,
|
||||
// so try to remove EXPAND for `M args` then.
|
||||
|
||||
// TODO: Do I really need those? Decide that *after* I fix all EXPANDs.
|
||||
|
||||
//#define BOOST_CONTRACT_EXT_PP_EXPAND_ONCE(tokens) tokens
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_DECL_TRAITS_SECOND_(decl, traits) traits
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_DECL_TRAITS_SECOND(decl_traits) \
|
||||
BOOST_PP_EXPAND(BOOST_CONTRACT_EXT_PP_DECL_TRAITS_SECOND_ decl_traits)
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_REPLACE_OLDOF_( \
|
||||
d, decl_seq, traits) \
|
||||
( \
|
||||
BOOST_PP_SEQ_TAIL(decl_seq), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_POP_BACK(traits), \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, \
|
||||
BOOST_CONTRACT_EXT_PP_OLDOF_ASSERTION_TRAITS_REPLACE_PARSE_D( \
|
||||
d, \
|
||||
( \
|
||||
BOOST_PP_SEQ_HEAD(decl_seq), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_BACK(traits) \
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_PUSH_BACK_ASSERTION_( \
|
||||
d, decl_seq, traits) \
|
||||
( \
|
||||
BOOST_PP_SEQ_TAIL(decl_seq), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
BOOST_CONTRACT_EXT_PP_DECL_TRAITS_SECOND( \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTION_TRAITS_D(d, \
|
||||
BOOST_PP_SEQ_HEAD(decl_seq) \
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_OP_ARGS_(d, decl_seq, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_TRAITS_IS_OLDOF_FRONT( \
|
||||
BOOST_PP_SEQ_HEAD(decl_seq)), \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_REPLACE_OLDOF_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_PUSH_BACK_ASSERTION_ \
|
||||
)(d, decl_seq, traits)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_OP_(d, decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_OP_ARGS_(d, \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_PRED_(d, decl_traits) \
|
||||
BOOST_PP_NOT_EQUAL(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM( \
|
||||
2, 0, decl_traits)), 1)
|
||||
|
||||
// Implementation: SEQ_POP_BACK removes trailing NIL just added below.
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_RETURN_(decl_traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_DONE(BOOST_PP_TUPLE_ELEM(2, 1, \
|
||||
decl_traits)) \
|
||||
)
|
||||
|
||||
// TODO: If all assertions, params, tparams, etc use the WHILE to iterate the
|
||||
// entire decl_seq then SEQ_FOLD_LEFT could be used instead. Otherwise, use
|
||||
// WHILE here because more generic anyway so this lib uses _D while users can
|
||||
// use SEQ_FOLD_LEFT and other SEQ alg with all their _S, _Z, etc iterations.
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_(d, decl_seq) \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_RETURN_( \
|
||||
BOOST_PP_WHILE_ ## d( \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_PRED_, \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_OP_, \
|
||||
( \
|
||||
decl_seq (BOOST_PP_NIL), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_INIT \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Expand decl_seq = `(assrtion1)...(assertion-n)` to pp-seq of assertion
|
||||
// traits, otherwise expand decl_seq = `EMPTY()` to EMPTY().
|
||||
// NOTE: Variadic assertion enum. `( ) | ( assertion1, ..., assertion-n[,] )`
|
||||
// can be transformed to EMPTY() or pp-seq using EXT_PP_VARIADIC_ENUM_TO_SEQ.
|
||||
#define BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_PARSE_D(d, decl_seq) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_IS_EMPTY(decl_seq), \
|
||||
((BOOST_PP_NIL), BOOST_PP_EMPTY) BOOST_PP_TUPLE_EAT(2) \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_ \
|
||||
)(d, decl_seq)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
28
include/boost/contract/ext_/preprocessor/traits/capture.hpp
Normal file
28
include/boost/contract/ext_/preprocessor/traits/capture.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/capture/name.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/capture/type.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_DONE_(decl_traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_DONE( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits)) \
|
||||
)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: decl = `[wrapped-type] name`.
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_PARSE_D(d, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_DONE_( \
|
||||
BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_NAME_PARSE( \
|
||||
BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_TYPE_PARSE_D(d, \
|
||||
(decl BOOST_PP_NIL, BOOST_CONTRACT_EXT_PP_TRAITS_INIT) \
|
||||
)))
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_AUX_INDEX_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_AUX_INDEX_HPP_
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_AUX_TYPE_INDEX 0
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_AUX_NAME_INDEX 1
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_NAME_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_NAME_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/capture/aux_/index.hpp>
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: name must always be the last remaining token in decl.
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_NAME_PARSE(decl_traits) \
|
||||
( \
|
||||
BOOST_PP_NIL, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits), \
|
||||
BOOST_CONTRACT_EXT_PP_NIL_REMOVE_BACK( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits)) \
|
||||
) \
|
||||
)
|
||||
|
||||
// Expand to `[...] name | EMPTY()` (ellipses `...` for variadic templates).
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_NAME(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_AUX_NAME_INDEX, traits)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_TYPE_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP__TRAITS_TYPE_HPP_
|
||||
|
||||
// TODO: Fix all #include for all files.
|
||||
#include <boost/contract/ext_/preprocessor/traits/capture/aux_/index.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_TYPE_YES_(decl_type, traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_type), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_type) BOOST_PP_EMPTY) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_TYPE_NO_(decl_type, traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_type), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, BOOST_PP_EMPTY) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_TYPE_(decl_type, traits) \
|
||||
BOOST_PP_IIF(BOOST_PP_EXPAND(BOOST_CONTRACT_EXT_PP_IS_EMPTY \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_type)), \
|
||||
BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_TYPE_NO_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_TYPE_YES_ \
|
||||
)(decl_type, traits)
|
||||
|
||||
// Precondition: decl = `[wrapped-type] ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_TYPE_PARSE_ARGS_(d, decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_TYPE_( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_PARSE_D(d, decl), traits)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_TYPE_PARSE_D(d, decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_TYPE_PARSE_ARGS_(d, \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits) \
|
||||
)
|
||||
|
||||
// Expand to `(,,,) | EMPTY()`.
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_TYPE(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_AUX_TYPE_INDEX, traits)()
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
25
include/boost/contract/ext_/preprocessor/traits/captures.hpp
Normal file
25
include/boost/contract/ext_/preprocessor/traits/captures.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_CAPTURES_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURES_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/capture.hpp>
|
||||
|
||||
// TODO: It should be possible to commonize this with params, tparams,
|
||||
// assertions, etc. (but make default also optional in the params alg with an
|
||||
// additional allow_default arg). Also after that commonization, some of these
|
||||
// params.hpp, assertions.hpp, captures.hpp files might became pointless and
|
||||
// do essentially nothing so they could be removed (it'd make sense to leave
|
||||
// instead param.hpp as entry of param/*, etc like func.hpp is the entry of
|
||||
// func/*, just the param*S*.hpp can be remove, but func/params.hpp will also be
|
||||
// kept).
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_CAPTURES_TRAITS_PARSE_D(d, decl_seq) \
|
||||
BOOST_CONTRACT_EXT_PP_PARAMS_TRAITS_PARSE_(d, 0, decl_seq, \
|
||||
BOOST_CONTRACT_EXT_PP_CAPTURE_TRAITS_PARSE_D, \
|
||||
todo_remove_this_param_from_params_parse_alg \
|
||||
)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/verbatim.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/access.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
@@ -31,11 +31,13 @@
|
||||
#if defined(BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_AUX_INDEX_TEST) && \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_AUX_INDEX_TEST < \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_AUX_POSTCONDITION_INDEX
|
||||
# define BOOST_CONTRACT_EXT_PP_TRAITS_FUNC_POSTCONDITION_PARSE_(decl_traits) \
|
||||
# define BOOST_CONTRACT_EXT_PP_TRAITS_FUNC_POSTCONDITION_PARSE_D( \
|
||||
d, decl_traits) \
|
||||
decl_traits
|
||||
#else
|
||||
# define BOOST_CONTRACT_EXT_PP_TRAITS_FUNC_POSTCONDITION_PARSE_(decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_PARSE(decl_traits)
|
||||
# define BOOST_CONTRACT_EXT_PP_TRAITS_FUNC_POSTCONDITION_PARSE_( \
|
||||
d, decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_PARSE_D(d, decl_traits)
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_AUX_INDEX_TEST) && \
|
||||
@@ -195,7 +197,7 @@
|
||||
// Implementation: These macros order must match INDEX values (see index.hpp).
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_PARSE_D(d, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_FUNC_DONE_( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_FUNC_POSTCONDITION_PARSE_( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_FUNC_POSTCONDITION_PARSE_(d, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_FUNC_VIRT_PARSE_( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_FUNC_TRAILING_RETURN_PARSE_(d, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_FUNC_EXCEPT_PARSE_( \
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/keyword.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/public.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/protected.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/private.hpp>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_CLASSIFIERS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/inline.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/static.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/extern.hpp>
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <boost/contract/ext_/preprocessor/keyword/virtual.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/friend.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/inline.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/expand.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/tuple/rem.hpp>
|
||||
#include <boost/preprocessor/control/while.hpp>
|
||||
@@ -20,6 +19,7 @@
|
||||
#include <boost/preprocessor/logical/bitand.hpp>
|
||||
#include <boost/preprocessor/logical/compl.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/preprocessor/facilities/expand.hpp>
|
||||
|
||||
// Function classifiers `inline static extern explicit virtual friend` can
|
||||
// appear in any general order (so they are parsed all together here).
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_CLASSIFIERS_OP_ARGS_(continue_, \
|
||||
decl, inline_, static_, extern_, explicit_, virtual_, friend_) \
|
||||
BOOST_CONTRACT_EXT_PP_EXPAND_ONCE( \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_CLASSIFIERS_ \
|
||||
BOOST_PP_IIF(BOOST_PP_BITAND(BOOST_PP_COMPL(inline_), \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_IS_INLINE_FRONT(decl)), \
|
||||
@@ -70,10 +70,8 @@
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_CLASSIFIERS_OP_( \
|
||||
d, continue_decl_inline_static_extern_explicit_virtual_friend) \
|
||||
BOOST_CONTRACT_EXT_PP_EXPAND_ONCE( \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_CLASSIFIERS_OP_ARGS_ \
|
||||
continue_decl_inline_static_extern_explicit_virtual_friend \
|
||||
)
|
||||
BOOST_PP_EXPAND(BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_CLASSIFIERS_OP_ARGS_ \
|
||||
continue_decl_inline_static_extern_explicit_virtual_friend)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_CLASSIFIERS_PRED_( \
|
||||
d, continue_decl_inline_static_extern_explicit_virtual_friend) \
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/keyword_comb.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/const.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/volatile.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_EXCEPT_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_EXCEPT_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/keyword_paren.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/noexcept.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/throw.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/expand.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/preprocessor/facilities/expand.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
@@ -59,8 +59,8 @@
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_EXCEPT_PARSE(decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_EXPAND_ONCE( \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_EXCEPT_PARSE_ARGS_ decl_traits)
|
||||
BOOST_PP_EXPAND(BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_EXCEPT_PARSE_ARGS_ \
|
||||
decl_traits)
|
||||
|
||||
// Expand to `noexcept | noexcept(,,,) | throw(,,,) | EMPTY()`.
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_EXCEPT(traits) \
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/keyword.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/export.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/expand.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
|
||||
// NOTE: The `export` keyword for templates was deprecated in C++11 but it is
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/type.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/operator.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/new.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/delete.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/paren/front.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/paren/has.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/expand.hpp>
|
||||
#include <boost/preprocessor/seq/cat.hpp>
|
||||
#include <boost/preprocessor/seq/for_each.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/params.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/variadic/to_seq.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/paren/front.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
@@ -12,15 +12,14 @@
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Level of indirection needed for proper macro expansion (on MSVC).
|
||||
// Extra level of indirection needed for proper macro expansion (on MSVC).
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_PARAMS_EXPAND_TRAITS_(decl_traits) \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits)
|
||||
|
||||
// Precondition: decl = `(,,,) ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_PARAMS_PARSE_ARGS_(d, decl, traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_EAT(0) decl \
|
||||
, \
|
||||
BOOST_PP_TUPLE_EAT(0) decl, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_PARAMS_EXPAND_TRAITS_( \
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/aliases.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/contract/postcondition.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/variadic/enum_to_seq.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// TODO: Thinks how to commonize this code with precondition() and template()
|
||||
// (maybe just use keyword_paren for all of them...).
|
||||
|
||||
// TODO: If assertions need to be parsed as seq for consistency parse params
|
||||
// as seq too. Then these PARSE macros can work on an arg named decl_seq
|
||||
// instead of just decl. Shall all the PARSE macro take decl_traits (the called
|
||||
// can pass TRAITS_INIT to FUNC_TRAITS_PARSE, etc)?
|
||||
|
||||
// TODO: All macros that return decl_traits should be named PARSE, and probably
|
||||
// they should all do that (not just FUNC_TRAITS, but FUNC_TRAITS_PARSE with
|
||||
// decl != EMPTY() in case of error, and same for params, etc).
|
||||
|
||||
// Precondition: decl = `(,,,) ...` from `postcondition(,,,) ...` originally in
|
||||
// decl. This macro will also parse `(,,,)` into a pp-seq of assertion traits.
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_(decl, traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_EAT(0) decl, \
|
||||
BOOST_CONTRACT_EXT_PP_ALIASES_TRAITS_PARSE( \
|
||||
( \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_SEQ_FROM_ENUM \
|
||||
BOOST_CONTRACT_EXT_PP_PAREN_FRONT(decl) \
|
||||
), \
|
||||
traits \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
// Precondition: decl = `postcondition(,,,) ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_YES_(decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_POSTCONDITION_REMOVE_FRONT(decl), \
|
||||
traits \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_NO_(decl, traits) \
|
||||
(decl, BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, BOOST_PP_NIL))
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_PARSE_ARGS_( \
|
||||
decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_POSTCONDITION_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_YES_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_NO_ \
|
||||
)(decl, traits)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_PARSE(decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_EXPAND_ONCE( \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/assertions.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/contract/postcondition.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/variadic/enum_to_seq.hpp>
|
||||
|
||||
// TODO: Rename this postcondition*S* (plural, like for params, etc). The same
|
||||
// applies to precondition*s*, class invariant*s*, etc (even if their keywords
|
||||
// are singular, the traits should be named plural because the expand to seq).
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// TODO: Thinks how to commonize this code with precondition() and template()
|
||||
// (maybe just use keyword_paren for all of them...).
|
||||
|
||||
// TODO: If all TO_SEQ can be called within the params, tparams, assertion, etc.
|
||||
// parsing macros, move those conversions there (so they are hidden to the
|
||||
// caller).
|
||||
|
||||
// Extra level of indirection needed for proper macro expansion (on MSVC).
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_EXPAND_TRAITS_( \
|
||||
decl_traits) \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits)
|
||||
|
||||
// Precondition: decl = `(,,,) ...` from `postcondition(,,,) ...` originally in
|
||||
// decl. This macro will also parse `(,,,)` into a pp-seq of assertion traits.
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_(d, decl, traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_EAT(0) decl, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_EXPAND_TRAITS_( \
|
||||
BOOST_CONTRACT_EXT_PP_ASSERTIONS_TRAITS_PARSE_D(d, \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_VARIADIC_ENUM_TO_SEQ \
|
||||
BOOST_CONTRACT_EXT_PP_PAREN_FRONT(decl) \
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
// Precondition: decl = `postcondition(,,,) ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_YES_(d, decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_(d, \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_POSTCONDITION_REMOVE_FRONT(decl), \
|
||||
traits \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_NO_( \
|
||||
unused, decl, traits) \
|
||||
(decl, BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, BOOST_PP_EMPTY))
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_PARSE_ARGS_( \
|
||||
d, decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_POSTCONDITION_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_YES_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_NO_ \
|
||||
)(d, decl, traits)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_PARSE_D( \
|
||||
d, decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION_PARSE_ARGS_(d, \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits) \
|
||||
)
|
||||
|
||||
// Expand to pp-seq of postcondition assertion traits to be inspected via
|
||||
// ASSERTION_TRAITS macro, or to EMPTY() if no postconditions.
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITION(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_AUX_POSTCONDITIONS_INDEX, traits \
|
||||
)()
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -4,38 +4,58 @@
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/keyword.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/contract/ref.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/contract/refref.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/preprocessor/facilities/expand.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Precondition: access = `[keyword] EMPTY` (so trailing EMPTY already there).
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_(decl_ref, traits) \
|
||||
// Precondition: decl = `ref ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_REF_YES_(decl, traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_ref), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_ref)) \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_REF_REMOVE_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, ref ref BOOST_PP_EMPTY) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_REF_NO_(decl, traits) \
|
||||
( \
|
||||
decl, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, ref BOOST_PP_EMPTY) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_NO_(decl, traits) \
|
||||
( \
|
||||
decl, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, BOOST_PP_EMPTY) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_REF_(decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_REF_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_REF_YES_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_REF_NO_ \
|
||||
)(decl, traits)
|
||||
|
||||
// Precondition: decl = `ref ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_YES_(decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_REF_( \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_REF_REMOVE_FRONT(decl), traits)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_PARSE_ARGS_(decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_REF_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_YES_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_NO_ \
|
||||
)(decl, traits)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_PARSE(decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_KEYWORD2_PARSE( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_traits), \
|
||||
ref, \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_IS_REF_FRONT, \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_REF_REMOVE_FRONT, \
|
||||
refref, \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_IS_REFREF_FRONT, \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_REFREF_REMOVE_FRONT \
|
||||
), \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits) \
|
||||
)
|
||||
BOOST_PP_EXPAND(BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF_PARSE_ARGS_ \
|
||||
decl_traits)
|
||||
|
||||
// Expand to `ref | refref | EMPTY()` (ref for lvalue &, refref for rvalue &&).
|
||||
// Expand to `ref | ref ref | EMPTY()` (ref for lvalue&, ref ref for rvalue&&).
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_REF(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_AUX_REF_INDEX, traits)()
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/type.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/return.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/operator.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/paren/has.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/expand.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
@@ -55,7 +54,7 @@
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_RETURN_YES_(d, decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_RETURN_( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_PARSE_D(d, decl), traits)
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_AUTO_TYPE_PARSE_D(d, decl), traits)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_RETURN_PARSE_ARGS_(d, decl, traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_HAS_RETURN_(decl), \
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/params.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/template.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/variadic/to_seq.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/paren/front.hpp>
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Level of indirection needed for proper macro expansion (on MSVC).
|
||||
// Extra level of indirection needed for proper macro expansion (on MSVC).
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_TEMPLATE_EXPAND_TRAITS_(decl_traits) \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_traits)
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_TEMPLATE_(d, \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_TEMPLATE_REMOVE_FRONT(decl), traits)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_TEMPLATE_NO_(d, decl, traits) \
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_TEMPLATE_NO_(unused, decl, traits) \
|
||||
( \
|
||||
decl, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/keyword_paren.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/contract/verbatim.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/keyword_comb.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/final.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/override.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
|
||||
31
include/boost/contract/ext_/preprocessor/traits/oldof.hpp
Normal file
31
include/boost/contract/ext_/preprocessor/traits/oldof.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_TRAITS_OLDOF_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_OLDOF_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
// Must expand to a single comma `,` (not local macros, do not #undefine).
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_OLDOF_CAT_TO_COMMABOOST_CONTRACT_EXT_PP_TRAITS_OLDOF ,
|
||||
// Must expand to empty `` (not local macros, do not #undefine).
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_OLDOF_CAT_TO_EMPTYBOOST_CONTRACT_EXT_PP_TRAITS_OLDOF
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: tokens must start with a token concatenable to a macro name
|
||||
// (e.g., a literal or integral token) or with parenthesis.
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_IS_OLDOF_FRONT(tokens) \
|
||||
BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_IS_FRONT( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_OLDOF_CAT_TO_COMMA, tokens)
|
||||
|
||||
// Precondition: tokens must start with `..._TRAITS_ODLOF` (this can be
|
||||
// checked with `..._TRAITS_IS_OLDOF_FRONT` macro above).
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_OLDOF_REMOVE_FRONT(tokens) \
|
||||
BOOST_PP_CAT(BOOST_CONTRACT_EXT_PP_TRAITS_OLDOF_CAT_TO_EMPTY, tokens)
|
||||
|
||||
// This is the operator that decl. syntax must use to prefix old-of expressions:
|
||||
// `{auto | wrapper-type} var = OLDOF_OPERATOR exr`.
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_OLDOF_OPERATOR \
|
||||
, BOOST_CONTRACT_EXT_PP_TRAITS_OLDOF
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_DEFAULT_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/param/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/default.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/preprocessor/facilities/expand.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
@@ -34,6 +35,10 @@
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// TODO: For consistency with all other PARSE macros, and REPLACE_PARSE below,
|
||||
// this should be called EMPTY_DEFAULT_PARSE, and the one below
|
||||
// REPLACE_DEFAULT_PARSE.
|
||||
|
||||
// Init. default argument to EMPTY without altering decl.
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_DEFAULT_PARSE_EMPTY(decl_traits) \
|
||||
( \
|
||||
@@ -45,7 +50,7 @@
|
||||
// Replace previously init. default argument with what's parsed from decl.
|
||||
// Precondition: decl = `default ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_DEFAULT_REPLACE_PARSE(decl_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_EXPAND_ONCE( \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_DEFAULT_REPLACE_PARSE_ARGS_ \
|
||||
decl_traits \
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_NAME_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/param/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
|
||||
@@ -4,20 +4,16 @@
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/param/aux_/index.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/type.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/typename.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/class.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/template.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/expand.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/tuple/rem.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
#include <boost/preprocessor/control/expr_iif.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
|
||||
// NOTE: This file contains macros for the type (or "kind") of both function
|
||||
// formal parameters and template parameters.
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_TEMPLATE_PARAM_TRAITS_TYPE_TEMPLATE_PUSH_BACK_( \
|
||||
@@ -67,14 +63,36 @@
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, typename) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_TYPE_(decl_type, traits) \
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_TYPE_PARSED_(decl_type, traits) \
|
||||
( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_type), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_type)) \
|
||||
)
|
||||
|
||||
// Precondition: decl = `wrapped-type`.
|
||||
// Precondition: Unable to parse type so assume decl = `type NIL` (i.e., the
|
||||
// non-keyword type was specified unwrapped). That is allowed only when no
|
||||
// parameter name is given so all tokens in decl are for the type and remaining
|
||||
// decl is set to NIL here (which will be parsed as no parameter name).
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_TYPE_NOT_PARSED_(decl_type, traits) \
|
||||
( \
|
||||
BOOST_PP_NIL, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK( \
|
||||
traits, \
|
||||
BOOST_CONTRACT_EXT_PP_NIL_REMOVE_BACK( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, decl_type)) \
|
||||
) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_TYPE_(decl_type, traits) \
|
||||
BOOST_PP_IIF(BOOST_PP_EXPAND(BOOST_CONTRACT_EXT_PP_IS_EMPTY \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, decl_type)), \
|
||||
BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_TYPE_NOT_PARSED_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_TYPE_PARSED_ \
|
||||
)(decl_type, traits)
|
||||
|
||||
// Precondition: decl = `wrapped-type ... | type`.
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_TYPE_PARSE_ARGS_(d, decl, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_PARAM_TRAITS_TYPE_( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_PARSE_D(d, decl), traits)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAMS_TRAITS_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/param.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/default.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/void.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/empty.hpp>
|
||||
@@ -57,8 +57,7 @@
|
||||
)(d, decl_seq, traits, param_parse_macro, default_replace_macro)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAMS_TRAITS_OP_(d, decl_traits_param_default) \
|
||||
BOOST_CONTRACT_EXT_PP_PARAMS_TRAITS_OP_ARGS_( \
|
||||
d, \
|
||||
BOOST_CONTRACT_EXT_PP_PARAMS_TRAITS_OP_ARGS_(d, \
|
||||
BOOST_PP_TUPLE_ELEM(4, 0, decl_traits_param_default), \
|
||||
BOOST_PP_TUPLE_ELEM(4, 1, decl_traits_param_default), \
|
||||
BOOST_PP_TUPLE_ELEM(4, 2, decl_traits_param_default), \
|
||||
@@ -67,8 +66,8 @@
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAMS_TRAITS_PRED_( \
|
||||
d, decl_traits_param_default) \
|
||||
BOOST_PP_NOT_EQUAL(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(4, 0, \
|
||||
decl_traits_param_default)), 1)
|
||||
BOOST_PP_NOT_EQUAL(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM( \
|
||||
4, 0, decl_traits_param_default)), 1)
|
||||
|
||||
// Trailing EMPTY to traits to handle EMPTY() parameters.
|
||||
#define BOOST_CONTRACT_EXT_PP_PARAMS_TRAITS_RETURN_(decl_traits_param_default) \
|
||||
@@ -121,6 +120,19 @@
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// TODO: Assuming all assertions can be parsed at once, then params, assertions,
|
||||
// etc. (all "collections") can be parsed efficiently also accepting them
|
||||
// as variadic tuples (,,,) instead of sequence and that would be preferred
|
||||
// because that is how they are specified in decl in the first place. Therefore,
|
||||
// if that is the case, change params, assertions, etc. APIs to take decl as
|
||||
// variadic tuples (,,,) instead of pp-seq ()().
|
||||
// Also, it that is the case, the params, assertions, etc. internal alg can
|
||||
// use SEQ_FOLD_LEFT_s instead of WHILE_d (but maybe we can leave the alg to
|
||||
// use WHILE_d because more generic in case the alg need to change their
|
||||
// exit condition PRED in the future and because code using these traits
|
||||
// macros will instead probably use SEQ_FOLD_LEFT_s and so we can leave all
|
||||
// s iteration values to the user while internal alg use d iteration values).
|
||||
|
||||
// Expand decl_seq = `(param1)...(param-n)` to pp-seq of parameter traits,
|
||||
// otherwise expand decl_seq = `EMPTY() | (void)` to EMPTY().
|
||||
// NOTE: Variadic parameter tuples `( ) | ( void ) | ( param1, ..., paran-n )`
|
||||
|
||||
@@ -35,27 +35,6 @@
|
||||
) \
|
||||
)
|
||||
|
||||
// Expand decl = `[keyword] ...` to `(..., [keyword] EMTPY)`, where keyword can
|
||||
// be one among 2 possible keywords.
|
||||
// Precondition: `...` in decl cannot be EMPTY() (so expanded 2-tuple is valid).
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_KEYWORD2_PARSE( \
|
||||
decl, \
|
||||
keyword1, is_keyword1_macro, remove_keyword1_macro, \
|
||||
keyword2, is_keyword2_macro, remove_keyword2_macro \
|
||||
) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_CONTRACT_EXT_PP_INVOKE3 \
|
||||
BOOST_PP_IIF(is_keyword1_macro(decl), \
|
||||
(BOOST_CONTRACT_EXT_PP_TRAITS_KEYWORD_YES_, decl, \
|
||||
keyword1, remove_keyword1_macro) \
|
||||
, BOOST_PP_IIF(is_keyword2_macro(decl), \
|
||||
(BOOST_CONTRACT_EXT_PP_TRAITS_KEYWORD_YES_, decl, \
|
||||
keyword2, remove_keyword2_macro) \
|
||||
, \
|
||||
(BOOST_CONTRACT_EXT_PP_TRAITS_KEYWORD_NO_, decl, ~, ~) \
|
||||
)) \
|
||||
)
|
||||
|
||||
// Expand decl = `[keyword] ...` to `(..., [keyword] EMTPY)`, where keyword can
|
||||
// be one among 3 possible keywords.
|
||||
// Precondition: `...` in decl cannot be EMPTY() (so expanded 2-tuple is valid).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_TRAITS_ADT_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_ADT_HPP_
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_TRAITS_TRAITS_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_TRAITS_HPP_
|
||||
|
||||
#include <boost/preprocessor/seq/pop_front.hpp>
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
@@ -8,11 +8,13 @@
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
|
||||
// TODO: Move this file to utility/traits.hpp.
|
||||
// TODO: Consider renaming the directory preprocessor/traits to
|
||||
// preprocessor/decl_traits, because these really are function, calss, etc
|
||||
// declaration traits (then DECL does not have to be repeated in all macro names
|
||||
// for brevity FUNC_TRAITS is enough, instead of FUNC_DECL_TRAITS).
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Abstract Data Type (ADT) used to represent traits (pp-sequence, etc.).
|
||||
// These macros are not usually used by the users (unless they re-implement
|
||||
// their own parsing macros).
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/utility/traits.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/auto.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/register.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/const.hpp>
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/preprocessor/facilities/expand.hpp>
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
@@ -68,13 +69,15 @@
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_KEYWORD_INVOKE_( \
|
||||
d, decl, type, push_back_macro, invoke_trait_remove) \
|
||||
BOOST_PP_TUPLE_ELEM(3, 0, invoke_trait_remove)( \
|
||||
d, \
|
||||
decl, \
|
||||
type, \
|
||||
push_back_macro, \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, invoke_trait_remove), \
|
||||
BOOST_PP_TUPLE_ELEM(3, 2, invoke_trait_remove) \
|
||||
BOOST_PP_EXPAND( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 0, invoke_trait_remove)( \
|
||||
d, \
|
||||
decl, \
|
||||
type, \
|
||||
push_back_macro, \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, invoke_trait_remove), \
|
||||
BOOST_PP_TUPLE_ELEM(3, 2, invoke_trait_remove) \
|
||||
) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_KEYWORD_OP_ARGS_( \
|
||||
@@ -197,7 +200,7 @@
|
||||
// handle commas by algorithms in common with spaced type traits).
|
||||
// Implementation: Always return `(())` (double paren seq with 1 empty elem) in
|
||||
// case no type was parsed.
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_SEQ_RETURN_( \
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_SEQ_RETURN_ARGS_( \
|
||||
decl, type) \
|
||||
( \
|
||||
decl, \
|
||||
@@ -207,23 +210,44 @@
|
||||
BOOST_PP_TUPLE_REM_CTOR(1, type) \
|
||||
)
|
||||
|
||||
// Extra level of indirection needed for proper macro expansion (on MSVC).
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_SEQ_RETURN_(decl_type) \
|
||||
BOOST_PP_EXPAND(BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_SEQ_RETURN_ARGS_ \
|
||||
decl_type)
|
||||
|
||||
// Precondition: decl = `auto ...`.
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_AUTO_TYPE_(unused, decl) \
|
||||
(BOOST_CONTRACT_EXT_PP_KEYWORD_AUTO_REMOVE_FRONT(decl), auto)
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Expand decl = `[type | (type)] ...` to `(..., (type) | ())`.
|
||||
// Expand decl = `[type | (type)] ...` (type can also be `void`) to
|
||||
// `(..., (type) | ())`.
|
||||
// For example, `int const ...` to `(..., (int const))`.
|
||||
// Precondition: `...` in decl cannot be EMPTY() (so expanded 2-tuple is valid).
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_PARSE_D(d, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_D_(d, decl, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_SPACED_PUSH_BACK_)
|
||||
|
||||
// Expand decl = `[type | (type)] ...` to
|
||||
// Expand decl = `[auto | type | (type)] ...` (type can also be `void`) to
|
||||
// `(..., auto | (type) | ())` (note that auto is not wrapped in parenthesis).
|
||||
// For example, `auto ...` to `(..., auto)`.
|
||||
// Precondition: `...` in decl cannot be EMPTY() (so expanded 2-tuple is valid).
|
||||
// NOTE: So far, there is no need of a SEQ version of this macro.
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_AUTO_TYPE_PARSE_D(d, decl) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_KEYWORD_IS_AUTO_FRONT(decl), \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_AUTO_TYPE_ \
|
||||
, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_PARSE_D \
|
||||
)(d, decl)
|
||||
|
||||
// Expand decl = `[type | (type)] ...` (type can also be `void`) to
|
||||
// `(..., ((keyword1))...((keyword-n)) | (()))`.
|
||||
// For example, `int const ...` to `(..., ((int)) ((const)))` (useful to access
|
||||
// single type keywords `int`, `const`, etc.).
|
||||
// Precondition: `...` in decl cannot be EMPTY() (so expanded 2-tuple is valid).
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_SEQ_PARSE_D(d, decl) \
|
||||
BOOST_CONTRACT_EXT_PP_EXPAND_ONCE( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_SEQ_RETURN_ \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_SEQ_RETURN_( \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_D_(d, decl, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_TYPE_SEQ_PUSH_BACK_) \
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user