From 9754d1cf0595d49708eca083fde7d1f4bf33b1db Mon Sep 17 00:00:00 2001 From: Lorenzo Caminiti Date: Tue, 1 Mar 2016 10:00:31 -0800 Subject: [PATCH] renamed aux to detail --- include/boost/contract.hpp | 2 - include/boost/contract/assert.hpp | 2 +- include/boost/contract/aux_/tvariadic.hpp | 185 ----------------- include/boost/contract/base_types.hpp | 28 +-- include/boost/contract/call_if.hpp | 8 +- include/boost/contract/constructor.hpp | 12 +- include/boost/contract/core/access.hpp | 32 +-- include/boost/contract/core/exception.hpp | 49 +++-- include/boost/contract/core/set_nothing.hpp | 8 +- .../contract/core/set_old_postcondition.hpp | 18 +- .../contract/core/set_postcondition_only.hpp | 16 +- .../set_precondition_old_postcondition.hpp | 24 +-- include/boost/contract/core/virtual.hpp | 8 +- include/boost/contract/destructor.hpp | 6 +- .../{aux_ => detail}/all_core_headers.hpp | 6 +- .../contract/{aux_ => detail}/auto_ptr.hpp | 23 ++- .../contract/{aux_ => detail}/check_guard.hpp | 12 +- .../{aux_ => detail}/condition/check_base.hpp | 6 +- .../condition/check_pre_post.hpp | 18 +- .../condition/check_pre_post_inv.hpp | 8 +- .../check_subcontracted_pre_post_inv.hpp | 61 +++--- .../contract/{aux_ => detail}/config.hpp | 12 +- .../boost/contract/{aux_ => detail}/debug.hpp | 10 +- .../boost/contract/{aux_ => detail}/decl.hpp | 44 ++-- .../contract/{aux_ => detail}/declspec.hpp | 12 +- .../inlined/core/exception.hpp | 4 +- .../inlined/detail}/check_guard.hpp | 8 +- .../boost/contract/{aux_ => detail}/name.hpp | 10 +- .../boost/contract/{aux_ => detail}/none.hpp | 6 +- .../operation/constructor.hpp | 12 +- .../{aux_ => detail}/operation/destructor.hpp | 12 +- .../{aux_ => detail}/operation/function.hpp | 10 +- .../operation/public_function.hpp | 32 +-- .../operation/public_static_function.hpp | 12 +- .../{aux_ => detail}/operator_safe_bool.hpp | 42 ++-- .../preprocessor/keyword/private.hpp | 20 +- .../preprocessor/keyword/protected.hpp | 21 +- .../preprocessor/keyword/public.hpp | 20 +- .../preprocessor/keyword/utility/is.hpp | 13 +- .../preprocessor/keyword/virtual.hpp | 20 +- include/boost/contract/detail/tvariadic.hpp | 190 ++++++++++++++++++ .../type_traits/introspection.hpp | 71 +++---- .../type_traits/member_function_types.hpp | 8 +- .../{aux_ => detail}/type_traits/optional.hpp | 6 +- include/boost/contract/function.hpp | 6 +- include/boost/contract/guard.hpp | 13 +- include/boost/contract/old.hpp | 37 ++-- include/boost/contract/override.hpp | 57 +++--- include/boost/contract/public_function.hpp | 106 +++++----- src/contract.cpp | 6 +- test/call_if/advance_cxx14.cpp | 4 +- test/call_if/equal_to.cpp | 4 +- test/call_if/equal_to_cxx14.cpp | 4 +- test/call_if/false_.cpp | 4 +- test/call_if/false_void.cpp | 4 +- test/call_if/true_.cpp | 4 +- test/call_if/true_void.cpp | 4 +- test/constructor/access.cpp | 4 +- test/constructor/bases.cpp | 18 +- test/constructor/body_throw.cpp | 4 +- test/constructor/decl.hpp | 4 +- test/constructor/no_contracts.cpp | 4 +- test/constructor/old_throw.cpp | 4 +- test/destructor/access.cpp | 4 +- test/destructor/bases.cpp | 12 +- test/destructor/body_throw.cpp | 4 +- test/destructor/decl.hpp | 4 +- test/destructor/no_contracts.cpp | 4 +- test/destructor/old_throw.cpp | 4 +- test/{aux_ => detail}/counter.hpp | 6 +- test/{aux_ => detail}/oteststream.hpp | 20 +- test/disable/lib_a.hpp | 8 +- test/disable/lib_a_inlined.hpp | 2 +- test/disable/lib_ab.hpp | 24 +-- test/disable/lib_b_inlined.hpp | 22 +- test/disable/lib_x.cpp | 2 +- test/disable/lib_x.hpp | 4 +- test/disable/lib_xy.cpp | 6 +- test/function/body_throw.cpp | 4 +- test/function/decl.hpp | 4 +- test/function/func.cpp | 12 +- test/function/no_contracts.cpp | 4 +- test/function/old_throw.cpp | 4 +- test/invariant/decl.hpp | 4 +- test/old/no_macros.cpp | 17 +- test/public_function/access.cpp | 4 +- test/public_function/bases.hpp | 14 +- test/public_function/bases_protected.cpp | 4 +- test/public_function/bases_sparse.cpp | 4 +- test/public_function/body_throw.cpp | 4 +- test/public_function/decl.hpp | 4 +- test/public_function/max_args.hpp | 4 +- test/public_function/no_contracts.cpp | 4 +- test/public_function/old_throw.cpp | 4 +- test/public_function/overload.hpp | 4 +- test/public_function/static.cpp | 4 +- test/public_function/static_body_throw.cpp | 4 +- test/public_function/static_no_contracts.cpp | 4 +- test/public_function/static_old_throw.cpp | 4 +- test/result/mixed_optional.hpp | 8 +- test/set/no_guard.cpp | 16 +- test/set/nothing.cpp | 4 +- test/set/old.cpp | 4 +- test/set/old_post.cpp | 4 +- test/set/post.cpp | 4 +- test/set/pre.cpp | 4 +- test/set/pre_old.cpp | 4 +- test/set/pre_old_post.cpp | 4 +- test/set/pre_post.cpp | 4 +- 109 files changed, 882 insertions(+), 833 deletions(-) delete mode 100644 include/boost/contract/aux_/tvariadic.hpp rename include/boost/contract/{aux_ => detail}/all_core_headers.hpp (89%) rename include/boost/contract/{aux_ => detail}/auto_ptr.hpp (64%) rename include/boost/contract/{aux_ => detail}/check_guard.hpp (74%) rename include/boost/contract/{aux_ => detail}/condition/check_base.hpp (97%) rename include/boost/contract/{aux_ => detail}/condition/check_pre_post.hpp (83%) rename include/boost/contract/{aux_ => detail}/condition/check_pre_post_inv.hpp (97%) rename include/boost/contract/{aux_ => detail}/condition/check_subcontracted_pre_post_inv.hpp (90%) rename include/boost/contract/{aux_ => detail}/config.hpp (62%) rename include/boost/contract/{aux_ => detail}/debug.hpp (66%) rename include/boost/contract/{aux_ => detail}/decl.hpp (72%) rename include/boost/contract/{aux_ => detail}/declspec.hpp (67%) rename include/boost/contract/{aux_ => detail}/inlined/core/exception.hpp (98%) rename include/boost/contract/{aux_/inlined/aux_ => detail/inlined/detail}/check_guard.hpp (81%) rename include/boost/contract/{aux_ => detail}/name.hpp (69%) rename include/boost/contract/{aux_ => detail}/none.hpp (84%) rename include/boost/contract/{aux_ => detail}/operation/constructor.hpp (89%) rename include/boost/contract/{aux_ => detail}/operation/destructor.hpp (90%) rename include/boost/contract/{aux_ => detail}/operation/function.hpp (87%) rename include/boost/contract/{aux_ => detail}/operation/public_function.hpp (80%) rename include/boost/contract/{aux_ => detail}/operation/public_static_function.hpp (90%) rename include/boost/contract/{aux_ => detail}/operator_safe_bool.hpp (57%) rename include/boost/contract/{aux_ => detail}/preprocessor/keyword/private.hpp (54%) rename include/boost/contract/{aux_ => detail}/preprocessor/keyword/protected.hpp (53%) rename include/boost/contract/{aux_ => detail}/preprocessor/keyword/public.hpp (54%) rename include/boost/contract/{aux_ => detail}/preprocessor/keyword/utility/is.hpp (66%) rename include/boost/contract/{aux_ => detail}/preprocessor/keyword/virtual.hpp (54%) create mode 100644 include/boost/contract/detail/tvariadic.hpp rename include/boost/contract/{aux_ => detail}/type_traits/introspection.hpp (50%) rename include/boost/contract/{aux_ => detail}/type_traits/member_function_types.hpp (91%) rename include/boost/contract/{aux_ => detail}/type_traits/optional.hpp (87%) rename test/{aux_ => detail}/counter.hpp (93%) rename test/{aux_ => detail}/oteststream.hpp (82%) diff --git a/include/boost/contract.hpp b/include/boost/contract.hpp index 554f0ad..bdf3647 100644 --- a/include/boost/contract.hpp +++ b/include/boost/contract.hpp @@ -25,8 +25,6 @@ // TODO: Document that default generated functions (generated default constructors, copy constructors, copy operators, destructors, move constructors, move operators, etc.) will not check contracts. Programmer have to program them in order to check contracts. -// TODO: Replace "aux" with "detail" (and "ext" with "share"). - // TODO: Add all copyright and licencing info (to all files, etc.). // TODO: Should C++11 move preserve class invariants at exit and/or on throw? Maybe not because after move no other public member can be called (but dtor can... so dtor should not check inv at that time...). If so, users could use an internal moved_ data member to guard class invariant checking and set that after the move operation... How can I program C++11 move operations with this lib? Should I used boost::contract::function instead of public_function? (But probably not because that does not subcontract and does not check inv at entry...) diff --git a/include/boost/contract/assert.hpp b/include/boost/contract/assert.hpp index 0a1da35..f4244c6 100644 --- a/include/boost/contract/assert.hpp +++ b/include/boost/contract/assert.hpp @@ -9,7 +9,7 @@ /** @file */ -#include +#include /* PUBLIC */ diff --git a/include/boost/contract/aux_/tvariadic.hpp b/include/boost/contract/aux_/tvariadic.hpp deleted file mode 100644 index 5fef6e6..0000000 --- a/include/boost/contract/aux_/tvariadic.hpp +++ /dev/null @@ -1,185 +0,0 @@ - -#ifndef BOOST_CONTRACT_AUX_TVARIADIC_HPP_ -#define BOOST_CONTRACT_AUX_TVARIADIC_HPP_ - -// Copyright (C) 2008-2016 Lorenzo Caminiti -// Distributed under the Boost Software License, Version 1.0 (see accompanying -// file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). -// See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html - -#include -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES - #define BOOST_CONTRACT_AUX_TVARIADIC 0 -#else - #define BOOST_CONTRACT_AUX_TVARIADIC 1 -#endif - -#if BOOST_CONTRACT_AUX_TVARIADIC - #include - - /* CODE */ - - namespace boost { namespace contract { namespace aux { - namespace tvariadic_ { - template struct indexes {}; - - template struct indexes_of : - indexes_of {}; - template struct indexes_of<0, I...> - { typedef indexes type; }; - } } } } // namespace - -#else - #include - #include - #include - #include - #include - - /* PRIVATE */ - - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_ELEM_(z, n, tuple) \ - BOOST_PP_CAT(tuple, n) - - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INIT_(z, n, tuplevar_values) \ - BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, tuplevar_values), n)( \ - BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 1, tuplevar_values), n)) - - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_(z, n, type_qualifier_name) \ - BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 0, type_qualifier_name), n) \ - BOOST_PP_TUPLE_ELEM(3, 1, type_qualifier_name) \ - BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 2, type_qualifier_name), n) \ - ; - - #define BOOST_CONTRACT_AUX_NO_TVARIADIC_ENUM_(z, n, tokens) \ - tokens - - #define BOOST_CONTRACT_AUX_TVARIADIC_ARG_(z, n, name) \ - BOOST_PP_CAT(name, n) - - #define BOOST_CONTRACT_AUX_TVARIADIC_FPARAM_(z, n, type_qualifier_name) \ - BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 0, type_qualifier_name), n) \ - BOOST_PP_TUPLE_ELEM(3, 1, type_qualifier_name) \ - BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 2, type_qualifier_name), n) - - #define BOOST_CONTRACT_AUX_TVARIADIC_TPARAM_(z, n, name) \ - typename BOOST_PP_CAT(name, n) -#endif - -/* PUBLIC */ - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_TVARIADIC_COMMA(arity) , -#else - #define BOOST_CONTRACT_AUX_TVARIADIC_COMMA(arity) BOOST_PP_COMMA_IF(arity) -#endif - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_NO_TVARIADIC_COMMA(arity) /* nothing */ -#else - #define BOOST_CONTRACT_AUX_NO_TVARIADIC_COMMA(arity) \ - BOOST_PP_COMMA_IF(arity) -#endif - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_TVARIADIC_SIZEOF(arity, name) sizeof...(name) -#else - #define BOOST_CONTRACT_AUX_TVARIADIC_SIZEOF(arity, name) arity -#endif - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_TVARIADIC_TPARAMS_Z(z, arity, name) \ - typename... name -#else - #define BOOST_CONTRACT_AUX_TVARIADIC_TPARAMS_Z(z, arity, name) \ - BOOST_PP_ENUM_ ## z(arity, BOOST_CONTRACT_AUX_TVARIADIC_TPARAM_, name) -#endif - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_TVARIADIC_FPARAMS_Z( \ - z, arity, type, qualifier, name) \ - type qualifier ... name -#else - #define BOOST_CONTRACT_AUX_TVARIADIC_FPARAMS_Z( \ - z, arity, type, qualifier, name) \ - BOOST_PP_ENUM_ ## z(arity, BOOST_CONTRACT_AUX_TVARIADIC_FPARAM_, \ - (type, qualifier, name)) -#endif - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_TVARIADIC_ARGS_Z(z, arity, name) \ - name... -#else - #define BOOST_CONTRACT_AUX_TVARIADIC_ARGS_Z(z, arity, name) \ - BOOST_PP_ENUM_ ## z(arity, BOOST_CONTRACT_AUX_TVARIADIC_ARG_, name) -#endif - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_NO_TVARIADIC_ENUM_Z(z, arity, tokens) \ - /* nothing */ -#else - #define BOOST_CONTRACT_AUX_NO_TVARIADIC_ENUM_Z(z, arity, tokens) \ - BOOST_PP_ENUM_ ## z(arity, BOOST_CONTRACT_AUX_NO_TVARIADIC_ENUM_, \ - tokens) -#endif - -// Tuple. - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_Z( \ - z, arity, type, qualifier, name) \ - std::tuple name; -#else - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_Z( \ - z, arity, type, qualifier, name) \ - BOOST_PP_REPEAT_ ## z(arity, BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_, \ - (type, qualifier, name)) -#endif - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INIT_Z(z, arity, tuple, values) \ - tuple(values...) -#else - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INIT_Z(z, arity, tuple, values) \ - BOOST_PP_ENUM_ ## z(arity, BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INIT_, \ - (tuple, values)) -#endif - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INDEXES_TPARAM(indexes) \ - int... indexes -#else - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INDEXES_TPARAM(indexes) \ - /* nothing */ -#endif - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INDEXES_FPARAM(_indexes) \ - boost::contract::aux::tvariadic_::indexes<_indexes...> -#else - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INDEXES_FPARAM(_indexes) \ - /* nothing */ -#endif - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INDEXES_OF(tuple_type) \ - typename boost::contract::aux::tvariadic_::indexes_of< \ - sizeof...(tuple_type)>::type() -#else - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INDEXES_OF(unused) \ - /* nothing */ -#endif - -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_ELEMS_Z( \ - z, arity, indexes, tuple) \ - std::get(tuple)... -#else - #define BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_ELEMS_Z( \ - z, arity, indexes, tuple) \ - BOOST_PP_ENUM_ ## z(arity, BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_ELEM_, \ - tuple) -#endif - -#endif // #include guard - diff --git a/include/boost/contract/base_types.hpp b/include/boost/contract/base_types.hpp index ee48787..d1aecc4 100644 --- a/include/boost/contract/base_types.hpp +++ b/include/boost/contract/base_types.hpp @@ -11,7 +11,7 @@ /** @file */ -#include +#include #include #if !BOOST_PP_VARIADICS @@ -26,10 +26,10 @@ BOOST_CONTRACT_ERROR_macro_BASE_TYPES_requires_variadic_macros_otherwise_manuall #else // contracts on #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -47,8 +47,8 @@ BOOST_CONTRACT_ERROR_macro_BASE_TYPES_requires_variadic_macros_otherwise_manuall #define BOOST_CONTRACT_BASE_TYPES_REMOVE_VIRTUAL_(base) \ BOOST_PP_EXPAND( \ - BOOST_PP_IIF(BOOST_CONTRACT_AUX_PP_KEYWORD_IS_VIRTUAL(base), \ - BOOST_CONTRACT_AUX_PP_KEYWORD_REMOVE_VIRTUAL \ + BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_VIRTUAL(base), \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_REMOVE_VIRTUAL \ , \ BOOST_PP_TUPLE_REM(1) \ )(base) \ @@ -75,16 +75,16 @@ BOOST_CONTRACT_ERROR_macro_BASE_TYPES_requires_variadic_macros_otherwise_manuall 1, \ BOOST_PP_SEQ_PUSH_BACK(types_nilseq, \ BOOST_CONTRACT_BASE_TYPES_REMOVE_VIRTUAL_( \ - BOOST_CONTRACT_AUX_PP_KEYWORD_REMOVE_PUBLIC(base)) \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_REMOVE_PUBLIC(base)) \ ) \ ) #define BOOST_CONTRACT_BASE_TYPES_ACCESS_(is_public, types_nilseq, base) \ - BOOST_PP_IIF(BOOST_CONTRACT_AUX_PP_KEYWORD_IS_PUBLIC(base), \ + BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_PUBLIC(base), \ BOOST_CONTRACT_BASE_TYPES_PUSH_BACK_PUBLIC_ \ - , BOOST_PP_IIF(BOOST_CONTRACT_AUX_PP_KEYWORD_IS_PROTECTED(base), \ + , BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_PROTECTED(base), \ BOOST_CONTRACT_BASE_TYPES_SKIP_NOT_PUBLIC_ \ - , BOOST_PP_IIF(BOOST_CONTRACT_AUX_PP_KEYWORD_IS_PRIVATE(base), \ + , BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_PRIVATE(base), \ BOOST_CONTRACT_BASE_TYPES_SKIP_NOT_PUBLIC_ \ , \ BOOST_CONTRACT_BASE_TYPES_PUSH_BACK_IF_ \ @@ -122,11 +122,11 @@ BOOST_CONTRACT_ERROR_macro_BASE_TYPES_requires_variadic_macros_otherwise_manuall BOOST_CONTRACT_ERROR_all_bases_must_explicitly_specify_public_protected_or_private base_tuple #define BOOST_CONTRACT_BASE_TYPES_IS_ACCESS_(base) \ - BOOST_PP_IIF(BOOST_CONTRACT_AUX_PP_KEYWORD_IS_PUBLIC(base), \ + BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_PUBLIC(base), \ 1 \ - , BOOST_PP_IIF(BOOST_CONTRACT_AUX_PP_KEYWORD_IS_PROTECTED(base), \ + , BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_PROTECTED(base), \ 1 \ - , BOOST_PP_IIF(BOOST_CONTRACT_AUX_PP_KEYWORD_IS_PRIVATE(base), \ + , BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_PRIVATE(base), \ 1 \ , \ 0 \ diff --git a/include/boost/contract/call_if.hpp b/include/boost/contract/call_if.hpp index 4471f45..8ca7caf 100644 --- a/include/boost/contract/call_if.hpp +++ b/include/boost/contract/call_if.hpp @@ -8,7 +8,7 @@ // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html // Do not include all_core_headers here (call_if is essentially standalone). -#include +#include #include #include #include @@ -30,7 +30,7 @@ namespace boost { namespace contract { -template +template class call_if_statement {}; // Empty so cannot be used (but copyable). // Dispatch true condition (then) between non-void and void calls. @@ -38,7 +38,7 @@ class call_if_statement {}; // Empty so cannot be used (but copyable). // checked to be true (as Then() is required to be valid only in that case) so // this extra level of dispatching is necessary to avoid compiler errors. template -class call_if_statement : +class call_if_statement : public call_if_statement { @@ -96,7 +96,7 @@ public: // False condition (else) for both non-void and void calls. template // Copyable (no data). -class call_if_statement { +class call_if_statement { public: explicit call_if_statement(Then const&) {} diff --git a/include/boost/contract/constructor.hpp b/include/boost/contract/constructor.hpp index 85e68f7..fea0f92 100644 --- a/include/boost/contract/constructor.hpp +++ b/include/boost/contract/constructor.hpp @@ -9,13 +9,13 @@ /** @file */ -#include +#include #if !defined(BOOST_CONTRACT_NO_CONSTRUCTORS) || \ !defined(BOOST_CONTRACT_NO_PRECONDITIONS) - #include + #include #endif #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) - #include + #include #endif namespace boost { namespace contract { @@ -26,7 +26,7 @@ set_old_postcondition<> constructor(C* obj) { #if !defined(BOOST_CONTRACT_NO_CONSTRUCTORS) || \ !defined(BOOST_CONTRACT_NO_PRECONDITIONS) return set_old_postcondition<>( - new boost::contract::aux::constructor(obj)); + new boost::contract::detail::constructor(obj)); #else return set_old_postcondition<>(); #endif @@ -40,10 +40,10 @@ public: template explicit constructor_precondition(F const& f) { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS - if(boost::contract::aux::check_guard::checking()) return; + if(boost::contract::detail::check_guard::checking()) return; try { #ifndef BOOST_CONTRACT_PRECONDITIONS_DISABLE_NOTHING - boost::contract::aux::check_guard checking; + boost::contract::detail::check_guard checking; #endif f(); } catch(...) { precondition_failure(from_constructor); } diff --git a/include/boost/contract/core/access.hpp b/include/boost/contract/core/access.hpp index 445d41d..87a81d5 100644 --- a/include/boost/contract/core/access.hpp +++ b/include/boost/contract/core/access.hpp @@ -8,28 +8,28 @@ // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html #include -#include +#include #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - #include + #include #endif #ifndef BOOST_CONTRACT_NO_INVARIANTS - #include + #include #include #include #endif // TODO: Review all warnings for examples, tests, and also lib compilation... -// TODO: Document (in a rationale) that using friend to limit lib's public API does not increase compilation times at all. I compiled with friends. Then I removed all friends, made related APIs all public and the compilation times of all test/public_function/* where exactly the same for all compilers (msvc 37 min, gcc 70 min, clang 46 min). So there is not reason at all to not use friends (plus not using friend will complicate the internal APIs because contractor names cannot be wrapped using AUX_NAME so they will still be made private and accessed via some sort of static AUX_NAME(make) member function...). +// TODO: Document (in a rationale) that using friend to limit lib's public API does not increase compilation times at all. I compiled with friends. Then I removed all friends, made related APIs all public and the compilation times of all test/public_function/* where exactly the same for all compilers (msvc 37 min, gcc 70 min, clang 46 min). So there is not reason at all to not use friends (plus not using friend will complicate the internal APIs because contractor names cannot be wrapped using DETAIL_NAME so they will still be made private and accessed via some sort of static DETAIL_NAME(make) member function...). namespace boost { namespace contract { class virtual_; - namespace aux { - BOOST_CONTRACT_AUX_DECL_AUX_CHECK_SUBCONTRACTED_PRE_POST_INV_Z(1, + namespace detail { + BOOST_CONTRACT_DETAIL_DECL_DETAIL_CHECK_SUBCONTRACTED_PRE_POST_INV_Z(1, /* is_friend = */ 0, OO, RR, FF, CC, AArgs); template @@ -53,7 +53,7 @@ class access { // Copyable (as shell with no data member). #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - BOOST_CONTRACT_AUX_INTROSPECTION_HAS_TYPE(has_base_types, + BOOST_CONTRACT_DETAIL_INTROSPECTION_HAS_TYPE(has_base_types, BOOST_CONTRACT_BASE_TYPEDEF) template @@ -63,10 +63,10 @@ class access { // Copyable (as shell with no data member). #endif #ifndef BOOST_CONTRACT_NO_INVARIANTS - BOOST_CONTRACT_AUX_INTROSPECTION_HAS_MEMBER_FUNCTION( + BOOST_CONTRACT_DETAIL_INTROSPECTION_HAS_MEMBER_FUNCTION( has_static_invariant_f, BOOST_CONTRACT_STATIC_INVARIANT) - BOOST_CONTRACT_AUX_INTROSPECTION_HAS_STATIC_MEMBER_FUNCTION( + BOOST_CONTRACT_DETAIL_INTROSPECTION_HAS_STATIC_MEMBER_FUNCTION( has_static_invariant_s, BOOST_CONTRACT_STATIC_INVARIANT) template @@ -87,10 +87,10 @@ class access { // Copyable (as shell with no data member). } }; - BOOST_CONTRACT_AUX_INTROSPECTION_HAS_MEMBER_FUNCTION( + BOOST_CONTRACT_DETAIL_INTROSPECTION_HAS_MEMBER_FUNCTION( has_invariant_f, BOOST_CONTRACT_INVARIANT) - BOOST_CONTRACT_AUX_INTROSPECTION_HAS_STATIC_MEMBER_FUNCTION( + BOOST_CONTRACT_DETAIL_INTROSPECTION_HAS_STATIC_MEMBER_FUNCTION( has_invariant_s, BOOST_CONTRACT_INVARIANT) template @@ -103,26 +103,26 @@ class access { // Copyable (as shell with no data member). template static void cv_invariant(C const volatile* obj) { - BOOST_CONTRACT_AUX_DEBUG(obj); + BOOST_CONTRACT_DETAIL_DEBUG(obj); obj->BOOST_CONTRACT_INVARIANT(); } template static void const_invariant(C const* obj) { - BOOST_CONTRACT_AUX_DEBUG(obj); + BOOST_CONTRACT_DETAIL_DEBUG(obj); obj->BOOST_CONTRACT_INVARIANT(); } #endif // Friends (used to limit library's public API). - BOOST_CONTRACT_AUX_DECL_AUX_CHECK_SUBCONTRACTED_PRE_POST_INV_Z(1, + BOOST_CONTRACT_DETAIL_DECL_DETAIL_CHECK_SUBCONTRACTED_PRE_POST_INV_Z(1, /* is_friend = */ 1, OO, RR, FF, CC, AArgs); template - friend class boost::contract::aux::check_pre_post_inv; + friend class boost::contract::detail::check_pre_post_inv; - BOOST_CONTRACT_AUX_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTIONS_Z(1, + BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTIONS_Z(1, OO, RR, FF, CC, AArgs, vv, rr, ff, oobj, aargs) }; diff --git a/include/boost/contract/core/exception.hpp b/include/boost/contract/core/exception.hpp index c0f4b88..cb7a558 100644 --- a/include/boost/contract/core/exception.hpp +++ b/include/boost/contract/core/exception.hpp @@ -9,7 +9,7 @@ /** @file */ -#include +#include #include #include #include @@ -25,14 +25,14 @@ namespace boost { namespace contract { // Placeholder base class to group all this lib exceptions. // IMPORTANT: Must not inherit from std::exception as derived exceptions will. -class BOOST_CONTRACT_AUX_DECLSPEC exception { +class BOOST_CONTRACT_DETAIL_DECLSPEC exception { public: virtual ~exception(); }; // Rationale: boost::bad_any_cast exception does not print from/to type names, // so throw custom exception. -class BOOST_CONTRACT_AUX_DECLSPEC bad_virtual_result_cast : // Copy (as str). +class BOOST_CONTRACT_DETAIL_DECLSPEC bad_virtual_result_cast : // Copy (as str). public std::bad_cast, public boost::contract::exception { public: explicit bad_virtual_result_cast(char const* from_type_name, @@ -45,7 +45,7 @@ private: std::string what_; }; -class BOOST_CONTRACT_AUX_DECLSPEC assertion_failure : // Copy (as str, etc.). +class BOOST_CONTRACT_DETAIL_DECLSPEC assertion_failure : // Copy (as str, etc.). public std::exception, public boost::contract::exception { public: explicit assertion_failure(char const* const file = "", @@ -74,56 +74,61 @@ enum from { from_constructor, from_destructor, from_function }; // Use Boost.Function to handle also lambdas, binds, etc, typedef boost::function assertion_failure_handler; -assertion_failure_handler BOOST_CONTRACT_AUX_DECLSPEC set_precondition_failure( +assertion_failure_handler +BOOST_CONTRACT_DETAIL_DECLSPEC set_precondition_failure( assertion_failure_handler const& f) BOOST_NOEXCEPT_OR_NOTHROW; -assertion_failure_handler BOOST_CONTRACT_AUX_DECLSPEC get_precondition_failure() +assertion_failure_handler +BOOST_CONTRACT_DETAIL_DECLSPEC get_precondition_failure() BOOST_NOEXCEPT_OR_NOTHROW; -void BOOST_CONTRACT_AUX_DECLSPEC precondition_failure(from where) +void BOOST_CONTRACT_DETAIL_DECLSPEC precondition_failure(from where) /* can throw */; -assertion_failure_handler BOOST_CONTRACT_AUX_DECLSPEC set_postcondition_failure( +assertion_failure_handler +BOOST_CONTRACT_DETAIL_DECLSPEC set_postcondition_failure( assertion_failure_handler const& f) BOOST_NOEXCEPT_OR_NOTHROW; -assertion_failure_handler BOOST_CONTRACT_AUX_DECLSPEC -get_postcondition_failure() BOOST_NOEXCEPT_OR_NOTHROW; +assertion_failure_handler +BOOST_CONTRACT_DETAIL_DECLSPEC get_postcondition_failure() + BOOST_NOEXCEPT_OR_NOTHROW; -void BOOST_CONTRACT_AUX_DECLSPEC postcondition_failure(from where) +void BOOST_CONTRACT_DETAIL_DECLSPEC postcondition_failure(from where) /* can throw */; -assertion_failure_handler BOOST_CONTRACT_AUX_DECLSPEC +assertion_failure_handler BOOST_CONTRACT_DETAIL_DECLSPEC set_entry_invariant_failure(assertion_failure_handler const& f) BOOST_NOEXCEPT_OR_NOTHROW; -assertion_failure_handler BOOST_CONTRACT_AUX_DECLSPEC +assertion_failure_handler BOOST_CONTRACT_DETAIL_DECLSPEC get_entry_invariant_failure() BOOST_NOEXCEPT_OR_NOTHROW; -void BOOST_CONTRACT_AUX_DECLSPEC entry_invariant_failure(from where) +void BOOST_CONTRACT_DETAIL_DECLSPEC entry_invariant_failure(from where) /* can throw */; -assertion_failure_handler BOOST_CONTRACT_AUX_DECLSPEC +assertion_failure_handler BOOST_CONTRACT_DETAIL_DECLSPEC set_exit_invariant_failure(assertion_failure_handler const& f) BOOST_NOEXCEPT_OR_NOTHROW; -assertion_failure_handler BOOST_CONTRACT_AUX_DECLSPEC -get_exit_invariant_failure() BOOST_NOEXCEPT_OR_NOTHROW; +assertion_failure_handler +BOOST_CONTRACT_DETAIL_DECLSPEC get_exit_invariant_failure() + BOOST_NOEXCEPT_OR_NOTHROW; -void BOOST_CONTRACT_AUX_DECLSPEC exit_invariant_failure(from where) +void BOOST_CONTRACT_DETAIL_DECLSPEC exit_invariant_failure(from where) /* can throw */; // Set all inv failures (entry inv and exit inv) at once. -void BOOST_CONTRACT_AUX_DECLSPEC set_invariant_failure( +void BOOST_CONTRACT_DETAIL_DECLSPEC set_invariant_failure( assertion_failure_handler const& f) BOOST_NOEXCEPT_OR_NOTHROW; // Set all failures (pre, post, entry inv, and exit int) at once. -void BOOST_CONTRACT_AUX_DECLSPEC set_failure(assertion_failure_handler const& f) - BOOST_NOEXCEPT_OR_NOTHROW; +void BOOST_CONTRACT_DETAIL_DECLSPEC set_failure( + assertion_failure_handler const& f) BOOST_NOEXCEPT_OR_NOTHROW; } } // namespace #if BOOST_CONTRACT_HEADER_ONLY - #include + #include #endif #endif // #include guard diff --git a/include/boost/contract/core/set_nothing.hpp b/include/boost/contract/core/set_nothing.hpp index 1e20f1b..850b044 100644 --- a/include/boost/contract/core/set_nothing.hpp +++ b/include/boost/contract/core/set_nothing.hpp @@ -13,8 +13,8 @@ #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - #include - #include + #include + #include #endif #include @@ -43,11 +43,11 @@ private: #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - typedef boost::contract::aux::check_base check_type; + typedef boost::contract::detail::check_base check_type; explicit set_nothing(check_type* check) : check_(check) {} - boost::contract::aux::auto_ptr check_; + boost::contract::detail::auto_ptr check_; #endif // Friends (used to limit library's public API). diff --git a/include/boost/contract/core/set_old_postcondition.hpp b/include/boost/contract/core/set_old_postcondition.hpp index e7a59de..786d897 100644 --- a/include/boost/contract/core/set_old_postcondition.hpp +++ b/include/boost/contract/core/set_old_postcondition.hpp @@ -15,12 +15,12 @@ #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - #include - #include - #include + #include + #include + #include #endif #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) - #include + #include #endif #include @@ -41,7 +41,7 @@ public: template set_postcondition_only old(F const& f) { #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - BOOST_CONTRACT_AUX_DEBUG(check_); + BOOST_CONTRACT_DETAIL_DEBUG(check_); check_->set_old(f); #endif #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ @@ -56,7 +56,7 @@ public: template set_nothing postcondition(F const& f) { #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - BOOST_CONTRACT_AUX_DEBUG(check_); + BOOST_CONTRACT_DETAIL_DEBUG(check_); check_->set_post(f); #endif #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ @@ -72,12 +72,12 @@ private: #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - typedef boost::contract::aux::check_pre_post::type> check_type; + typedef boost::contract::detail::check_pre_post::type> check_type; explicit set_old_postcondition(check_type* check) : check_(check) {} - boost::contract::aux::auto_ptr check_; + boost::contract::detail::auto_ptr check_; #endif // Friends (used to limit library's public API). diff --git a/include/boost/contract/core/set_postcondition_only.hpp b/include/boost/contract/core/set_postcondition_only.hpp index 8052414..ee18858 100644 --- a/include/boost/contract/core/set_postcondition_only.hpp +++ b/include/boost/contract/core/set_postcondition_only.hpp @@ -14,12 +14,12 @@ #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - #include - #include - #include + #include + #include + #include #endif #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - #include + #include #endif #include @@ -43,7 +43,7 @@ public: template set_nothing postcondition(F const& f) { #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - BOOST_CONTRACT_AUX_DEBUG(check_); + BOOST_CONTRACT_DETAIL_DEBUG(check_); check_->set_post(f); #endif #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ @@ -59,12 +59,12 @@ private: #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - typedef boost::contract::aux::check_pre_post::type> check_type; + typedef boost::contract::detail::check_pre_post::type> check_type; explicit set_postcondition_only(check_type* check) : check_(check) {} - boost::contract::aux::auto_ptr check_; + boost::contract::detail::auto_ptr check_; #endif // Friends (used to limit library's public API). diff --git a/include/boost/contract/core/set_precondition_old_postcondition.hpp b/include/boost/contract/core/set_precondition_old_postcondition.hpp index 82b575a..075188e 100644 --- a/include/boost/contract/core/set_precondition_old_postcondition.hpp +++ b/include/boost/contract/core/set_precondition_old_postcondition.hpp @@ -13,17 +13,17 @@ #include #include #include -#include +#include #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - #include - #include - #include + #include + #include + #include #endif #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) - #include + #include #endif #include @@ -43,7 +43,7 @@ public: template set_old_postcondition precondition(F const& f) { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS - BOOST_CONTRACT_AUX_DEBUG(check_); + BOOST_CONTRACT_DETAIL_DEBUG(check_); check_->set_pre(f); #endif #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ @@ -58,7 +58,7 @@ public: template set_postcondition_only old(F const& f) { #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - BOOST_CONTRACT_AUX_DEBUG(check_); + BOOST_CONTRACT_DETAIL_DEBUG(check_); check_->set_old(f); #endif #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ @@ -73,7 +73,7 @@ public: template set_nothing postcondition(F const& f) { #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - BOOST_CONTRACT_AUX_DEBUG(check_); + BOOST_CONTRACT_DETAIL_DEBUG(check_); check_->set_post(f); #endif #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ @@ -89,13 +89,13 @@ private: #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - typedef boost::contract::aux::check_pre_post::type> check_type; + typedef boost::contract::detail::check_pre_post::type> check_type; explicit set_precondition_old_postcondition(check_type* check) : check_(check) {} - boost::contract::aux::auto_ptr check_; + boost::contract::detail::auto_ptr check_; #endif // Friends (used to limit library's public API). @@ -118,7 +118,7 @@ private: friend set_precondition_old_postcondition public_function( virtual_* vv, RR& rr, CC* oobj); - BOOST_CONTRACT_AUX_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTIONS_Z(1, + BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTIONS_Z(1, OO, RR, FF, CC, AArgs, vv, rr, ff, oobj, aargs) }; diff --git a/include/boost/contract/core/virtual.hpp b/include/boost/contract/core/virtual.hpp index 4ca15f9..cbb5c45 100644 --- a/include/boost/contract/core/virtual.hpp +++ b/include/boost/contract/core/virtual.hpp @@ -8,7 +8,7 @@ // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html #include -#include +#include #include #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS #include @@ -19,8 +19,8 @@ namespace boost { namespace contract { - namespace aux { - BOOST_CONTRACT_AUX_DECL_AUX_CHECK_SUBCONTRACTED_PRE_POST_INV_Z(1, + namespace detail { + BOOST_CONTRACT_DETAIL_DECL_DETAIL_CHECK_SUBCONTRACTED_PRE_POST_INV_Z(1, /* is_friend = */ 0, OO, RR, FF, CC, AArgs); } } @@ -95,7 +95,7 @@ class virtual_ : private boost::noncopyable { // Avoid copy queue, stack, etc. friend class convertible_old; - BOOST_CONTRACT_AUX_DECL_AUX_CHECK_SUBCONTRACTED_PRE_POST_INV_Z(1, + BOOST_CONTRACT_DETAIL_DECL_DETAIL_CHECK_SUBCONTRACTED_PRE_POST_INV_Z(1, /* is_friend = */ 1, OO, RR, FF, CC, AArgs); }; diff --git a/include/boost/contract/destructor.hpp b/include/boost/contract/destructor.hpp index da45327..f8e6ddf 100644 --- a/include/boost/contract/destructor.hpp +++ b/include/boost/contract/destructor.hpp @@ -9,10 +9,10 @@ /** @file */ -#include +#include #if !defined(BOOST_CONTRACT_NO_DESTRUCTORS) || \ !defined(BOOST_CONTRACT_NO_PRECONDITIONS) - #include + #include #endif namespace boost { namespace contract { @@ -23,7 +23,7 @@ set_old_postcondition<> destructor(C* obj) { #if !defined(BOOST_CONTRACT_NO_DESTRUCTORS) || \ !defined(BOOST_CONTRACT_NO_PRECONDITIONS) return set_old_postcondition<>( - new boost::contract::aux::destructor(obj)); + new boost::contract::detail::destructor(obj)); #else return set_old_postcondition<>(); #endif diff --git a/include/boost/contract/aux_/all_core_headers.hpp b/include/boost/contract/detail/all_core_headers.hpp similarity index 89% rename from include/boost/contract/aux_/all_core_headers.hpp rename to include/boost/contract/detail/all_core_headers.hpp index 202fe12..f1180f1 100644 --- a/include/boost/contract/aux_/all_core_headers.hpp +++ b/include/boost/contract/detail/all_core_headers.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_ALL_CORE_HEADERS_HPP_ -#define BOOST_CONTRACT_AUX_ALL_CORE_HEADERS_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_ALL_CORE_HEADERS_HPP_ +#define BOOST_CONTRACT_DETAIL_ALL_CORE_HEADERS_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -12,7 +12,7 @@ // will be confused not knowing if a core header has been included or not). // IMPORTANT: In addition, headers can be included -// by any file (in aux_/*, etc.) while non-core public headers +// by any file (in detail/*, etc.) while non-core public headers // must not be included by any lib header file (because // non-core public headers should be fully independent from one another and // included only by user code). If a public header needs to be included by diff --git a/include/boost/contract/aux_/auto_ptr.hpp b/include/boost/contract/detail/auto_ptr.hpp similarity index 64% rename from include/boost/contract/aux_/auto_ptr.hpp rename to include/boost/contract/detail/auto_ptr.hpp index 3a8eff1..617020f 100644 --- a/include/boost/contract/aux_/auto_ptr.hpp +++ b/include/boost/contract/detail/auto_ptr.hpp @@ -1,17 +1,17 @@ -#ifndef BOOST_CONTRACT_AUX_AUTO_PTR_HPP_ -#define BOOST_CONTRACT_AUX_AUTO_PTR_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_AUTO_PTR_HPP_ +#define BOOST_CONTRACT_DETAIL_AUTO_PTR_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -#include -#include +#include +#include #include -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { // Using this instead of std::auto_ptr because std::auto_ptr will be removed in // C++17 (this library always uses release() to avoid ownership issues). @@ -28,13 +28,20 @@ public: return ptr; } - T& operator*() { BOOST_CONTRACT_AUX_DEBUG(ptr_); return *ptr_; } - T const& operator*() const { BOOST_CONTRACT_AUX_DEBUG(ptr_); return *ptr_; } + T& operator*() { + BOOST_CONTRACT_DETAIL_DEBUG(ptr_); + return *ptr_; + } + + T const& operator*() const { + BOOST_CONTRACT_DETAIL_DEBUG(ptr_); + return *ptr_; + } T* operator->() { return ptr_; } T const* operator->() const { return ptr_; } - BOOST_CONTRACT_AUX_OPERATOR_SAFE_BOOL(auto_ptr, !!ptr_) + BOOST_CONTRACT_DETAIL_OPERATOR_SAFE_BOOL(auto_ptr, !!ptr_) private: T* ptr_; diff --git a/include/boost/contract/aux_/check_guard.hpp b/include/boost/contract/detail/check_guard.hpp similarity index 74% rename from include/boost/contract/aux_/check_guard.hpp rename to include/boost/contract/detail/check_guard.hpp index f594990..af517d7 100644 --- a/include/boost/contract/aux_/check_guard.hpp +++ b/include/boost/contract/detail/check_guard.hpp @@ -1,21 +1,21 @@ -#ifndef BOOST_CONTRACT_AUX_CHECK_GUARD_HPP_ -#define BOOST_CONTRACT_AUX_CHECK_GUARD_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_CHECK_GUARD_HPP_ +#define BOOST_CONTRACT_DETAIL_CHECK_GUARD_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -#include +#include #ifndef BOOST_CONTRACT_DISABLE_THREADS #include #endif #include -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { -class BOOST_CONTRACT_AUX_DECLSPEC check_guard : +class BOOST_CONTRACT_DETAIL_DECLSPEC check_guard : private boost::noncopyable // Non-copyable resource (might use mutex, etc.). { public: @@ -35,7 +35,7 @@ private: } } } // namespace #if BOOST_CONTRACT_HEADER_ONLY - #include + #include #endif #endif // #include guard diff --git a/include/boost/contract/aux_/condition/check_base.hpp b/include/boost/contract/detail/condition/check_base.hpp similarity index 97% rename from include/boost/contract/aux_/condition/check_base.hpp rename to include/boost/contract/detail/condition/check_base.hpp index c37875b..f016189 100644 --- a/include/boost/contract/aux_/condition/check_base.hpp +++ b/include/boost/contract/detail/condition/check_base.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_CHECK_BASE_HPP_ -#define BOOST_CONTRACT_AUX_CHECK_BASE_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_CHECK_BASE_HPP_ +#define BOOST_CONTRACT_DETAIL_CHECK_BASE_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -19,7 +19,7 @@ #include #endif -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { class check_base : // Base to hold all contract objects for RAII. private boost::noncopyable // Avoid copying possible user's ftor captures. diff --git a/include/boost/contract/aux_/condition/check_pre_post.hpp b/include/boost/contract/detail/condition/check_pre_post.hpp similarity index 83% rename from include/boost/contract/aux_/condition/check_pre_post.hpp rename to include/boost/contract/detail/condition/check_pre_post.hpp index 1b9e01f..c61cb39 100644 --- a/include/boost/contract/aux_/condition/check_pre_post.hpp +++ b/include/boost/contract/detail/condition/check_pre_post.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_CHECK_PRE_POST_HPP_ -#define BOOST_CONTRACT_AUX_CHECK_PRE_POST_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_CHECK_PRE_POST_HPP_ +#define BOOST_CONTRACT_DETAIL_CHECK_PRE_POST_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -9,10 +9,10 @@ #include #include -#include -#include +#include +#include #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - #include + #include #include #include #include @@ -21,7 +21,7 @@ /* PRIVATE */ -#define BOOST_CONTRACT_AUX_CHECK_PRE_POST_DEF_( \ +#define BOOST_CONTRACT_DETAIL_CHECK_PRE_POST_DEF_( \ result_type, result_param, ftor_type, ftor_var, ftor_call) \ public: \ template \ @@ -39,7 +39,7 @@ /* CODE */ -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { template class check_pre_post : public check_base { // Non-copyable base. @@ -55,7 +55,7 @@ private: R const& >::type r_type; - BOOST_CONTRACT_AUX_CHECK_PRE_POST_DEF_( + BOOST_CONTRACT_DETAIL_CHECK_PRE_POST_DEF_( r_type, r, void (r_type), @@ -72,7 +72,7 @@ public: explicit check_pre_post(boost::contract::from from) : check_base(from) {} #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - BOOST_CONTRACT_AUX_CHECK_PRE_POST_DEF_( + BOOST_CONTRACT_DETAIL_CHECK_PRE_POST_DEF_( none, unused, void (), diff --git a/include/boost/contract/aux_/condition/check_pre_post_inv.hpp b/include/boost/contract/detail/condition/check_pre_post_inv.hpp similarity index 97% rename from include/boost/contract/aux_/condition/check_pre_post_inv.hpp rename to include/boost/contract/detail/condition/check_pre_post_inv.hpp index eb8addb..29a356b 100644 --- a/include/boost/contract/aux_/condition/check_pre_post_inv.hpp +++ b/include/boost/contract/detail/condition/check_pre_post_inv.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_CHECK_PRE_POST_INV_HPP_ -#define BOOST_CONTRACT_AUX_CHECK_PRE_POST_INV_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_CHECK_PRE_POST_INV_HPP_ +#define BOOST_CONTRACT_DETAIL_CHECK_PRE_POST_INV_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -9,7 +9,7 @@ #include #include -#include +#include #ifndef BOOST_CONTRACT_NO_INVARIANTS #include #include @@ -29,7 +29,7 @@ #endif #endif -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { template class check_pre_post_inv : public check_pre_post { // Non-copyable base. diff --git a/include/boost/contract/aux_/condition/check_subcontracted_pre_post_inv.hpp b/include/boost/contract/detail/condition/check_subcontracted_pre_post_inv.hpp similarity index 90% rename from include/boost/contract/aux_/condition/check_subcontracted_pre_post_inv.hpp rename to include/boost/contract/detail/condition/check_subcontracted_pre_post_inv.hpp index 944f60d..64e8752 100644 --- a/include/boost/contract/aux_/condition/check_subcontracted_pre_post_inv.hpp +++ b/include/boost/contract/detail/condition/check_subcontracted_pre_post_inv.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_CHECK_SUBCONTRACTED_PRE_POST_INV_HPP_ -#define BOOST_CONTRACT_AUX_CHECK_SUBCONTRACTED_PRE_POST_INV_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_CHECK_SUBCONTRACTED_PRE_POST_INV_HPP_ +#define BOOST_CONTRACT_DETAIL_CHECK_SUBCONTRACTED_PRE_POST_INV_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -12,19 +12,19 @@ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) #include #endif -#include -#include -#include +#include +#include +#include #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) #include #include - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include #include #include #include @@ -59,7 +59,7 @@ #include #endif -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { namespace check_subcontracted_pre_post_inv_ { // Exception signals (must not inherit). @@ -68,7 +68,7 @@ namespace check_subcontracted_pre_post_inv_ { } // O, R, F, and Args-i can be none types (but C cannot). -BOOST_CONTRACT_AUX_DECL_AUX_CHECK_SUBCONTRACTED_PRE_POST_INV_Z(1, +BOOST_CONTRACT_DETAIL_DECL_DETAIL_CHECK_SUBCONTRACTED_PRE_POST_INV_Z(1, /* is_friend = */ 0, O, R, F, C, Args) : // Non-copyable base. public check_pre_post_inv { @@ -88,7 +88,7 @@ BOOST_CONTRACT_AUX_DECL_AUX_CHECK_SUBCONTRACTED_PRE_POST_INV_Z(1, boost::mpl::_1 // Base in result, do not add it again. , boost::mpl::eval_if< - typename O::template BOOST_CONTRACT_AUX_NAME1( + typename O::template BOOST_CONTRACT_DETAIL_NAME1( has_member_function)< boost::mpl::_2, typename member_function_types:: @@ -146,8 +146,8 @@ public: boost::contract::virtual_* v, C* obj, R& r - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) - BOOST_CONTRACT_AUX_TVARIADIC_FPARAMS_Z(1, + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) + BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAMS_Z(1, BOOST_CONTRACT_MAX_ARGS, Args, &, args) ) : check_pre_post_inv(from, obj) @@ -157,8 +157,8 @@ public: #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) - BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INIT_Z(1, + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) + BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INIT_Z(1, BOOST_CONTRACT_MAX_ARGS, args_, args) #endif { @@ -168,7 +168,7 @@ public: if(v) { base_call_ = true; v_ = v; // Invariant: v_ never null if base_call_. - BOOST_CONTRACT_AUX_DEBUG(v_); + BOOST_CONTRACT_DETAIL_DEBUG(v_); } else { base_call_ = false; if(!boost::mpl::empty::value) { @@ -317,7 +317,7 @@ private: template typename boost::disable_if >::type check_post_r(Result const& r) { - BOOST_CONTRACT_AUX_DEBUG(r); + BOOST_CONTRACT_DETAIL_DEBUG(r); this->check_post(*r); } #endif @@ -413,12 +413,12 @@ private: template void operator()(B*) { - BOOST_CONTRACT_AUX_DEBUG(me_.object()); - BOOST_CONTRACT_AUX_DEBUG(me_.v_); - BOOST_CONTRACT_AUX_DEBUG(me_.v_->action_ != + BOOST_CONTRACT_DETAIL_DEBUG(me_.object()); + BOOST_CONTRACT_DETAIL_DEBUG(me_.v_); + BOOST_CONTRACT_DETAIL_DEBUG(me_.v_->action_ != boost::contract::virtual_::no_action); try { - call(BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INDEXES_OF( + call(BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INDEXES_OF( Args)); } catch(check_subcontracted_pre_post_inv_:: signal_no_error const&) { @@ -430,16 +430,17 @@ private: template< class B // Can't use TVARIADIC_COMMA here. - BOOST_PP_COMMA_IF(BOOST_CONTRACT_AUX_TVARIADIC) - BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INDEXES_TPARAM(I) + BOOST_PP_COMMA_IF(BOOST_CONTRACT_DETAIL_TVARIADIC) + BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INDEXES_TPARAM(I) > void call( - BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_INDEXES_FPARAM(I)) { - O::template BOOST_CONTRACT_AUX_NAME1(call_base)( + BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INDEXES_FPARAM(I)) { + O::template BOOST_CONTRACT_DETAIL_NAME1(call_base)( me_.v_, me_.object() - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) - BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_ELEMS_Z(1, + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA( + BOOST_CONTRACT_MAX_ARGS) + BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_ELEMS_Z(1, BOOST_CONTRACT_MAX_ARGS, I, me_.args_) ); } @@ -456,7 +457,7 @@ private: !defined(BOOST_CONTRACT_NO_INVARIANTS) boost::contract::virtual_* v_; bool base_call_; - BOOST_CONTRACT_AUX_TVARIADIC_TUPLE_Z(1, + BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_Z(1, BOOST_CONTRACT_MAX_ARGS, Args, &, args_) #endif }; diff --git a/include/boost/contract/aux_/config.hpp b/include/boost/contract/detail/config.hpp similarity index 62% rename from include/boost/contract/aux_/config.hpp rename to include/boost/contract/detail/config.hpp index 41958c1..929c628 100644 --- a/include/boost/contract/aux_/config.hpp +++ b/include/boost/contract/detail/config.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_CONFIG_HPP_ -#define BOOST_CONTRACT_AUX_CONFIG_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_CONFIG_HPP_ +#define BOOST_CONTRACT_DETAIL_CONFIG_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -8,13 +8,13 @@ // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html // Export symbols when compiling as shared lib (for internal use only). -// BOOST_CONTRACT_AUX_SOURCE +// BOOST_CONTRACT_DETAIL_SOURCE // Turn off assert(...) in lib's implementation. -// BOOST_CONTRACT_AUX_NDEBUG +// BOOST_CONTRACT_DETAIL_NDEBUG -#ifndef BOOST_CONTRACT_AUX_NAME_PREFIX - #define BOOST_CONTRACT_AUX_NAME_PREFIX boost_contract_auxX +#ifndef BOOST_CONTRACT_DETAIL_NAME_PREFIX + #define BOOST_CONTRACT_DETAIL_NAME_PREFIX boost_contract_detailX #endif #endif // #include guard diff --git a/include/boost/contract/aux_/debug.hpp b/include/boost/contract/detail/debug.hpp similarity index 66% rename from include/boost/contract/aux_/debug.hpp rename to include/boost/contract/detail/debug.hpp index 0b8bc91..58e7a58 100644 --- a/include/boost/contract/aux_/debug.hpp +++ b/include/boost/contract/detail/debug.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_DEBUG_HPP_ -#define BOOST_CONTRACT_AUX_DEBUG_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_DEBUG_HPP_ +#define BOOST_CONTRACT_DETAIL_DEBUG_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -8,12 +8,12 @@ // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html // Usually, never #defined (so "debug" assertions always in code). -#ifdef BOOST_CONTRACT_AUX_NDEBUG - #define BOOST_CONTRACT_AUX_DEBUG(cond) /* nothing */ +#ifdef BOOST_CONTRACT_DETAIL_NDEBUG + #define BOOST_CONTRACT_DETAIL_DEBUG(cond) /* nothing */ #else #include // Extra parenthesis around assert because that is also a macro. - #define BOOST_CONTRACT_AUX_DEBUG(cond) (assert(cond)) + #define BOOST_CONTRACT_DETAIL_DEBUG(cond) (assert(cond)) #endif #endif // #include guard diff --git a/include/boost/contract/aux_/decl.hpp b/include/boost/contract/detail/decl.hpp similarity index 72% rename from include/boost/contract/aux_/decl.hpp rename to include/boost/contract/detail/decl.hpp index 68c0b28..5e243d4 100644 --- a/include/boost/contract/aux_/decl.hpp +++ b/include/boost/contract/detail/decl.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_DECL_HPP_ -#define BOOST_CONTRACT_AUX_DECL_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_DECL_HPP_ +#define BOOST_CONTRACT_DETAIL_DECL_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -8,8 +8,8 @@ // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html // Cannot include core/*.hpp other than config.hpp here (avoid circular incl). -#include -#if !BOOST_CONTRACT_AUX_TVARIADIC +#include +#if !BOOST_CONTRACT_DETAIL_TVARIADIC #include #include #include @@ -21,7 +21,7 @@ /* PUBLIC */ -#define BOOST_CONTRACT_AUX_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \ +#define BOOST_CONTRACT_DETAIL_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \ arity, is_friend, has_result, \ O, R, F, C, Args, \ v, r, f, obj, args \ @@ -32,8 +32,8 @@ BOOST_PP_EXPR_IIF(has_result, typename R) \ , typename F \ , class C \ - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(arity) \ - BOOST_CONTRACT_AUX_TVARIADIC_TPARAMS_Z(z, arity, Args) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(arity) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_TPARAMS_Z(z, arity, Args) \ > \ BOOST_PP_EXPR_IIF(is_friend, friend) \ boost::contract::set_precondition_old_postcondition< \ @@ -45,28 +45,28 @@ BOOST_PP_EXPR_IIF(has_result, R& r) \ , F f \ , C* obj \ - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(arity) \ - BOOST_CONTRACT_AUX_TVARIADIC_FPARAMS_Z(z, arity, Args, &, args) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(arity) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAMS_Z(z, arity, Args, &, args) \ ) -#if BOOST_CONTRACT_AUX_TVARIADIC - #define BOOST_CONTRACT_AUX_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTIONS_Z(z, \ +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTIONS_Z(z, \ O, R, F, C, Args, \ v, r, f, obj, args \ ) \ - BOOST_CONTRACT_AUX_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \ + BOOST_CONTRACT_DETAIL_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \ ~, /* is_friend = */ 1, /* has_result = */ 0, \ O, R, F, C, Args, v, r, f, obj, args \ ); \ - BOOST_CONTRACT_AUX_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \ + BOOST_CONTRACT_DETAIL_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \ ~, /* is_friend = */ 1, /* has_result = */ 1, \ O, R, F, C, Args, v, r, f, obj, args \ ); #else /* PRIVATE */ - #define BOOST_CONTRACT_AUX_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTION_( \ + #define BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTION_( \ z, n, result_O_R_F_C_Args_v_r_f_obj_args) \ - BOOST_CONTRACT_AUX_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \ + BOOST_CONTRACT_DETAIL_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \ /* arity = */ n, \ /* is_friend = */ 1, \ BOOST_PP_TUPLE_ELEM(11, 0, result_O_R_F_C_Args_v_r_f_obj_args), \ @@ -83,32 +83,32 @@ ); /* PUBLIC */ - #define BOOST_CONTRACT_AUX_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTIONS_Z(z, \ + #define BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTIONS_Z(z, \ O, R, F, C, Args, \ v, r, f, obj, args \ ) \ BOOST_PP_REPEAT_ ## z( \ BOOST_PP_INC(BOOST_CONTRACT_MAX_ARGS), \ - BOOST_CONTRACT_AUX_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTION_, \ + BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTION_, \ (/* has_result = */ 0, O, R, F, C, Args, v, r, f, obj, args) \ ) \ BOOST_PP_REPEAT_ ## z( \ BOOST_PP_INC(BOOST_CONTRACT_MAX_ARGS), \ - BOOST_CONTRACT_AUX_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTION_, \ + BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTION_, \ (/* has_result = */ 1, O, R, F, C, Args, v, r, f, obj, args) \ ) #endif -#define BOOST_CONTRACT_AUX_DECL_AUX_CHECK_SUBCONTRACTED_PRE_POST_INV_Z( \ +#define BOOST_CONTRACT_DETAIL_DECL_DETAIL_CHECK_SUBCONTRACTED_PRE_POST_INV_Z( \ z, is_friend, O, R, F, C, Args) \ template< \ class O, typename R, typename F, class C \ - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) \ - BOOST_CONTRACT_AUX_TVARIADIC_TPARAMS_Z(z, \ + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_TPARAMS_Z(z, \ BOOST_CONTRACT_MAX_ARGS, Args) \ > \ BOOST_PP_IIF(is_friend, \ - friend class boost::contract::aux:: \ + friend class boost::contract::detail:: \ , \ class \ ) \ diff --git a/include/boost/contract/aux_/declspec.hpp b/include/boost/contract/detail/declspec.hpp similarity index 67% rename from include/boost/contract/aux_/declspec.hpp rename to include/boost/contract/detail/declspec.hpp index 676592f..9278f9e 100644 --- a/include/boost/contract/aux_/declspec.hpp +++ b/include/boost/contract/detail/declspec.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_DECLSPEC_HPP_ -#define BOOST_CONTRACT_AUX_DECLSPEC_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_DECLSPEC_HPP_ +#define BOOST_CONTRACT_DETAIL_DECLSPEC_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -15,13 +15,13 @@ // used as a shared library. Otherwise, lib's state won't be shared among // different user programs and user libraries. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTRACT_DYN_LINK) - #ifdef BOOST_CONTRACT_AUX_SOURCE - #define BOOST_CONTRACT_AUX_DECLSPEC BOOST_SYMBOL_EXPORT + #ifdef BOOST_CONTRACT_DETAIL_SOURCE + #define BOOST_CONTRACT_DETAIL_DECLSPEC BOOST_SYMBOL_EXPORT #else - #define BOOST_CONTRACT_AUX_DECLSPEC BOOST_SYMBOL_IMPORT + #define BOOST_CONTRACT_DETAIL_DECLSPEC BOOST_SYMBOL_IMPORT #endif #else - #define BOOST_CONTRACT_AUX_DECLSPEC /* nothing */ + #define BOOST_CONTRACT_DETAIL_DECLSPEC /* nothing */ #endif #endif // #include guard diff --git a/include/boost/contract/aux_/inlined/core/exception.hpp b/include/boost/contract/detail/inlined/core/exception.hpp similarity index 98% rename from include/boost/contract/aux_/inlined/core/exception.hpp rename to include/boost/contract/detail/inlined/core/exception.hpp index 3f123f5..08a77e1 100644 --- a/include/boost/contract/aux_/inlined/core/exception.hpp +++ b/include/boost/contract/detail/inlined/core/exception.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_INLINED_EXCEPTION_HPP_ -#define BOOST_CONTRACT_AUX_INLINED_EXCEPTION_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_INLINED_EXCEPTION_HPP_ +#define BOOST_CONTRACT_DETAIL_INLINED_EXCEPTION_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying diff --git a/include/boost/contract/aux_/inlined/aux_/check_guard.hpp b/include/boost/contract/detail/inlined/detail/check_guard.hpp similarity index 81% rename from include/boost/contract/aux_/inlined/aux_/check_guard.hpp rename to include/boost/contract/detail/inlined/detail/check_guard.hpp index 5701c28..c49829f 100644 --- a/include/boost/contract/aux_/inlined/aux_/check_guard.hpp +++ b/include/boost/contract/detail/inlined/detail/check_guard.hpp @@ -1,18 +1,18 @@ -#ifndef BOOST_CONTRACT_AUX_INLINED_AUX_CHECK_GUARD_HPP_ -#define BOOST_CONTRACT_AUX_INLINED_AUX_CHECK_GUARD_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_INLINED_DETAIL_CHECK_GUARD_HPP_ +#define BOOST_CONTRACT_DETAIL_INLINED_DETAIL_CHECK_GUARD_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -#include +#include #ifndef BOOST_CONTRACT_DISABLE_THREADS #include #endif -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { check_guard::check_guard() { #ifndef BOOST_CONTRACT_DISABLE_THREADS diff --git a/include/boost/contract/aux_/name.hpp b/include/boost/contract/detail/name.hpp similarity index 69% rename from include/boost/contract/aux_/name.hpp rename to include/boost/contract/detail/name.hpp index 3ef5947..c52ba2d 100644 --- a/include/boost/contract/aux_/name.hpp +++ b/include/boost/contract/detail/name.hpp @@ -1,13 +1,13 @@ -#ifndef BOOST_CONTRACT_AUX_NAME_HPP_ -#define BOOST_CONTRACT_AUX_NAME_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_NAME_HPP_ +#define BOOST_CONTRACT_DETAIL_NAME_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -#include +#include #include /* PUBLIC */ @@ -15,8 +15,8 @@ // NOTE: Explicitly list number of names to concatenate using ..._NAME-n // (instead of using ..._SEQ_CAT or similar) for optimal speed and reentrancy. -#define BOOST_CONTRACT_AUX_NAME1(name1) \ - BOOST_PP_CAT(BOOST_CONTRACT_AUX_NAME_PREFIX, name1) +#define BOOST_CONTRACT_DETAIL_NAME1(name1) \ + BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_NAME_PREFIX, name1) #endif // #include guard diff --git a/include/boost/contract/aux_/none.hpp b/include/boost/contract/detail/none.hpp similarity index 84% rename from include/boost/contract/aux_/none.hpp rename to include/boost/contract/detail/none.hpp index 3503a74..919ad69 100644 --- a/include/boost/contract/aux_/none.hpp +++ b/include/boost/contract/detail/none.hpp @@ -1,13 +1,13 @@ -#ifndef BOOST_CONTRACT_AUX_NONE_HPP_ -#define BOOST_CONTRACT_AUX_NONE_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_NONE_HPP_ +#define BOOST_CONTRACT_DETAIL_NONE_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { // Tag for "no type". class none { diff --git a/include/boost/contract/aux_/operation/constructor.hpp b/include/boost/contract/detail/operation/constructor.hpp similarity index 89% rename from include/boost/contract/aux_/operation/constructor.hpp rename to include/boost/contract/detail/operation/constructor.hpp index f2cc299..1e0db31 100644 --- a/include/boost/contract/aux_/operation/constructor.hpp +++ b/include/boost/contract/detail/operation/constructor.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_CONSTRUCTOR_HPP_ -#define BOOST_CONTRACT_AUX_CONSTRUCTOR_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_CONSTRUCTOR_HPP_ +#define BOOST_CONTRACT_DETAIL_CONSTRUCTOR_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -9,11 +9,11 @@ #include #include -#include -#include +#include +#include #if !defined(BOOST_CONTRACT_NO_INVARIANTS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) - #include + #include #endif #if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) @@ -21,7 +21,7 @@ #include #endif -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { // Ctor subcontracting impl via C++ obj construction mechanism. template diff --git a/include/boost/contract/aux_/operation/destructor.hpp b/include/boost/contract/detail/operation/destructor.hpp similarity index 90% rename from include/boost/contract/aux_/operation/destructor.hpp rename to include/boost/contract/detail/operation/destructor.hpp index 16e685c..97e2324 100644 --- a/include/boost/contract/aux_/operation/destructor.hpp +++ b/include/boost/contract/detail/operation/destructor.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_DESTRUCTOR_HPP_ -#define BOOST_CONTRACT_AUX_DESTRUCTOR_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_DESTRUCTOR_HPP_ +#define BOOST_CONTRACT_DETAIL_DESTRUCTOR_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -9,11 +9,11 @@ #include #include -#include -#include +#include +#include #if !defined(BOOST_CONTRACT_NO_INVARIANTS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) - #include + #include #endif #if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) @@ -21,7 +21,7 @@ #include #endif -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { // Dtor subcontracting impl via C++ obj destruction mechanism. template diff --git a/include/boost/contract/aux_/operation/function.hpp b/include/boost/contract/detail/operation/function.hpp similarity index 87% rename from include/boost/contract/aux_/operation/function.hpp rename to include/boost/contract/detail/operation/function.hpp index e4fee80..6413db5 100644 --- a/include/boost/contract/aux_/operation/function.hpp +++ b/include/boost/contract/detail/operation/function.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_FUNCTION_HPP_ -#define BOOST_CONTRACT_AUX_FUNCTION_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_FUNCTION_HPP_ +#define BOOST_CONTRACT_DETAIL_FUNCTION_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -9,17 +9,17 @@ #include #include -#include +#include #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) - #include + #include #endif #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS #include #include #endif -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { // Used for free function, private and protected member functions. class function : diff --git a/include/boost/contract/aux_/operation/public_function.hpp b/include/boost/contract/detail/operation/public_function.hpp similarity index 80% rename from include/boost/contract/aux_/operation/public_function.hpp rename to include/boost/contract/detail/operation/public_function.hpp index ea04e86..0c49113 100644 --- a/include/boost/contract/aux_/operation/public_function.hpp +++ b/include/boost/contract/detail/operation/public_function.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_PUBLIC_FUNCTION_HPP_ -#define BOOST_CONTRACT_AUX_PUBLIC_FUNCTION_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_PUBLIC_FUNCTION_HPP_ +#define BOOST_CONTRACT_DETAIL_PUBLIC_FUNCTION_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -10,13 +10,13 @@ #include #include #include -#include -#include +#include +#include #include #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - #include + #include #endif #if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) @@ -26,36 +26,36 @@ #include #endif -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { template< class O, typename R, typename F, class C - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) - BOOST_CONTRACT_AUX_TVARIADIC_TPARAMS_Z(1, BOOST_CONTRACT_MAX_ARGS, Args) + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) + BOOST_CONTRACT_DETAIL_TVARIADIC_TPARAMS_Z(1, BOOST_CONTRACT_MAX_ARGS, Args) > class public_function : // Non-copyable base. public check_subcontracted_pre_post_inv< O, R, F, C - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) - BOOST_CONTRACT_AUX_TVARIADIC_ARGS_Z(1, BOOST_CONTRACT_MAX_ARGS, Args) + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) + BOOST_CONTRACT_DETAIL_TVARIADIC_ARGS_Z(1, BOOST_CONTRACT_MAX_ARGS, Args) > { public: explicit public_function( boost::contract::virtual_* v, C* obj, R& r - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) - BOOST_CONTRACT_AUX_TVARIADIC_FPARAMS_Z(1, + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) + BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAMS_Z(1, BOOST_CONTRACT_MAX_ARGS, Args, &, args) ) : check_subcontracted_pre_post_inv< O, R, F, C - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) - BOOST_CONTRACT_AUX_TVARIADIC_ARGS_Z(1, + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) + BOOST_CONTRACT_DETAIL_TVARIADIC_ARGS_Z(1, BOOST_CONTRACT_MAX_ARGS, Args) >( boost::contract::from_function, v, obj, r - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) - BOOST_CONTRACT_AUX_TVARIADIC_ARGS_Z(1, + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) + BOOST_CONTRACT_DETAIL_TVARIADIC_ARGS_Z(1, BOOST_CONTRACT_MAX_ARGS, args) ) {} diff --git a/include/boost/contract/aux_/operation/public_static_function.hpp b/include/boost/contract/detail/operation/public_static_function.hpp similarity index 90% rename from include/boost/contract/aux_/operation/public_static_function.hpp rename to include/boost/contract/detail/operation/public_static_function.hpp index a9edecd..1e809b7 100644 --- a/include/boost/contract/aux_/operation/public_static_function.hpp +++ b/include/boost/contract/detail/operation/public_static_function.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_PUBLIC_STATIC_FUNCTION_HPP_ -#define BOOST_CONTRACT_AUX_PUBLIC_STATIC_FUNCTION_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_PUBLIC_STATIC_FUNCTION_HPP_ +#define BOOST_CONTRACT_DETAIL_PUBLIC_STATIC_FUNCTION_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -9,12 +9,12 @@ #include #include -#include -#include +#include +#include #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(OOST_CONTRACT_NO_INVARIANTS) - #include + #include #endif #if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) @@ -24,7 +24,7 @@ #include #endif -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { // No subcontracting because static so no obj and no substitution principle. template diff --git a/include/boost/contract/aux_/operator_safe_bool.hpp b/include/boost/contract/detail/operator_safe_bool.hpp similarity index 57% rename from include/boost/contract/aux_/operator_safe_bool.hpp rename to include/boost/contract/detail/operator_safe_bool.hpp index 87750dd..160edbc 100644 --- a/include/boost/contract/aux_/operator_safe_bool.hpp +++ b/include/boost/contract/detail/operator_safe_bool.hpp @@ -1,13 +1,13 @@ -#ifndef BOOST_CONTRACT_AUX_OPERATOR_SAFE_BOOL_HPP_ -#define BOOST_CONTRACT_AUX_OPERATOR_SAFE_BOOL_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_OPERATOR_SAFE_BOOL_HPP_ +#define BOOST_CONTRACT_DETAIL_OPERATOR_SAFE_BOOL_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -#include +#include #include #include @@ -23,48 +23,48 @@ #if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) && \ !defined(BOOST_NO_CXX11_NULLPTR) - #define BOOST_CONTRACT_AUX_OPERATOR_SAFE_BOOL(this_type, bool_expr) \ + #define BOOST_CONTRACT_DETAIL_OPERATOR_SAFE_BOOL(this_type, bool_expr) \ explicit operator bool() const BOOST_NOEXCEPT { return (bool_expr); } \ BOOST_CONTRACT_OPERATOR_SAFE_BOOL_NOT_(bool_expr) #elif (defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || \ defined(__CINT__) - #define BOOST_CONTRACT_AUX_OPERATOR_SAFE_BOOL(this_type, bool_expr) \ + #define BOOST_CONTRACT_DETAIL_OPERATOR_SAFE_BOOL(this_type, bool_expr) \ operator bool() const BOOST_NOEXCEPT { return (bool_expr); } \ BOOST_CONTRACT_OPERATOR_SAFE_BOOL_NOT_(bool_expr) #elif defined(_MANAGED) - #define BOOST_CONTRACT_AUX_OPERATOR_SAFE_BOOL(this_type, bool_expr) \ - static void BOOST_CONTRACT_AUX_NAME1(operator_safe_bool_func)( \ + #define BOOST_CONTRACT_DETAIL_OPERATOR_SAFE_BOOL(this_type, bool_expr) \ + static void BOOST_CONTRACT_DETAIL_NAME1(operator_safe_bool_func)( \ this_type***) {} \ - typedef void (*BOOST_CONTRACT_AUX_NAME1(operator_safe_bool_type))( \ + typedef void (*BOOST_CONTRACT_DETAIL_NAME1(operator_safe_bool_type))( \ this_type***); \ - operator BOOST_CONTRACT_AUX_NANE(operator_safe_bool_type)() \ + operator BOOST_CONTRACT_DETAIL_NANE(operator_safe_bool_type)() \ const BOOST_NOEXCEPT { \ return (bool_expr) ? \ - &BOOST_CONTRACT_AUX_NAME1(operator_safe_bool_func) : 0; \ + &BOOST_CONTRACT_DETAIL_NAME1(operator_safe_bool_func) : 0; \ } \ BOOST_CONTRACT_OPERATOR_SAFE_BOOL_NOT_(bool_expr) #elif (defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200)) || \ (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304)) || \ (defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)) - #define BOOST_CONTRACT_AUX_OPERATOR_SAFE_BOOL(this_type, bool_expr) \ - void BOOST_CONTRACT_AUX_NAME1(operator_safe_bool_func)() const {} \ - typedef void (this_type:: \ - *BOOST_CONTRACT_AUX_NAME1(operator_safe_bool_type))() const; \ - operator BOOST_CONTRACT_AUX_NAME1(operator_safe_bool_type)() \ + #define BOOST_CONTRACT_DETAIL_OPERATOR_SAFE_BOOL(this_type, bool_expr) \ + void BOOST_CONTRACT_DETAIL_NAME1(operator_safe_bool_func)() const {} \ + typedef void (this_type::*BOOST_CONTRACT_DETAIL_NAME1( \ + operator_safe_bool_type))() const; \ + operator BOOST_CONTRACT_DETAIL_NAME1(operator_safe_bool_type)() \ const BOOST_NOEXCEPT { \ return (bool_expr) ? &this_type:: \ - BOOST_CONTRACT_AUX_NAME1(operator_safe_bool_func) : 0; \ + BOOST_CONTRACT_DETAIL_NAME1(operator_safe_bool_func) : 0; \ } \ BOOST_CONTRACT_OPERATOR_SAFE_BOOL_NOT_(bool_expr) #else - #define BOOST_CONTRACT_AUX_OPERATOR_SAFE_BOOL(this_type, bool_expr) \ - void* BOOST_CONTRACT_AUX_NAME1(operator_safe_bool_data); \ - typedef void* this_type::*BOOST_CONTRACT_AUX_NAME1( \ + #define BOOST_CONTRACT_DETAIL_OPERATOR_SAFE_BOOL(this_type, bool_expr) \ + void* BOOST_CONTRACT_DETAIL_NAME1(operator_safe_bool_data); \ + typedef void* this_type::*BOOST_CONTRACT_DETAIL_NAME1( \ operator_safe_bool_type);\ - operator BOOST_CONTRACT_AUX_NAME1(operator_safe_bool_type)() \ + operator BOOST_CONTRACT_DETAIL_NAME1(operator_safe_bool_type)() \ const BOOST_NOEXCEPT { \ return (bool_expr) ? &this_type:: \ - BOOST_CONTRACT_AUX_NAME1(operator_safe_bool_data) : 0; \ + BOOST_CONTRACT_DETAIL_NAME1(operator_safe_bool_data) : 0; \ } \ BOOST_CONTRACT_OPERATOR_SAFE_BOOL_NOT_(bool_expr) #endif diff --git a/include/boost/contract/aux_/preprocessor/keyword/private.hpp b/include/boost/contract/detail/preprocessor/keyword/private.hpp similarity index 54% rename from include/boost/contract/aux_/preprocessor/keyword/private.hpp rename to include/boost/contract/detail/preprocessor/keyword/private.hpp index fa7e816..47d9ac9 100644 --- a/include/boost/contract/aux_/preprocessor/keyword/private.hpp +++ b/include/boost/contract/detail/preprocessor/keyword/private.hpp @@ -1,35 +1,35 @@ -#ifndef BOOST_CONTRACT_AUX_PP_KEYWORD_PRIVATE_HPP_ -#define BOOST_CONTRACT_AUX_PP_KEYWORD_PRIVATE_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_PP_KEYWORD_PRIVATE_HPP_ +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PRIVATE_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -#include +#include #include /* PRIVATE */ // Must expand to a single comma `,` (not local macros, do not #undefine). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_PRIVATE_CAT_TO_COMMAprivate , +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PRIVATE_CAT_TO_COMMAprivate , // Must expand to empty `` (not local macros, do not #undefine). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_PRIVATE_CAT_TO_EMPTYprivate +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PRIVATE_CAT_TO_EMPTYprivate /* PUBLIC */ // Precondition: tokens must start with a token concatenable to a macro name // (e.g., a literal or integral token). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_IS_PRIVATE(tokens) \ - BOOST_CONTRACT_AUX_PP_KEYWORD_UTILITY_IS( \ - BOOST_CONTRACT_AUX_PP_KEYWORD_PRIVATE_CAT_TO_COMMA, tokens) +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_PRIVATE(tokens) \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS( \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_PRIVATE_CAT_TO_COMMA, tokens) // Precondition: tokens must start with `private` (this can be // checked with `..._IS_PRIVATE` macro above). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_REMOVE_PRIVATE(tokens) \ - BOOST_PP_CAT(BOOST_CONTRACT_AUX_PP_KEYWORD_PRIVATE_CAT_TO_EMPTY, tokens) +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_REMOVE_PRIVATE(tokens) \ + BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_KEYWORD_PRIVATE_CAT_TO_EMPTY, tokens) #endif // #include guard diff --git a/include/boost/contract/aux_/preprocessor/keyword/protected.hpp b/include/boost/contract/detail/preprocessor/keyword/protected.hpp similarity index 53% rename from include/boost/contract/aux_/preprocessor/keyword/protected.hpp rename to include/boost/contract/detail/preprocessor/keyword/protected.hpp index 925b63d..9baa8a2 100644 --- a/include/boost/contract/aux_/preprocessor/keyword/protected.hpp +++ b/include/boost/contract/detail/preprocessor/keyword/protected.hpp @@ -1,35 +1,36 @@ -#ifndef BOOST_CONTRACT_AUX_PP_KEYWORD_PROTECTED_HPP_ -#define BOOST_CONTRACT_AUX_PP_KEYWORD_PROTECTED_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_PP_KEYWORD_PROTECTED_HPP_ +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PROTECTED_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -#include +#include #include /* PRIVATE */ // Must expand to a single comma `,` (not local macros, do not #undefine). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_PROTECTED_CAT_TO_COMMAprotected , +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PROTECTED_CAT_TO_COMMAprotected , // Must expand to empty `` (not local macros, do not #undefine). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_PROTECTED_CAT_TO_EMPTYprotected +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PROTECTED_CAT_TO_EMPTYprotected /* PUBLIC */ // Precondition: tokens must start with a token concatenable to a macro name // (e.g., a literal or integral token). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_IS_PROTECTED(tokens) \ - BOOST_CONTRACT_AUX_PP_KEYWORD_UTILITY_IS( \ - BOOST_CONTRACT_AUX_PP_KEYWORD_PROTECTED_CAT_TO_COMMA, tokens) +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_PROTECTED(tokens) \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS( \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_PROTECTED_CAT_TO_COMMA, tokens) // Precondition: tokens must start with `protected` (this can be // checked with `..._IS_PROTECTED` macro above). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_REMOVE_PROTECTED(tokens) \ - BOOST_PP_CAT(BOOST_CONTRACT_AUX_PP_KEYWORD_PROTECTED_CAT_TO_EMPTY, tokens) +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_REMOVE_PROTECTED(tokens) \ + BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_KEYWORD_PROTECTED_CAT_TO_EMPTY, \ + tokens) #endif // #include guard diff --git a/include/boost/contract/aux_/preprocessor/keyword/public.hpp b/include/boost/contract/detail/preprocessor/keyword/public.hpp similarity index 54% rename from include/boost/contract/aux_/preprocessor/keyword/public.hpp rename to include/boost/contract/detail/preprocessor/keyword/public.hpp index f3b1704..67deb31 100644 --- a/include/boost/contract/aux_/preprocessor/keyword/public.hpp +++ b/include/boost/contract/detail/preprocessor/keyword/public.hpp @@ -1,35 +1,35 @@ -#ifndef BOOST_CONTRACT_AUX_PP_KEYWORD_PUBLIC_HPP_ -#define BOOST_CONTRACT_AUX_PP_KEYWORD_PUBLIC_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_PP_KEYWORD_PUBLIC_HPP_ +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PUBLIC_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -#include +#include #include /* PRIVATE */ // Must expand to a single comma `,` (not local macros, do not #undefine). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_PUBLIC_CAT_TO_COMMApublic , +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PUBLIC_CAT_TO_COMMApublic , // Must expand to empty `` (not local macros, do not #undefine). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_PUBLIC_CAT_TO_EMPTYpublic +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PUBLIC_CAT_TO_EMPTYpublic /* PUBLIC */ // Precondition: tokens must start with a token concatenable to a macro name // (e.g., a literal or integral token). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_IS_PUBLIC(tokens) \ - BOOST_CONTRACT_AUX_PP_KEYWORD_UTILITY_IS( \ - BOOST_CONTRACT_AUX_PP_KEYWORD_PUBLIC_CAT_TO_COMMA, tokens) +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_PUBLIC(tokens) \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS( \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_PUBLIC_CAT_TO_COMMA, tokens) // Precondition: tokens must start with `public` (this can be // checked with `..._IS_PUBLIC` macro above). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_REMOVE_PUBLIC(tokens) \ - BOOST_PP_CAT(BOOST_CONTRACT_AUX_PP_KEYWORD_PUBLIC_CAT_TO_EMPTY, tokens) +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_REMOVE_PUBLIC(tokens) \ + BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_KEYWORD_PUBLIC_CAT_TO_EMPTY, tokens) #endif // #include guard diff --git a/include/boost/contract/aux_/preprocessor/keyword/utility/is.hpp b/include/boost/contract/detail/preprocessor/keyword/utility/is.hpp similarity index 66% rename from include/boost/contract/aux_/preprocessor/keyword/utility/is.hpp rename to include/boost/contract/detail/preprocessor/keyword/utility/is.hpp index 7b47e92..2ac3985 100644 --- a/include/boost/contract/aux_/preprocessor/keyword/utility/is.hpp +++ b/include/boost/contract/detail/preprocessor/keyword/utility/is.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_IS_HPP_ -#define BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_IS_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS_HPP_ +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -12,8 +12,8 @@ /* PRIVATE */ -#define BOOST_CONTRACT_AUX_PP_KEYWORD_UTILITY_IS_1 0 -#define BOOST_CONTRACT_AUX_PP_KEYWORD_UTILITY_IS_2 1 +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS_1 0 +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS_2 1 /* PUBLIC */ @@ -21,8 +21,9 @@ // #defined to expand to `,`. // Precondition: tokens must start with a token concatenable to a macro name // (e.g., a literal or integral token). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_UTILITY_IS(cat_to_comma_prefix, tokens) \ - BOOST_PP_CAT(BOOST_CONTRACT_AUX_PP_KEYWORD_UTILITY_IS_, \ +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS( \ + cat_to_comma_prefix, tokens) \ + BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS_, \ BOOST_PP_VARIADIC_SIZE(BOOST_PP_CAT(cat_to_comma_prefix, tokens))) #endif // #include guard diff --git a/include/boost/contract/aux_/preprocessor/keyword/virtual.hpp b/include/boost/contract/detail/preprocessor/keyword/virtual.hpp similarity index 54% rename from include/boost/contract/aux_/preprocessor/keyword/virtual.hpp rename to include/boost/contract/detail/preprocessor/keyword/virtual.hpp index 8b3e65f..7eb53f0 100644 --- a/include/boost/contract/aux_/preprocessor/keyword/virtual.hpp +++ b/include/boost/contract/detail/preprocessor/keyword/virtual.hpp @@ -1,35 +1,35 @@ -#ifndef BOOST_CONTRACT_AUX_PP_KEYWORD_VIRTUAL_HPP_ -#define BOOST_CONTRACT_AUX_PP_KEYWORD_VIRTUAL_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_PP_KEYWORD_VIRTUAL_HPP_ +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_VIRTUAL_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -#include +#include #include /* PRIVATE */ // Must expand to a single comma `,` (not local macros, do not #undefine). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_VIRTUAL_CAT_TO_COMMAvirtual , +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_VIRTUAL_CAT_TO_COMMAvirtual , // Must expand to empty `` (not local macros, do not #undefine). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_VIRTUAL_CAT_TO_EMPTYvirtual +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_VIRTUAL_CAT_TO_EMPTYvirtual /* PUBLIC */ // Precondition: tokens must start with a token concatenable to a macro name // (e.g., a literal or integral token). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_IS_VIRTUAL(tokens) \ - BOOST_CONTRACT_AUX_PP_KEYWORD_UTILITY_IS( \ - BOOST_CONTRACT_AUX_PP_KEYWORD_VIRTUAL_CAT_TO_COMMA, tokens) +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_VIRTUAL(tokens) \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS( \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_VIRTUAL_CAT_TO_COMMA, tokens) // Precondition: tokens must start with `virtual` (this can be // checked with `..._IS_VIRTUAL` macro above). -#define BOOST_CONTRACT_AUX_PP_KEYWORD_REMOVE_VIRTUAL(tokens) \ - BOOST_PP_CAT(BOOST_CONTRACT_AUX_PP_KEYWORD_VIRTUAL_CAT_TO_EMPTY, tokens) +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_REMOVE_VIRTUAL(tokens) \ + BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_KEYWORD_VIRTUAL_CAT_TO_EMPTY, tokens) #endif // #include guard diff --git a/include/boost/contract/detail/tvariadic.hpp b/include/boost/contract/detail/tvariadic.hpp new file mode 100644 index 0000000..2c9a52e --- /dev/null +++ b/include/boost/contract/detail/tvariadic.hpp @@ -0,0 +1,190 @@ + +#ifndef BOOST_CONTRACT_DETAIL_TVARIADIC_HPP_ +#define BOOST_CONTRACT_DETAIL_TVARIADIC_HPP_ + +// Copyright (C) 2008-2016 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 (see accompanying +// file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). +// See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html + +#include +#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES + #define BOOST_CONTRACT_DETAIL_TVARIADIC 0 +#else + #define BOOST_CONTRACT_DETAIL_TVARIADIC 1 +#endif + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #include + + /* CODE */ + + namespace boost { namespace contract { namespace detail { + namespace tvariadic_ { + template struct indexes {}; + + template struct indexes_of : + indexes_of {}; + template struct indexes_of<0, I...> + { typedef indexes type; }; + } } } } // namespace + +#else + #include + #include + #include + #include + #include + + /* PRIVATE */ + + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_ELEM_(z, n, tuple) \ + BOOST_PP_CAT(tuple, n) + + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INIT_(z, n, tuplevar_values) \ + BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, tuplevar_values), n)( \ + BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 1, tuplevar_values), n)) + + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_(z, n, type_qualifier_name) \ + BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 0, type_qualifier_name), n) \ + BOOST_PP_TUPLE_ELEM(3, 1, type_qualifier_name) \ + BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 2, type_qualifier_name), n) \ + ; + + #define BOOST_CONTRACT_DETAIL_NO_TVARIADIC_ENUM_(z, n, tokens) \ + tokens + + #define BOOST_CONTRACT_DETAIL_TVARIADIC_ARG_(z, n, name) \ + BOOST_PP_CAT(name, n) + + #define BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAM_(z, n, type_qualifier_name) \ + BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 0, type_qualifier_name), n) \ + BOOST_PP_TUPLE_ELEM(3, 1, type_qualifier_name) \ + BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 2, type_qualifier_name), n) + + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TPARAM_(z, n, name) \ + typename BOOST_PP_CAT(name, n) +#endif + +/* PUBLIC */ + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(arity) \ + , +#else + #define BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(arity) \ + BOOST_PP_COMMA_IF(arity) +#endif + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_NO_TVARIADIC_COMMA(arity) /* nothing */ +#else + #define BOOST_CONTRACT_DETAIL_NO_TVARIADIC_COMMA(arity) \ + BOOST_PP_COMMA_IF(arity) +#endif + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_TVARIADIC_SIZEOF(arity, name) sizeof...(name) +#else + #define BOOST_CONTRACT_DETAIL_TVARIADIC_SIZEOF(arity, name) arity +#endif + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TPARAMS_Z(z, arity, name) \ + typename... name +#else + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TPARAMS_Z(z, arity, name) \ + BOOST_PP_ENUM_ ## z(arity, BOOST_CONTRACT_DETAIL_TVARIADIC_TPARAM_, \ + name) +#endif + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAMS_Z( \ + z, arity, type, qualifier, name) \ + type qualifier ... name +#else + #define BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAMS_Z( \ + z, arity, type, qualifier, name) \ + BOOST_PP_ENUM_ ## z(arity, BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAM_, \ + (type, qualifier, name)) +#endif + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_TVARIADIC_ARGS_Z(z, arity, name) \ + name... +#else + #define BOOST_CONTRACT_DETAIL_TVARIADIC_ARGS_Z(z, arity, name) \ + BOOST_PP_ENUM_ ## z(arity, BOOST_CONTRACT_DETAIL_TVARIADIC_ARG_, name) +#endif + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_NO_TVARIADIC_ENUM_Z(z, arity, tokens) \ + /* nothing */ +#else + #define BOOST_CONTRACT_DETAIL_NO_TVARIADIC_ENUM_Z(z, arity, tokens) \ + BOOST_PP_ENUM_ ## z(arity, BOOST_CONTRACT_DETAIL_NO_TVARIADIC_ENUM_, \ + tokens) +#endif + +// Tuple. + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_Z( \ + z, arity, type, qualifier, name) \ + std::tuple name; +#else + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_Z( \ + z, arity, type, qualifier, name) \ + BOOST_PP_REPEAT_ ## z(arity, BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_, \ + (type, qualifier, name)) +#endif + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INIT_Z(z, \ + arity, tuple, values) \ + tuple(values...) +#else + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INIT_Z(z, \ + arity, tuple, values) \ + BOOST_PP_ENUM_ ## z(arity, BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INIT_,\ + (tuple, values)) +#endif + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INDEXES_TPARAM(indexes) \ + int... indexes +#else + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INDEXES_TPARAM(indexes) \ + /* nothing */ +#endif + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INDEXES_FPARAM(_indexes) \ + boost::contract::detail::tvariadic_::indexes<_indexes...> +#else + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INDEXES_FPARAM(_indexes) \ + /* nothing */ +#endif + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INDEXES_OF(tuple_type) \ + typename boost::contract::detail::tvariadic_::indexes_of< \ + sizeof...(tuple_type)>::type() +#else + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INDEXES_OF(unused) \ + /* nothing */ +#endif + +#if BOOST_CONTRACT_DETAIL_TVARIADIC + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_ELEMS_Z( \ + z, arity, indexes, tuple) \ + std::get(tuple)... +#else + #define BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_ELEMS_Z( \ + z, arity, indexes, tuple) \ + BOOST_PP_ENUM_ ## z(arity, BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_ELEM_,\ + tuple) +#endif + +#endif // #include guard + diff --git a/include/boost/contract/aux_/type_traits/introspection.hpp b/include/boost/contract/detail/type_traits/introspection.hpp similarity index 50% rename from include/boost/contract/aux_/type_traits/introspection.hpp rename to include/boost/contract/detail/type_traits/introspection.hpp index 954b06d..002fe58 100644 --- a/include/boost/contract/aux_/type_traits/introspection.hpp +++ b/include/boost/contract/detail/type_traits/introspection.hpp @@ -1,13 +1,13 @@ -#ifndef BOOST_CONTRACT_AUX_INTROSPECTION_HPP_ -#define BOOST_CONTRACT_AUX_INTROSPECTION_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_INTROSPECTION_HPP_ +#define BOOST_CONTRACT_DETAIL_INTROSPECTION_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -#include +#include #include #include #include @@ -24,26 +24,26 @@ /* PRIVATE */ -#define BOOST_CONTRACT_AUX_INTROSPECTION_END_(tparam) \ +#define BOOST_CONTRACT_DETAIL_INTROSPECTION_END_(tparam) \ template \ - static boost::contract::aux::introspection::no& check(...); \ + static boost::contract::detail::introspection::no& check(...); \ public: \ static bool const value = sizeof(check(0)) == \ - sizeof(boost::contract::aux::introspection::yes); \ + sizeof(boost::contract::detail::introspection::yes); \ typedef boost::mpl::bool_ type; -#define BOOST_CONTRACT_AUX_INTROSPECTION_HAS_MEMBER_FUNCTION_(is_static, \ +#define BOOST_CONTRACT_DETAIL_INTROSPECTION_HAS_MEMBER_FUNCTION_(is_static, \ trait, func_name) \ template< \ - typename BOOST_CONTRACT_AUX_NAME1(T), \ - typename BOOST_CONTRACT_AUX_NAME1(R), \ - class BOOST_CONTRACT_AUX_NAME1(P), \ - class BOOST_CONTRACT_AUX_NAME1(G) = boost::function_types::null_tag \ + typename BOOST_CONTRACT_DETAIL_NAME1(T), \ + typename BOOST_CONTRACT_DETAIL_NAME1(R), \ + class BOOST_CONTRACT_DETAIL_NAME1(P), \ + class BOOST_CONTRACT_DETAIL_NAME1(G) = boost::function_types::null_tag \ > \ class trait { \ - template \ - static boost::contract::aux::introspection::yes& check( \ - boost::contract::aux::introspection::check_function< \ + template \ + static boost::contract::detail::introspection::yes& check( \ + boost::contract::detail::introspection::check_function< \ typename \ BOOST_PP_IIF(is_static, \ boost::function_types::function_pointer \ @@ -53,50 +53,53 @@ < \ typename boost::mpl::push_front< \ BOOST_PP_IIF(is_static, \ - BOOST_CONTRACT_AUX_NAME1(P) \ + BOOST_CONTRACT_DETAIL_NAME1(P) \ BOOST_PP_TUPLE_EAT(2) \ , \ BOOST_PP_TUPLE_REM(2) \ )( \ typename boost::mpl::push_front< \ - BOOST_CONTRACT_AUX_NAME1(P), \ - BOOST_CONTRACT_AUX_NAME1(C) \ + BOOST_CONTRACT_DETAIL_NAME1(P), \ + BOOST_CONTRACT_DETAIL_NAME1(C) \ >::type \ ) \ - , BOOST_CONTRACT_AUX_NAME1(R) \ + , BOOST_CONTRACT_DETAIL_NAME1(R) \ >::type, \ - BOOST_CONTRACT_AUX_NAME1(G) \ + BOOST_CONTRACT_DETAIL_NAME1(G) \ >::type, \ - &BOOST_CONTRACT_AUX_NAME1(C)::func_name \ + &BOOST_CONTRACT_DETAIL_NAME1(C)::func_name \ >* \ ); \ - BOOST_CONTRACT_AUX_INTROSPECTION_END_(BOOST_CONTRACT_AUX_NAME1(T)) \ + BOOST_CONTRACT_DETAIL_INTROSPECTION_END_( \ + BOOST_CONTRACT_DETAIL_NAME1(T)) \ }; /* PUBLIC */ -#define BOOST_CONTRACT_AUX_INTROSPECTION_HAS_TYPE(trait, type_name)\ - template \ +#define BOOST_CONTRACT_DETAIL_INTROSPECTION_HAS_TYPE(trait, type_name)\ + template \ class trait { \ - template \ - static boost::contract::aux::introspection::yes& check( \ - typename BOOST_CONTRACT_AUX_NAME1(C)::type_name*); \ - BOOST_CONTRACT_AUX_INTROSPECTION_END_(BOOST_CONTRACT_AUX_NAME1(T)) \ + template \ + static boost::contract::detail::introspection::yes& check( \ + typename BOOST_CONTRACT_DETAIL_NAME1(C)::type_name*); \ + BOOST_CONTRACT_DETAIL_INTROSPECTION_END_( \ + BOOST_CONTRACT_DETAIL_NAME1(T)) \ }; -#define BOOST_CONTRACT_AUX_INTROSPECTION_HAS_MEMBER_FUNCTION( \ +#define BOOST_CONTRACT_DETAIL_INTROSPECTION_HAS_MEMBER_FUNCTION( \ trait, func_name) \ - BOOST_CONTRACT_AUX_INTROSPECTION_HAS_MEMBER_FUNCTION_(/* is_static = */ 0, \ - trait, func_name) + BOOST_CONTRACT_DETAIL_INTROSPECTION_HAS_MEMBER_FUNCTION_( \ + /* is_static = */ 0, trait, func_name) -#define BOOST_CONTRACT_AUX_INTROSPECTION_HAS_STATIC_MEMBER_FUNCTION(trait, \ +#define BOOST_CONTRACT_DETAIL_INTROSPECTION_HAS_STATIC_MEMBER_FUNCTION(trait, \ func_name) \ - BOOST_CONTRACT_AUX_INTROSPECTION_HAS_MEMBER_FUNCTION_(/* is_static = */ 1, \ - trait, func_name) + BOOST_CONTRACT_DETAIL_INTROSPECTION_HAS_MEMBER_FUNCTION_( \ + /* is_static = */ 1, trait, func_name) /* CODE */ -namespace boost { namespace contract { namespace aux { namespace introspection { +namespace boost { namespace contract { namespace detail { + namespace introspection { typedef class {} yes; typedef yes no[2]; diff --git a/include/boost/contract/aux_/type_traits/member_function_types.hpp b/include/boost/contract/detail/type_traits/member_function_types.hpp similarity index 91% rename from include/boost/contract/aux_/type_traits/member_function_types.hpp rename to include/boost/contract/detail/type_traits/member_function_types.hpp index 677f7b9..f4107c3 100644 --- a/include/boost/contract/aux_/type_traits/member_function_types.hpp +++ b/include/boost/contract/detail/type_traits/member_function_types.hpp @@ -1,13 +1,13 @@ -#ifndef BOOST_CONTRACT_AUX_MEMBER_FUNCTION_TYPES_HPP_ -#define BOOST_CONTRACT_AUX_MEMBER_FUNCTION_TYPES_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_MEMBER_FUNCTION_TYPES_HPP_ +#define BOOST_CONTRACT_DETAIL_MEMBER_FUNCTION_TYPES_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -#include +#include #include #include #include @@ -27,7 +27,7 @@ namespace boost { } } -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { template struct member_function_types { diff --git a/include/boost/contract/aux_/type_traits/optional.hpp b/include/boost/contract/detail/type_traits/optional.hpp similarity index 87% rename from include/boost/contract/aux_/type_traits/optional.hpp rename to include/boost/contract/detail/type_traits/optional.hpp index e325340..88c256c 100644 --- a/include/boost/contract/aux_/type_traits/optional.hpp +++ b/include/boost/contract/detail/type_traits/optional.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_OPTIONAL_HPP_ -#define BOOST_CONTRACT_AUX_OPTIONAL_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_OPTIONAL_HPP_ +#define BOOST_CONTRACT_DETAIL_OPTIONAL_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -11,7 +11,7 @@ #include #include -namespace boost { namespace contract { namespace aux { +namespace boost { namespace contract { namespace detail { template struct is_optional : boost::false_type {}; diff --git a/include/boost/contract/function.hpp b/include/boost/contract/function.hpp index 3ac56a0..642c1da 100644 --- a/include/boost/contract/function.hpp +++ b/include/boost/contract/function.hpp @@ -9,10 +9,10 @@ /** @file */ -#include +#include #if !defined(BOOST_CONTRACT_NO_FUNCTIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - #include + #include #endif namespace boost { namespace contract { @@ -22,7 +22,7 @@ set_precondition_old_postcondition<> function() { #if !defined(BOOST_CONTRACT_NO_FUNCTIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) return set_precondition_old_postcondition<>( - new boost::contract::aux::function()); + new boost::contract::detail::function()); #else return set_precondition_old_postcondition<>(); #endif diff --git a/include/boost/contract/guard.hpp b/include/boost/contract/guard.hpp index 519c446..d5776c1 100644 --- a/include/boost/contract/guard.hpp +++ b/include/boost/contract/guard.hpp @@ -9,10 +9,10 @@ /** @file */ -#include -#include -#include -#include +#include +#include +#include +#include #include /* PRIVATE */ @@ -23,7 +23,7 @@ #define BOOST_CONTRACT_GUARD_CTOR_DEF_(contract_type) \ : check_(const_cast(contract).check_.release()) \ { \ - BOOST_CONTRACT_AUX_DEBUG(check_); \ + BOOST_CONTRACT_DETAIL_DEBUG(check_); \ check_->guard(); \ } #else @@ -70,7 +70,8 @@ private: #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_INVARIANTS) - boost::contract::aux::auto_ptr check_; + boost::contract::detail::auto_ptr + check_; #endif }; diff --git a/include/boost/contract/old.hpp b/include/boost/contract/old.hpp index 65b435f..abc04ab 100644 --- a/include/boost/contract/old.hpp +++ b/include/boost/contract/old.hpp @@ -9,10 +9,10 @@ /** @file */ -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -91,11 +91,14 @@ public: // Only const access (because contracts should not change program state). - T const& operator*() const { BOOST_CONTRACT_AUX_DEBUG(ptr_); return *ptr_; } + T const& operator*() const { + BOOST_CONTRACT_DETAIL_DEBUG(ptr_); + return *ptr_; + } T const* operator->() const { return ptr_.operator->(); } - BOOST_CONTRACT_AUX_OPERATOR_SAFE_BOOL(old_ptr, !!ptr_) + BOOST_CONTRACT_DETAIL_OPERATOR_SAFE_BOOL(old_ptr, !!ptr_) private: #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS @@ -146,19 +149,19 @@ public: /* implicit */ operator old_ptr() { #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS if(!boost::is_copy_constructible::value) { - BOOST_CONTRACT_AUX_DEBUG(!ptr_); // Non-copyable so no old... + BOOST_CONTRACT_DETAIL_DEBUG(!ptr_); // Non-copyable so no old... return old_ptr(); // ...and return null. - } else if(!v_ && boost::contract::aux::check_guard::checking()) { + } else if(!v_ && boost::contract::detail::check_guard::checking()) { // Return null shared ptr (see after if statement). } else if(!v_) { - BOOST_CONTRACT_AUX_DEBUG(ptr_); + BOOST_CONTRACT_DETAIL_DEBUG(ptr_); boost::shared_ptr old = boost::static_pointer_cast(ptr_); - BOOST_CONTRACT_AUX_DEBUG(old); + BOOST_CONTRACT_DETAIL_DEBUG(old); return old_ptr(old); } else if(v_->action_ == boost::contract::virtual_::push_old_init || v_->action_ == boost::contract::virtual_::push_old_copy) { - BOOST_CONTRACT_AUX_DEBUG(ptr_); + BOOST_CONTRACT_DETAIL_DEBUG(ptr_); if(v_->action_ == boost::contract::virtual_::push_old_init) { v_->old_inits_.push(ptr_); } else { @@ -167,14 +170,14 @@ public: return old_ptr(); } else if(v_->action_ == boost::contract::virtual_::pop_old_init || v_->action_ == boost::contract::virtual_::pop_old_copy) { - BOOST_CONTRACT_AUX_DEBUG(!ptr_); + BOOST_CONTRACT_DETAIL_DEBUG(!ptr_); boost::shared_ptr ptr; if(v_->action_ == boost::contract::virtual_::pop_old_init) { ptr = v_->old_inits_.front(); } else { ptr = v_->old_copies_.top(); } - BOOST_CONTRACT_AUX_DEBUG(ptr); + BOOST_CONTRACT_DETAIL_DEBUG(ptr); if(v_->action_ == boost::contract::virtual_::pop_old_init) { v_->old_inits_.pop(); } else { @@ -182,10 +185,10 @@ public: } boost::shared_ptr old = boost::static_pointer_cast(ptr); - BOOST_CONTRACT_AUX_DEBUG(old); + BOOST_CONTRACT_DETAIL_DEBUG(old); return old_ptr(old); } - BOOST_CONTRACT_AUX_DEBUG(!ptr_); + BOOST_CONTRACT_DETAIL_DEBUG(!ptr_); #endif return old_ptr(); } @@ -219,7 +222,7 @@ convertible_old make_old(virtual_* v, unconvertible_old const& old) { bool copy_old() { #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - return !boost::contract::aux::check_guard::checking(); + return !boost::contract::detail::check_guard::checking(); #else return false; // Post checking disabled, so never copy old values. #endif @@ -227,7 +230,7 @@ bool copy_old() { bool copy_old(virtual_* v) { #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - if(!v) return !boost::contract::aux::check_guard::checking(); + if(!v) return !boost::contract::detail::check_guard::checking(); return v->action_ == boost::contract::virtual_::push_old_init || v->action_ == boost::contract::virtual_::push_old_copy; #else diff --git a/include/boost/contract/override.hpp b/include/boost/contract/override.hpp index 1ff9bde..9cf5609 100644 --- a/include/boost/contract/override.hpp +++ b/include/boost/contract/override.hpp @@ -7,47 +7,48 @@ // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html -#include +#include #include /* PRIVATE */ #ifndef BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS - #include - #include - #include - #include + #include + #include + #include + #include #define BOOST_CONTRACT_OVERRIDE_CALL_BASE_(z, arity, arity_compl, f) \ template< \ - class BOOST_CONTRACT_AUX_NAME1(B), \ - class BOOST_CONTRACT_AUX_NAME1(C) \ - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(arity) \ - BOOST_CONTRACT_AUX_TVARIADIC_TPARAMS_Z(z, arity, \ - BOOST_CONTRACT_AUX_NAME1(Args)) \ + class BOOST_CONTRACT_DETAIL_NAME1(B), \ + class BOOST_CONTRACT_DETAIL_NAME1(C) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(arity) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_TPARAMS_Z(z, arity, \ + BOOST_CONTRACT_DETAIL_NAME1(Args)) \ > \ - static void BOOST_CONTRACT_AUX_NAME1(call_base)( \ - boost::contract::virtual_* BOOST_CONTRACT_AUX_NAME1(v), \ - BOOST_CONTRACT_AUX_NAME1(C)* BOOST_CONTRACT_AUX_NAME1(obj) \ - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(arity) \ - BOOST_CONTRACT_AUX_TVARIADIC_FPARAMS_Z(z, arity, \ - BOOST_CONTRACT_AUX_NAME1(Args), \ + static void BOOST_CONTRACT_DETAIL_NAME1(call_base)( \ + boost::contract::virtual_* BOOST_CONTRACT_DETAIL_NAME1(v), \ + BOOST_CONTRACT_DETAIL_NAME1(C)* BOOST_CONTRACT_DETAIL_NAME1(obj) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(arity) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAMS_Z(z, arity, \ + BOOST_CONTRACT_DETAIL_NAME1(Args), \ &, \ - BOOST_CONTRACT_AUX_NAME1(args) \ + BOOST_CONTRACT_DETAIL_NAME1(args) \ ) \ - BOOST_CONTRACT_AUX_NO_TVARIADIC_COMMA(arity_compl) \ - BOOST_CONTRACT_AUX_NO_TVARIADIC_ENUM_Z(z, arity_compl, \ - boost::contract::aux::none&) \ + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_COMMA(arity_compl) \ + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_ENUM_Z(z, arity_compl, \ + boost::contract::detail::none&) \ ) { \ - BOOST_CONTRACT_AUX_NAME1(obj)->BOOST_CONTRACT_AUX_NAME1(B)::f( \ - BOOST_CONTRACT_AUX_TVARIADIC_ARGS_Z(z, arity, \ - BOOST_CONTRACT_AUX_NAME1(args)) \ - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(arity) \ - BOOST_CONTRACT_AUX_NAME1(v) \ + BOOST_CONTRACT_DETAIL_NAME1(obj)-> \ + BOOST_CONTRACT_DETAIL_NAME1(B)::f( \ + BOOST_CONTRACT_DETAIL_TVARIADIC_ARGS_Z(z, arity, \ + BOOST_CONTRACT_DETAIL_NAME1(args)) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(arity) \ + BOOST_CONTRACT_DETAIL_NAME1(v) \ ); \ } - #if BOOST_CONTRACT_AUX_TVARIADIC + #if BOOST_CONTRACT_DETAIL_TVARIADIC #define BOOST_CONTRACT_OVERRIDE_CALL_BASE_DECL_(f) \ BOOST_CONTRACT_OVERRIDE_CALL_BASE_(1, ~, ~, f) #else @@ -68,8 +69,8 @@ #define BOOST_CONTRACT_OVERRIDE_TRAIT(trait, f) \ struct trait { \ - BOOST_CONTRACT_AUX_INTROSPECTION_HAS_MEMBER_FUNCTION( \ - BOOST_CONTRACT_AUX_NAME1(has_member_function), f) \ + BOOST_CONTRACT_DETAIL_INTROSPECTION_HAS_MEMBER_FUNCTION( \ + BOOST_CONTRACT_DETAIL_NAME1(has_member_function), f) \ \ BOOST_CONTRACT_OVERRIDE_CALL_BASE_DECL_(f) \ }; diff --git a/include/boost/contract/public_function.hpp b/include/boost/contract/public_function.hpp index 35e5c91..21a505e 100644 --- a/include/boost/contract/public_function.hpp +++ b/include/boost/contract/public_function.hpp @@ -11,14 +11,14 @@ // TODO: Document that not using variadic templates (i.e., using pp meta-programming impl instead) does not increase compilation times (I measured this with the max_arg test program). -#include -#include -#include +#include +#include +#include #ifndef BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS - #include - #include - #include - #include + #include + #include + #include + #include #include #include #include @@ -27,7 +27,7 @@ #include #include #endif -#if !BOOST_CONTRACT_AUX_TVARIADIC +#if !BOOST_CONTRACT_DETAIL_TVARIADIC #include #include #include @@ -56,7 +56,7 @@ template set_precondition_old_postcondition<> public_function() { #ifndef BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS return set_precondition_old_postcondition<>( - new boost::contract::aux::public_static_function()); + new boost::contract::detail::public_static_function()); #else return set_precondition_old_postcondition<>(); #endif @@ -67,24 +67,26 @@ template set_precondition_old_postcondition<> public_function(C* obj) { #ifndef BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS return set_precondition_old_postcondition<>( - new boost::contract::aux::public_function< - boost::contract::aux::none, - boost::contract::aux::none, - boost::contract::aux::none, + new boost::contract::detail::public_function< + boost::contract::detail::none, + boost::contract::detail::none, + boost::contract::detail::none, C - BOOST_CONTRACT_AUX_NO_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) - BOOST_CONTRACT_AUX_NO_TVARIADIC_ENUM_Z(1, + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_COMMA( + BOOST_CONTRACT_MAX_ARGS) + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_ENUM_Z(1, BOOST_CONTRACT_MAX_ARGS, - boost::contract::aux::none + boost::contract::detail::none ) >( static_cast(0), obj, - boost::contract::aux::none::value() - BOOST_CONTRACT_AUX_NO_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) - BOOST_CONTRACT_AUX_NO_TVARIADIC_ENUM_Z(1, + boost::contract::detail::none::value() + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_COMMA( + BOOST_CONTRACT_MAX_ARGS) + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_ENUM_Z(1, BOOST_CONTRACT_MAX_ARGS, - boost::contract::aux::none::value() + boost::contract::detail::none::value() ) ) ); @@ -119,16 +121,20 @@ set_precondition_old_postcondition<> public_function(C* obj) { /* no F... so cannot enforce contracted F ret R (up to user) */ \ return (set_precondition_old_postcondition< \ BOOST_PP_EXPR_IIF(has_result, R)>( \ - new boost::contract::aux::public_function< \ - boost::contract::aux::none, \ - BOOST_PP_IIF(has_result, R, boost::contract::aux::none), \ - boost::contract::aux::none, \ + new boost::contract::detail::public_function< \ + boost::contract::detail::none, \ + BOOST_PP_IIF(has_result, \ + R \ + , \ + boost::contract::detail::none \ + ), \ + boost::contract::detail::none, \ C \ - BOOST_CONTRACT_AUX_NO_TVARIADIC_COMMA( \ + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_COMMA( \ BOOST_CONTRACT_MAX_ARGS) \ - BOOST_CONTRACT_AUX_NO_TVARIADIC_ENUM_Z(1, \ + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_ENUM_Z(1, \ BOOST_CONTRACT_MAX_ARGS, \ - boost::contract::aux::none \ + boost::contract::detail::none \ ) \ >( \ v, \ @@ -136,13 +142,13 @@ set_precondition_old_postcondition<> public_function(C* obj) { BOOST_PP_IIF(has_result, \ r \ , \ - boost::contract::aux::none::value() \ + boost::contract::detail::none::value() \ ) \ - BOOST_CONTRACT_AUX_NO_TVARIADIC_COMMA( \ + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_COMMA( \ BOOST_CONTRACT_MAX_ARGS) \ - BOOST_CONTRACT_AUX_NO_TVARIADIC_ENUM_Z(1, \ + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_ENUM_Z(1, \ BOOST_CONTRACT_MAX_ARGS, \ - boost::contract::aux::none::value() \ + boost::contract::detail::none::value() \ ) \ ) \ )); \ @@ -158,7 +164,7 @@ BOOST_CONTRACT_PUBLIC_FUNCTION_VIRTUAL_NO_OVERRIDE_(/* has_result = */ 1) // For non-static, virtual, and overriding public functions (PRIVATE macro). #define BOOST_CONTRACT_PUBLIC_FUNCTION_VIRTUAL_OVERRIDE_Z_( \ z, arity, arity_compl, has_result) \ - BOOST_CONTRACT_AUX_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \ + BOOST_CONTRACT_DETAIL_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \ arity, /* is_friend = */ 0, has_result, \ O, R, F, C, Args, \ v, r, f, obj, args \ @@ -169,7 +175,7 @@ BOOST_CONTRACT_PUBLIC_FUNCTION_VIRTUAL_NO_OVERRIDE_(/* has_result = */ 1) BOOST_STATIC_ASSERT_MSG( \ /* -2 for both `this` and `virtual_*` extra parameters */ \ boost::function_types::function_arity::value - 2 == \ - BOOST_CONTRACT_AUX_TVARIADIC_SIZEOF(arity, Args), \ + BOOST_CONTRACT_DETAIL_TVARIADIC_SIZEOF(arity, Args), \ "missing one or more arguments for specified function" \ ); \ /* assert consistency of F's result type and R (if has_result) */ \ @@ -181,7 +187,7 @@ BOOST_CONTRACT_PUBLIC_FUNCTION_VIRTUAL_NO_OVERRIDE_(/* has_result = */ 1) (boost::is_same< \ typename boost::remove_reference::type>::type, \ - typename boost::contract::aux:: \ + typename boost::contract::detail:: \ remove_value_reference_if_optional::type \ >::value), \ "mismatching result type for specified function" \ @@ -193,29 +199,33 @@ BOOST_CONTRACT_PUBLIC_FUNCTION_VIRTUAL_NO_OVERRIDE_(/* has_result = */ 1) ); \ return (set_precondition_old_postcondition< \ BOOST_PP_EXPR_IIF(has_result, R)>( \ - new boost::contract::aux::public_function< \ + new boost::contract::detail::public_function< \ O, \ - BOOST_PP_IIF(has_result, R, boost::contract::aux::none), \ + BOOST_PP_IIF(has_result, \ + R \ + , \ + boost::contract::detail::none \ + ), \ F, \ C \ - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(arity) \ - BOOST_CONTRACT_AUX_TVARIADIC_ARGS_Z(z, arity, Args) \ - BOOST_CONTRACT_AUX_NO_TVARIADIC_COMMA(arity_compl) \ - BOOST_CONTRACT_AUX_NO_TVARIADIC_ENUM_Z(z, arity_compl, \ - boost::contract::aux::none) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(arity) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_ARGS_Z(z, arity, Args) \ + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_COMMA(arity_compl) \ + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_ENUM_Z(z, arity_compl, \ + boost::contract::detail::none) \ >( \ v, \ obj, \ BOOST_PP_IIF(has_result, \ r \ , \ - boost::contract::aux::none::value() \ + boost::contract::detail::none::value() \ ) \ - BOOST_CONTRACT_AUX_TVARIADIC_COMMA(arity) \ - BOOST_CONTRACT_AUX_TVARIADIC_ARGS_Z(z, arity, args) \ - BOOST_CONTRACT_AUX_NO_TVARIADIC_COMMA(arity_compl) \ - BOOST_CONTRACT_AUX_NO_TVARIADIC_ENUM_Z(z, arity_compl, \ - boost::contract::aux::none::value()) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(arity) \ + BOOST_CONTRACT_DETAIL_TVARIADIC_ARGS_Z(z, arity, args) \ + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_COMMA(arity_compl) \ + BOOST_CONTRACT_DETAIL_NO_TVARIADIC_ENUM_Z(z, arity_compl, \ + boost::contract::detail::none::value()) \ ) \ )); \ , \ @@ -224,7 +234,7 @@ BOOST_CONTRACT_PUBLIC_FUNCTION_VIRTUAL_NO_OVERRIDE_(/* has_result = */ 1) ) \ } -#if BOOST_CONTRACT_AUX_TVARIADIC +#if BOOST_CONTRACT_DETAIL_TVARIADIC BOOST_CONTRACT_PUBLIC_FUNCTION_VIRTUAL_OVERRIDE_Z_(1, /* arity = */ ~, /* arity_compl = */ ~, /* has_result = */ 0) BOOST_CONTRACT_PUBLIC_FUNCTION_VIRTUAL_OVERRIDE_Z_(1, diff --git a/src/contract.cpp b/src/contract.cpp index 38d29d2..fb7d55a 100644 --- a/src/contract.cpp +++ b/src/contract.cpp @@ -10,7 +10,7 @@ // (Plus, as always in C++, they cannot contain template code because these // headers will be linked and not #included by user code.) -#define BOOST_CONTRACT_AUX_SOURCE -#include -#include +#define BOOST_CONTRACT_DETAIL_SOURCE +#include +#include diff --git a/test/call_if/advance_cxx14.cpp b/test/call_if/advance_cxx14.cpp index ff05909..9a9b1f4 100644 --- a/test/call_if/advance_cxx14.cpp +++ b/test/call_if/advance_cxx14.cpp @@ -1,7 +1,7 @@ // Test possible impl. advance() in single function with C++14 generic lambdas. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include @@ -11,7 +11,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; template struct is_random_access_iterator : std::is_same< diff --git a/test/call_if/equal_to.cpp b/test/call_if/equal_to.cpp index b825c87..8fa94dc 100644 --- a/test/call_if/equal_to.cpp +++ b/test/call_if/equal_to.cpp @@ -1,7 +1,7 @@ // Test STL equal_to with call_if. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include @@ -9,7 +9,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; template struct void_equal_to { diff --git a/test/call_if/equal_to_cxx14.cpp b/test/call_if/equal_to_cxx14.cpp index 9467ed0..e31fd91 100644 --- a/test/call_if/equal_to_cxx14.cpp +++ b/test/call_if/equal_to_cxx14.cpp @@ -1,14 +1,14 @@ // Test call_if equality check with C++14 generic lambdas. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include // std::bind for generic lambdas. #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct x {}; // Does not have operator==. diff --git a/test/call_if/false_.cpp b/test/call_if/false_.cpp index a088997..50cb0d5 100644 --- a/test/call_if/false_.cpp +++ b/test/call_if/false_.cpp @@ -1,14 +1,14 @@ // Test call_if with false condition and non-void result type. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct eq { typedef bool result_type; // Test non-void result type. diff --git a/test/call_if/false_void.cpp b/test/call_if/false_void.cpp index 283138f..a3e7a39 100644 --- a/test/call_if/false_void.cpp +++ b/test/call_if/false_void.cpp @@ -1,14 +1,14 @@ // Test call_if with false condition and void result type. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct eq { typedef void result_type; // Test void result type. diff --git a/test/call_if/true_.cpp b/test/call_if/true_.cpp index 10e6d01..86e8276 100644 --- a/test/call_if/true_.cpp +++ b/test/call_if/true_.cpp @@ -1,14 +1,14 @@ // Test call_if with true condition and non-void result type. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct eq { typedef bool result_type; // Test non-void result type. diff --git a/test/call_if/true_void.cpp b/test/call_if/true_void.cpp index 77c0044..3677713 100644 --- a/test/call_if/true_void.cpp +++ b/test/call_if/true_void.cpp @@ -1,14 +1,14 @@ // Test call_if with true condition and void result type. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct eq { typedef void result_type; // Test void result type. diff --git a/test/constructor/access.cpp b/test/constructor/access.cpp index 56d1362..5a8a60e 100644 --- a/test/constructor/access.cpp +++ b/test/constructor/access.cpp @@ -1,14 +1,14 @@ // Test making all contract extra declarations (base types, inv, etc.) private. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; class b #define BASES private boost::contract::constructor_precondition diff --git a/test/constructor/bases.cpp b/test/constructor/bases.cpp index 6efa05c..e3cb2f5 100644 --- a/test/constructor/bases.cpp +++ b/test/constructor/bases.cpp @@ -1,8 +1,8 @@ // Test constructor subcontracting. -#include "../aux_/oteststream.hpp" -#include "../aux_/counter.hpp" +#include "../detail/oteststream.hpp" +#include "../detail/counter.hpp" #include #include #include @@ -14,7 +14,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; template struct t @@ -35,11 +35,11 @@ struct t } struct l_tag; - typedef boost::contract::test::aux::counter l_type; + typedef boost::contract::test::detail::counter l_type; static l_type l; struct z_tag; - typedef boost::contract::test::aux::counter z_type; + typedef boost::contract::test::detail::counter z_type; explicit t(z_type& z) : boost::contract::constructor_precondition >([&] { @@ -97,11 +97,11 @@ struct c } struct m_tag; - typedef boost::contract::test::aux::counter m_type; + typedef boost::contract::test::detail::counter m_type; static m_type m; struct y_tag; - typedef boost::contract::test::aux::counter y_type; + typedef boost::contract::test::detail::counter y_type; explicit c(y_type& y, t<'d'>::z_type& dz, t<'p'>::z_type& pz, t<'q'>::z_type& qz, t<'e'>::z_type& ez) : @@ -173,11 +173,11 @@ struct a } struct n_tag; - typedef boost::contract::test::aux::counter n_type; + typedef boost::contract::test::detail::counter n_type; static n_type n; struct x_tag; - typedef boost::contract::test::aux::counter x_type; + typedef boost::contract::test::detail::counter x_type; explicit a(x_type& x, c::y_type& y, t<'d'>::z_type& dz, t<'p'>::z_type& pz, t<'q'>::z_type& qz, t<'e'>::z_type& ez) : diff --git a/test/constructor/body_throw.cpp b/test/constructor/body_throw.cpp index 658dd74..cf144b9 100644 --- a/test/constructor/body_throw.cpp +++ b/test/constructor/body_throw.cpp @@ -1,14 +1,14 @@ // Test throw form constructor body (in middle branch of inheritance tree). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct c #define BASES private boost::contract::constructor_precondition diff --git a/test/constructor/decl.hpp b/test/constructor/decl.hpp index cba4530..852b9b5 100644 --- a/test/constructor/decl.hpp +++ b/test/constructor/decl.hpp @@ -4,13 +4,13 @@ // Test with and without pre, post, and inv declarations. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; bool c_pre = true, c_post = true; bool c_entering_static_inv = true, c_entry_static_inv = true, diff --git a/test/constructor/no_contracts.cpp b/test/constructor/no_contracts.cpp index f6ec066..a58b5ae 100644 --- a/test/constructor/no_contracts.cpp +++ b/test/constructor/no_contracts.cpp @@ -1,7 +1,7 @@ // Test contract compilation on/off. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include // Outside #if below for ctor pre. #ifndef BOOST_CONTRACT_NO_CONSTRUCTORS @@ -11,7 +11,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct b #ifndef BOOST_CONTRACT_NO_PRECONDITIONS diff --git a/test/constructor/old_throw.cpp b/test/constructor/old_throw.cpp index 0013358..7daf235 100644 --- a/test/constructor/old_throw.cpp +++ b/test/constructor/old_throw.cpp @@ -1,14 +1,14 @@ // Test throw form constructor .old() (in middle branch of inheritance tree). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct c #define BASES private boost::contract::constructor_precondition diff --git a/test/destructor/access.cpp b/test/destructor/access.cpp index b0d09d0..4983d64 100644 --- a/test/destructor/access.cpp +++ b/test/destructor/access.cpp @@ -1,14 +1,14 @@ // Test making all contract extra declarations (base types, inv, etc.) private. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; class b { friend class boost::contract::access; diff --git a/test/destructor/bases.cpp b/test/destructor/bases.cpp index ad62db8..7b070ea 100644 --- a/test/destructor/bases.cpp +++ b/test/destructor/bases.cpp @@ -1,8 +1,8 @@ // Test destructor subcontracting. -#include "../aux_/oteststream.hpp" -#include "../aux_/counter.hpp" +#include "../detail/oteststream.hpp" +#include "../detail/counter.hpp" #include #include #include @@ -12,7 +12,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; template struct t { @@ -27,7 +27,7 @@ struct t { } struct l_tag; - typedef boost::contract::test::aux::counter l_type; + typedef boost::contract::test::detail::counter l_type; static l_type l; explicit t() : k_(-1) { ++l.value; } @@ -75,7 +75,7 @@ struct c } struct m_tag; - typedef boost::contract::test::aux::counter m_type; + typedef boost::contract::test::detail::counter m_type; static m_type m; explicit c() : j_(-1) { ++m.value; } @@ -130,7 +130,7 @@ struct a } struct n_tag; - typedef boost::contract::test::aux::counter n_type; + typedef boost::contract::test::detail::counter n_type; static n_type n; explicit a() : i_(-1) { ++n.value; } diff --git a/test/destructor/body_throw.cpp b/test/destructor/body_throw.cpp index a607889..83f9bc3 100644 --- a/test/destructor/body_throw.cpp +++ b/test/destructor/body_throw.cpp @@ -1,7 +1,7 @@ // Test throw from destructor body (in middle branch of inheritance tree). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include @@ -9,7 +9,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct c { static void static_invariant() { out << "c::static_inv" << std::endl; } diff --git a/test/destructor/decl.hpp b/test/destructor/decl.hpp index d259e9c..1135209 100644 --- a/test/destructor/decl.hpp +++ b/test/destructor/decl.hpp @@ -4,14 +4,14 @@ // Test with and without pre, post, and inv declarations. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; bool c_pre = true, c_post = true; bool c_entering_static_inv = true, c_entry_static_inv = true, diff --git a/test/destructor/no_contracts.cpp b/test/destructor/no_contracts.cpp index 6244d28..d1e103a 100644 --- a/test/destructor/no_contracts.cpp +++ b/test/destructor/no_contracts.cpp @@ -1,7 +1,7 @@ // Test contract compilation on/off. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #ifndef BOOST_CONTRACT_NO_DESTRUCTORS #include @@ -11,7 +11,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct b { #ifndef BOOST_CONTRACT_NO_INVARIANTS diff --git a/test/destructor/old_throw.cpp b/test/destructor/old_throw.cpp index 50ae720..a8d368a 100644 --- a/test/destructor/old_throw.cpp +++ b/test/destructor/old_throw.cpp @@ -1,7 +1,7 @@ // Test throw from destructor .old() (in middle branch of inheritance tree). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include @@ -9,7 +9,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct c { static void static_invariant() { out << "c::static_inv" << std::endl; } diff --git a/test/aux_/counter.hpp b/test/detail/counter.hpp similarity index 93% rename from test/aux_/counter.hpp rename to test/detail/counter.hpp index 8822333..dac5260 100644 --- a/test/aux_/counter.hpp +++ b/test/detail/counter.hpp @@ -1,8 +1,8 @@ -#ifndef BOOST_CONTRACT_TEST_AUX_COUNTER_HPP_ -#define BOOST_CONTRACT_TEST_AUX_COUNTER_HPP_ +#ifndef BOOST_CONTRACT_TEST_DETAIL_COUNTER_HPP_ +#define BOOST_CONTRACT_TEST_DETAIL_COUNTER_HPP_ -namespace boost { namespace contract { namespace test { namespace aux { +namespace boost { namespace contract { namespace test { namespace detail { // Helper to count copies and evaluations of type (e.g., for old values). template diff --git a/test/aux_/oteststream.hpp b/test/detail/oteststream.hpp similarity index 82% rename from test/aux_/oteststream.hpp rename to test/detail/oteststream.hpp index d5694e4..feccd42 100644 --- a/test/aux_/oteststream.hpp +++ b/test/detail/oteststream.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_TEST_AUX_OTESTSTREAM_HPP_ -#define BOOST_CONTRACT_TEST_AUX_OTESTSTREAM_HPP_ +#ifndef BOOST_CONTRACT_TEST_DETAIL_OTESTSTREAM_HPP_ +#define BOOST_CONTRACT_TEST_DETAIL_OTESTSTREAM_HPP_ #include #include @@ -9,31 +9,31 @@ #include // Convenience to declare test string functions across shared libs. -#define BOOST_CONTRACT_TEST_AUX_OTESTSTREAM_STR_DECL(declspec, func) \ +#define BOOST_CONTRACT_TEST_DETAIL_OTESTSTREAM_STR_DECL(declspec, func) \ std::string declspec func(); \ void declspec func(std::string const& text); -#define BOOST_CONTRACT_TEST_AUX_OTESTSTREAM_STR_DEF(func) \ - namespace boost { namespace contract { namespace test { namespace aux { \ +#define BOOST_CONTRACT_TEST_DETAIL_OTESTSTREAM_STR_DEF(func) \ + namespace boost { namespace contract { namespace test { namespace detail { \ namespace oteststream_ { \ std::string func; \ } } } } } \ \ std::string func() { \ - return boost::contract::test::aux::oteststream_::func; \ + return boost::contract::test::detail::oteststream_::func; \ } \ \ void func(std::string const& text) { \ - if(text == "") boost::contract::test::aux::oteststream_::func = ""; \ + if(text == "") boost::contract::test::detail::oteststream_::func = ""; \ else { \ - boost::contract::test::aux::oteststream_::func = \ - boost::contract::test::aux::oteststream_::func + text; \ + boost::contract::test::detail::oteststream_::func = \ + boost::contract::test::detail::oteststream_::func + text; \ std::clog << text; \ std::clog.flush(); \ } \ } -namespace boost { namespace contract { namespace test { namespace aux { +namespace boost { namespace contract { namespace test { namespace detail { namespace oteststream_ { struct oss_base { // Wrap oss data member for proper initialization order. diff --git a/test/disable/lib_a.hpp b/test/disable/lib_a.hpp index 04d1346..e2de5f9 100644 --- a/test/disable/lib_a.hpp +++ b/test/disable/lib_a.hpp @@ -2,8 +2,8 @@ #ifndef BOOST_CONTRACT_TEST_LIB_A_HPP_ #define BOOST_CONTRACT_TEST_LIB_A_HPP_ -#include "../aux_/oteststream.hpp" -#include "../aux_/counter.hpp" +#include "../detail/oteststream.hpp" +#include "../detail/counter.hpp" #include #include @@ -19,7 +19,7 @@ #define BOOST_CONTRACT_TEST_LIB_A_DECLSPEC /* nothing */ #endif -BOOST_CONTRACT_TEST_AUX_OTESTSTREAM_STR_DECL( +BOOST_CONTRACT_TEST_DETAIL_OTESTSTREAM_STR_DECL( BOOST_CONTRACT_TEST_LIB_A_DECLSPEC, out) struct BOOST_CONTRACT_TEST_LIB_A_DECLSPEC a { @@ -27,7 +27,7 @@ struct BOOST_CONTRACT_TEST_LIB_A_DECLSPEC a { void invariant() const; struct x_tag; - typedef boost::contract::test::aux::counter x_type; + typedef boost::contract::test::detail::counter x_type; int f(x_type& x); diff --git a/test/disable/lib_a_inlined.hpp b/test/disable/lib_a_inlined.hpp index cfd831d..592e86d 100644 --- a/test/disable/lib_a_inlined.hpp +++ b/test/disable/lib_a_inlined.hpp @@ -10,7 +10,7 @@ #include #include -BOOST_CONTRACT_TEST_AUX_OTESTSTREAM_STR_DEF(out) +BOOST_CONTRACT_TEST_DETAIL_OTESTSTREAM_STR_DEF(out) void a::static_invariant() { out("a::static_inv\n"); } void a::invariant() const { out("a::inv\n"); } diff --git a/test/disable/lib_ab.hpp b/test/disable/lib_ab.hpp index 141ced0..b3ad6ee 100644 --- a/test/disable/lib_ab.hpp +++ b/test/disable/lib_ab.hpp @@ -78,7 +78,7 @@ int main() { #endif #endif ; - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), ok.str())); + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), ok.str())); // Test old values not copied for disabled contracts. unsigned const cnt = @@ -97,60 +97,60 @@ int main() { // Double check a call to f outside another contract checks f's contracts. out(""); call_f(); - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), ok_f())); + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), ok_f())); // Test setting failure handlers (from this program using a lib). a::disable_pre_failure(); out(""); boost::contract::precondition_failure(boost::contract::from()); - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), "a::pre_failure")); a::disable_post_failure(); out(""); boost::contract::postcondition_failure(boost::contract::from()); - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), "a::post_failure")); a::disable_entry_inv_failure(); out(""); boost::contract::entry_invariant_failure(boost::contract::from()); - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), "a::entry_inv_failure")); a::disable_exit_inv_failure(); out(""); boost::contract::exit_invariant_failure(boost::contract::from()); - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), "a::exit_inv_failure")); a::disable_inv_failure(); out(""); boost::contract::entry_invariant_failure(boost::contract::from()); - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), "a::inv_failure")); out(""); boost::contract::exit_invariant_failure(boost::contract::from()); - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), "a::inv_failure")); a::disable_failure(); out(""); boost::contract::precondition_failure(boost::contract::from()); - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), "a::failure")); out(""); boost::contract::postcondition_failure(boost::contract::from()); - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), "a::failure")); out(""); boost::contract::entry_invariant_failure(boost::contract::from()); - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), "a::failure")); out(""); boost::contract::exit_invariant_failure(boost::contract::from()); - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), "a::failure")); // Test setting failure handlers (from a lib using another lib). diff --git a/test/disable/lib_b_inlined.hpp b/test/disable/lib_b_inlined.hpp index 0198dc3..d9a3641 100644 --- a/test/disable/lib_b_inlined.hpp +++ b/test/disable/lib_b_inlined.hpp @@ -38,14 +38,15 @@ bool b::test_disable_pre_failure() { a::disable_pre_failure(); out(""); boost::contract::precondition_failure(boost::contract::from()); - return boost::contract::test::aux::oteststream::eq(out(), "a::pre_failure"); + return boost::contract::test::detail::oteststream::eq(out(), + "a::pre_failure"); } bool b::test_disable_post_failure() { a::disable_post_failure(); out(""); boost::contract::postcondition_failure(boost::contract::from()); - return boost::contract::test::aux::oteststream::eq(out(), + return boost::contract::test::detail::oteststream::eq(out(), "a::post_failure"); } @@ -53,7 +54,7 @@ bool b::test_disable_entry_inv_failure() { a::disable_entry_inv_failure(); out(""); boost::contract::entry_invariant_failure(boost::contract::from()); - return boost::contract::test::aux::oteststream::eq(out(), + return boost::contract::test::detail::oteststream::eq(out(), "a::entry_inv_failure"); } @@ -61,7 +62,7 @@ bool b::test_disable_exit_inv_failure() { a::disable_exit_inv_failure(); out(""); boost::contract::exit_invariant_failure(boost::contract::from()); - return boost::contract::test::aux::oteststream::eq(out(), + return boost::contract::test::detail::oteststream::eq(out(), "a::exit_inv_failure"); } @@ -69,11 +70,11 @@ bool b::test_disable_inv_failure() { a::disable_inv_failure(); out(""); boost::contract::entry_invariant_failure(boost::contract::from()); - bool entry_inv = boost::contract::test::aux::oteststream::eq(out(), + bool entry_inv = boost::contract::test::detail::oteststream::eq(out(), "a::inv_failure"); out(""); boost::contract::exit_invariant_failure(boost::contract::from()); - bool exit_inv = boost::contract::test::aux::oteststream::eq(out(), + bool exit_inv = boost::contract::test::detail::oteststream::eq(out(), "a::inv_failure"); return entry_inv && exit_inv; } @@ -82,18 +83,19 @@ bool b::test_disable_failure() { a::disable_failure(); out(""); boost::contract::precondition_failure(boost::contract::from()); - bool pre = boost::contract::test::aux::oteststream::eq(out(), "a::failure"); + bool pre = boost::contract::test::detail::oteststream::eq(out(), + "a::failure"); out(""); boost::contract::postcondition_failure(boost::contract::from()); - bool post = boost::contract::test::aux::oteststream::eq(out(), + bool post = boost::contract::test::detail::oteststream::eq(out(), "a::failure"); out(""); boost::contract::entry_invariant_failure(boost::contract::from()); - bool entry_inv = boost::contract::test::aux::oteststream::eq(out(), + bool entry_inv = boost::contract::test::detail::oteststream::eq(out(), "a::failure"); out(""); boost::contract::exit_invariant_failure(boost::contract::from()); - bool exit_inv = boost::contract::test::aux::oteststream::eq(out(), + bool exit_inv = boost::contract::test::detail::oteststream::eq(out(), "a::failure"); return pre && post && entry_inv && exit_inv; } diff --git a/test/disable/lib_x.cpp b/test/disable/lib_x.cpp index 866f945..c044eaa 100644 --- a/test/disable/lib_x.cpp +++ b/test/disable/lib_x.cpp @@ -6,7 +6,7 @@ #include #include -BOOST_CONTRACT_TEST_AUX_OTESTSTREAM_STR_DEF(out) +BOOST_CONTRACT_TEST_DETAIL_OTESTSTREAM_STR_DEF(out) void x() { boost::contract::guard c = boost::contract::function() diff --git a/test/disable/lib_x.hpp b/test/disable/lib_x.hpp index ab33e47..a4d64db 100644 --- a/test/disable/lib_x.hpp +++ b/test/disable/lib_x.hpp @@ -4,7 +4,7 @@ // Test contracts in .cpp so never has post (because NO_POST in its Jamfile). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include @@ -18,7 +18,7 @@ #define BOOST_CONTRACT_TEST_LIB_X_DECLSPEC /* nothing */ #endif -BOOST_CONTRACT_TEST_AUX_OTESTSTREAM_STR_DECL( +BOOST_CONTRACT_TEST_DETAIL_OTESTSTREAM_STR_DECL( BOOST_CONTRACT_TEST_LIB_X_DECLSPEC, out) void BOOST_CONTRACT_TEST_LIB_X_DECLSPEC x(); diff --git a/test/disable/lib_xy.cpp b/test/disable/lib_xy.cpp index a15871d..3a0a84a 100644 --- a/test/disable/lib_xy.cpp +++ b/test/disable/lib_xy.cpp @@ -34,7 +34,7 @@ int main() { << "f::post" << std::endl #endif ; - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), ok.str())); + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), ok.str())); out(""); x(); @@ -44,7 +44,7 @@ int main() { #endif << "x::body" << std::endl ; - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), ok.str())); + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), ok.str())); out(""); y(); @@ -60,7 +60,7 @@ int main() { << "y::post" << std::endl #endif ; - BOOST_TEST(boost::contract::test::aux::oteststream::eq(out(), ok.str())); + BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), ok.str())); return boost::report_errors(); } diff --git a/test/function/body_throw.cpp b/test/function/body_throw.cpp index ea1fe3a..ece8d6a 100644 --- a/test/function/body_throw.cpp +++ b/test/function/body_throw.cpp @@ -1,13 +1,13 @@ // Test throw from free function body. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct err {}; diff --git a/test/function/decl.hpp b/test/function/decl.hpp index 4fad9b7..d2794a6 100644 --- a/test/function/decl.hpp +++ b/test/function/decl.hpp @@ -4,12 +4,12 @@ // Test with and without pre and post declarations. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; bool f_pre = true, f_post = true; void f() { diff --git a/test/function/func.cpp b/test/function/func.cpp index 5050ef5..b15e6a7 100644 --- a/test/function/func.cpp +++ b/test/function/func.cpp @@ -1,8 +1,8 @@ // Test free function contracts. -#include "../aux_/oteststream.hpp" -#include "../aux_/counter.hpp" +#include "../detail/oteststream.hpp" +#include "../detail/counter.hpp" #include #include #include @@ -11,10 +11,10 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; -struct x_tag; typedef boost::contract::test::aux::counter x_type; -struct y_tag; typedef boost::contract::test::aux::counter y_type; +struct x_tag; typedef boost::contract::test::detail::counter x_type; +struct y_tag; typedef boost::contract::test::detail::counter y_type; bool swap(x_type& x, y_type& y) { bool result; @@ -74,7 +74,7 @@ int main() { BOOST_TEST_EQ(y.value, 123); } - #ifdef BOOST_CONTRACT_POSTCONDITIONS + #ifdef BOOST_CONTRACT_NO_POSTCONDITIONS #define BOOST_CONTRACT_TEST_post 0 #else #define BOOST_CONTRACT_TEST_post 1 diff --git a/test/function/no_contracts.cpp b/test/function/no_contracts.cpp index a0c4a8f..15657e7 100644 --- a/test/function/no_contracts.cpp +++ b/test/function/no_contracts.cpp @@ -1,7 +1,7 @@ // Test contract compilation on/off. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #ifndef BOOST_CONTRACT_NO_FUNCTIONS #include @@ -11,7 +11,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; void f(int x) { #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS diff --git a/test/function/old_throw.cpp b/test/function/old_throw.cpp index 6f68bb7..9d87d7e 100644 --- a/test/function/old_throw.cpp +++ b/test/function/old_throw.cpp @@ -1,13 +1,13 @@ // Test throw from free function .old(). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct err {}; diff --git a/test/invariant/decl.hpp b/test/invariant/decl.hpp index 8d60777..d74cd16 100644 --- a/test/invariant/decl.hpp +++ b/test/invariant/decl.hpp @@ -3,7 +3,7 @@ // Test with and without all invariants (static/cv/const-only) declarations. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include @@ -14,7 +14,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct b : private boost::contract::constructor_precondition { // Test also with no base_types. diff --git a/test/old/no_macros.cpp b/test/old/no_macros.cpp index 29731b3..d29b4d8 100644 --- a/test/old/no_macros.cpp +++ b/test/old/no_macros.cpp @@ -1,8 +1,8 @@ // Test old values without BOOST_CONTRACT_OLDOF macro. -#include "../aux_/oteststream.hpp" -#include "../aux_/counter.hpp" +#include "../detail/oteststream.hpp" +#include "../detail/counter.hpp" #include #include #include @@ -13,10 +13,10 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; -struct i_tag; typedef boost::contract::test::aux::counter i_type; -struct j_tag; typedef boost::contract::test::aux::counter j_type; +struct i_tag; typedef boost::contract::test::detail::counter i_type; +struct j_tag; typedef boost::contract::test::detail::counter j_type; struct b { virtual void swap(i_type& i, j_type& j, boost::contract::virtual_* v = 0); @@ -69,8 +69,11 @@ struct a BOOST_CONTRACT_OVERRIDE(swap) }; -struct x_tag; typedef boost::contract::test::aux::counter x_type; -struct y_tag; typedef boost::contract::test::aux::counter y_type; +struct x_tag; +typedef boost::contract::test::detail::counter x_type; + +struct y_tag; +typedef boost::contract::test::detail::counter y_type; void swap(x_type& x, y_type& y) { boost::contract::old_ptr old_x = boost::contract::make_old( diff --git a/test/public_function/access.cpp b/test/public_function/access.cpp index 38fbda6..b1b48c6 100644 --- a/test/public_function/access.cpp +++ b/test/public_function/access.cpp @@ -1,7 +1,7 @@ // Test making all contract extra declarations (base types, inv, etc.) private. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include @@ -10,7 +10,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; class b { friend class boost::contract::access; diff --git a/test/public_function/bases.hpp b/test/public_function/bases.hpp index 851ddb9..0b43498 100644 --- a/test/public_function/bases.hpp +++ b/test/public_function/bases.hpp @@ -4,8 +4,8 @@ // Test public member function subcontracting (also with old and return values). -#include "../aux_/oteststream.hpp" -#include "../aux_/counter.hpp" +#include "../detail/oteststream.hpp" +#include "../detail/counter.hpp" #include #include #include @@ -14,10 +14,10 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct s_tag; -typedef boost::contract::test::aux::counter s_type; +typedef boost::contract::test::detail::counter s_type; struct result_type { std::string value; @@ -40,7 +40,7 @@ struct t { } struct z_tag; - typedef boost::contract::test::aux::counter z_type; + typedef boost::contract::test::detail::counter z_type; z_type z; t() { z.value.push_back(Id); } @@ -93,7 +93,7 @@ struct c } struct y_tag; - typedef boost::contract::test::aux::counter y_type; + typedef boost::contract::test::detail::counter y_type; y_type y; c() { y.value = "c"; } @@ -175,7 +175,7 @@ struct a } struct x_tag; - typedef boost::contract::test::aux::counter x_type; + typedef boost::contract::test::detail::counter x_type; x_type x; a() { x.value = "a"; } diff --git a/test/public_function/bases_protected.cpp b/test/public_function/bases_protected.cpp index 3910efb..c2ac7b9 100644 --- a/test/public_function/bases_protected.cpp +++ b/test/public_function/bases_protected.cpp @@ -1,7 +1,7 @@ // Test overriding function never overrides protected function contract. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include @@ -9,7 +9,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; // NOTE: This is the correct way of programming contracts for base protected // and public overriding function. diff --git a/test/public_function/bases_sparse.cpp b/test/public_function/bases_sparse.cpp index 4d884db..2e1beb8 100644 --- a/test/public_function/bases_sparse.cpp +++ b/test/public_function/bases_sparse.cpp @@ -1,7 +1,7 @@ // Test subcontracting with sparse and complex inheritance graph. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include @@ -10,7 +10,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct j { static void static_invariant() { out << "j::static_inv" << std::endl; } diff --git a/test/public_function/body_throw.cpp b/test/public_function/body_throw.cpp index d5cadad..2d7287b 100644 --- a/test/public_function/body_throw.cpp +++ b/test/public_function/body_throw.cpp @@ -1,7 +1,7 @@ // Test from public function (derived) body. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include @@ -10,7 +10,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct c { static void static_invariant() { out << "c::static_inv" << std::endl; } diff --git a/test/public_function/decl.hpp b/test/public_function/decl.hpp index 016d9bc..5a14499 100644 --- a/test/public_function/decl.hpp +++ b/test/public_function/decl.hpp @@ -4,14 +4,14 @@ // Test with and without pre, post, and inv declarations. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; bool c_pre = true, c_post = true; bool c_entering_static_inv = true, c_entry_static_inv = true, diff --git a/test/public_function/max_args.hpp b/test/public_function/max_args.hpp index 2025f5b..58a80de 100644 --- a/test/public_function/max_args.hpp +++ b/test/public_function/max_args.hpp @@ -1,7 +1,7 @@ // Test max argument number for public function (with and without result). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include @@ -14,7 +14,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; #define BOOST_CONTRACT_TEST_MAX_ARGS_PARAM_COMMA_(z, n, unused) \ int BOOST_PP_CAT(a, n) , diff --git a/test/public_function/no_contracts.cpp b/test/public_function/no_contracts.cpp index d2d4fef..35695ec 100644 --- a/test/public_function/no_contracts.cpp +++ b/test/public_function/no_contracts.cpp @@ -1,7 +1,7 @@ // Test contract compilation on/off. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #ifndef BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS @@ -14,7 +14,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct b { #ifndef BOOST_CONTRACT_NO_INVARIANTS diff --git a/test/public_function/old_throw.cpp b/test/public_function/old_throw.cpp index 961837c..c68fa71 100644 --- a/test/public_function/old_throw.cpp +++ b/test/public_function/old_throw.cpp @@ -1,7 +1,7 @@ // Test throw from public function (derived and bases) .old(). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include @@ -10,7 +10,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct c { static void static_invariant() { out << "c::static_inv" << std::endl; } diff --git a/test/public_function/overload.hpp b/test/public_function/overload.hpp index 7656c23..5538d74 100644 --- a/test/public_function/overload.hpp +++ b/test/public_function/overload.hpp @@ -1,7 +1,7 @@ // Test public function overloads. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include @@ -10,7 +10,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct b { static void static_invariant() { out << "b::static_inv" << std::endl; } diff --git a/test/public_function/static.cpp b/test/public_function/static.cpp index 6b41b61..48baf7e 100644 --- a/test/public_function/static.cpp +++ b/test/public_function/static.cpp @@ -1,14 +1,14 @@ // Test public static member function contracts. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct b { static void static_invariant() { out << "b::static_inv" << std::endl; } diff --git a/test/public_function/static_body_throw.cpp b/test/public_function/static_body_throw.cpp index bc494c6..59fc53f 100644 --- a/test/public_function/static_body_throw.cpp +++ b/test/public_function/static_body_throw.cpp @@ -1,13 +1,13 @@ // Test public static member function throwing. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct a { static void static_invariant() { out << "a::static_inv" << std::endl; } diff --git a/test/public_function/static_no_contracts.cpp b/test/public_function/static_no_contracts.cpp index fdea755..85778db 100644 --- a/test/public_function/static_no_contracts.cpp +++ b/test/public_function/static_no_contracts.cpp @@ -1,7 +1,7 @@ // Test public static member function contract compilation on/off. -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #ifndef BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS #include @@ -11,7 +11,7 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct a { #ifndef BOOST_CONTRACT_NO_INVARIANTS diff --git a/test/public_function/static_old_throw.cpp b/test/public_function/static_old_throw.cpp index 1119d24..68028f6 100644 --- a/test/public_function/static_old_throw.cpp +++ b/test/public_function/static_old_throw.cpp @@ -1,13 +1,13 @@ // Test throw from public static member function .old(). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct a { static void static_invariant() { out << "a::static_inv" << std::endl; } diff --git a/test/result/mixed_optional.hpp b/test/result/mixed_optional.hpp index 83d2513..c6576d0 100644 --- a/test/result/mixed_optional.hpp +++ b/test/result/mixed_optional.hpp @@ -3,8 +3,8 @@ // Test base and derived classes mixing boost::optional and non- result types. -#include "../aux_/oteststream.hpp" -#include "../aux_/counter.hpp" +#include "../detail/oteststream.hpp" +#include "../detail/counter.hpp" #include #include #include @@ -16,10 +16,10 @@ #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; struct ch_tag; -typedef boost::contract::test::aux::counter ch_type; +typedef boost::contract::test::detail::counter ch_type; #ifdef BOOST_CONTRACT_TEST_REF // Test with result types by reference. #define BOOST_CONTRACT_TEST_CH_TYPE ch_type& diff --git a/test/set/no_guard.cpp b/test/set/no_guard.cpp index dd15bcf..b3c743a 100644 --- a/test/set/no_guard.cpp +++ b/test/set/no_guard.cpp @@ -6,6 +6,7 @@ struct err {}; #include #include +#include int main() { boost::contract::guard c = boost::contract::function() // Test this is OK. @@ -20,9 +21,16 @@ int main() { .old([] {}) .postcondition([] {}) ; - return 1; - } catch(err const&) { return 0; } // Test missing guard threw. - catch(...) { return 2; } - return 3; + #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_INVARIANTS) + BOOST_TEST(false); // Error, must throw. + #endif + } catch(err const&) { + // OK, threw as expected. + } catch(...) { + BOOST_TEST(false); // Error, unexpected throw. + } + return boost::report_errors(); } diff --git a/test/set/nothing.cpp b/test/set/nothing.cpp index 4f36ba5..8d78a9a 100644 --- a/test/set/nothing.cpp +++ b/test/set/nothing.cpp @@ -1,13 +1,13 @@ // Test no pre or post (for free func, but same for all contracts). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; void f() { boost::contract::guard c = boost::contract::function(); diff --git a/test/set/old.cpp b/test/set/old.cpp index 7daa485..f569f8a 100644 --- a/test/set/old.cpp +++ b/test/set/old.cpp @@ -1,13 +1,13 @@ // Test only old specified (for free func, but same for all contracts). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; void f() { boost::contract::guard c = boost::contract::function() diff --git a/test/set/old_post.cpp b/test/set/old_post.cpp index aac0643..a767227 100644 --- a/test/set/old_post.cpp +++ b/test/set/old_post.cpp @@ -1,13 +1,13 @@ // Test both old and post (for free func, but same for all contracts). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; void f() { boost::contract::guard c = boost::contract::function() diff --git a/test/set/post.cpp b/test/set/post.cpp index 001bd09..5df450b 100644 --- a/test/set/post.cpp +++ b/test/set/post.cpp @@ -1,13 +1,13 @@ // Test only post specified (for free func, but same for all contracts). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; void f() { boost::contract::guard c = boost::contract::function() diff --git a/test/set/pre.cpp b/test/set/pre.cpp index 8903e0e..b6ab836 100644 --- a/test/set/pre.cpp +++ b/test/set/pre.cpp @@ -1,13 +1,13 @@ // Test only pre specified (for free func, but same for all contracts). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; void f() { boost::contract::guard c = boost::contract::function() diff --git a/test/set/pre_old.cpp b/test/set/pre_old.cpp index 47cd1fa..1daa62d 100644 --- a/test/set/pre_old.cpp +++ b/test/set/pre_old.cpp @@ -1,13 +1,13 @@ // Test both pre and old (for free func, but same for all contracts). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; void f() { boost::contract::guard c = boost::contract::function() diff --git a/test/set/pre_old_post.cpp b/test/set/pre_old_post.cpp index 986090f..cb987b5 100644 --- a/test/set/pre_old_post.cpp +++ b/test/set/pre_old_post.cpp @@ -1,13 +1,13 @@ // Test all pre, old, and post (for free func, but same for all contracts). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; void f() { boost::contract::guard c = boost::contract::function() diff --git a/test/set/pre_post.cpp b/test/set/pre_post.cpp index 26fef2e..54e1d76 100644 --- a/test/set/pre_post.cpp +++ b/test/set/pre_post.cpp @@ -1,13 +1,13 @@ // Test both pre and post (for free func, but same for all contracts). -#include "../aux_/oteststream.hpp" +#include "../detail/oteststream.hpp" #include #include #include #include -boost::contract::test::aux::oteststream out; +boost::contract::test::detail::oteststream out; void f() { boost::contract::guard c = boost::contract::function()