add boost on mac
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_DETAIL_CONSTRUCTOR_HPP_
|
||||
#define BOOST_CONTRACT_DETAIL_CONSTRUCTOR_HPP_
|
||||
|
||||
// Copyright (C) 2008-2018 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 <boost/contract/core/exception.hpp>
|
||||
#include <boost/contract/core/config.hpp>
|
||||
#include <boost/contract/detail/condition/cond_inv.hpp>
|
||||
#include <boost/contract/detail/none.hpp>
|
||||
#if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \
|
||||
!defined(BOOST_CONTRACT_NO_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS))
|
||||
#include <boost/contract/detail/checking.hpp>
|
||||
#endif
|
||||
#if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
#include <boost/config.hpp>
|
||||
#include <exception>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace contract { namespace detail {
|
||||
|
||||
// Ctor subcontracting impl via C++ obj construction mechanism.
|
||||
template<class C> // Non-copyable base.
|
||||
class constructor : public cond_inv</* VR = */ none, C> {
|
||||
public:
|
||||
explicit constructor(C* obj) : cond_inv</* VR = */ none, C>(
|
||||
boost::contract::from_constructor, obj) {}
|
||||
|
||||
private:
|
||||
#if !defined(BOOST_CONTRACT_NO_ENTRY_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_OLDS)
|
||||
void init() /* override */ {
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
if(checking::already()) return;
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
||||
{
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
checking k;
|
||||
#endif
|
||||
this->check_entry_static_inv();
|
||||
// No object before ctor body so check only static inv at
|
||||
// entry. Ctor pre checked by constructor_precondition.
|
||||
}
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_OLDS
|
||||
this->copy_old();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
#if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
~constructor() BOOST_NOEXCEPT_IF(false) {
|
||||
this->assert_initialized();
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
if(checking::already()) return;
|
||||
checking k;
|
||||
#endif
|
||||
|
||||
// If ctor body threw, no obj so check only static inv. Otherwise,
|
||||
// obj constructed so check static inv, non-static inv, and post.
|
||||
if(std::uncaught_exception()) {
|
||||
#ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
||||
this->check_exit_static_inv();
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_EXCEPTS
|
||||
this->check_except();
|
||||
#endif
|
||||
} else {
|
||||
#ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
||||
this->check_exit_all_inv();
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
|
||||
this->check_post(none());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
} } } // namespace
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
102
macx64/include/boost/contract/detail/operation/destructor.hpp
Normal file
102
macx64/include/boost/contract/detail/operation/destructor.hpp
Normal file
@@ -0,0 +1,102 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_DETAIL_DESTRUCTOR_HPP_
|
||||
#define BOOST_CONTRACT_DETAIL_DESTRUCTOR_HPP_
|
||||
|
||||
// Copyright (C) 2008-2018 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 <boost/contract/core/exception.hpp>
|
||||
#include <boost/contract/core/config.hpp>
|
||||
#include <boost/contract/detail/condition/cond_inv.hpp>
|
||||
#include <boost/contract/detail/none.hpp>
|
||||
#if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \
|
||||
!defined(BOOST_CONTRACT_NO_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS))
|
||||
#include <boost/contract/detail/checking.hpp>
|
||||
#endif
|
||||
#if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
#include <boost/config.hpp>
|
||||
#include <exception>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace contract { namespace detail {
|
||||
|
||||
// Dtor subcontracting impl via C++ obj destruction mechanism.
|
||||
template<class C> // Non-copyable base.
|
||||
class destructor : public cond_inv</* VR = */ none, C> {
|
||||
public:
|
||||
explicit destructor(C* obj) : cond_inv</* VR = */ none, C>(
|
||||
boost::contract::from_destructor, obj) {}
|
||||
|
||||
private:
|
||||
#if !defined(BOOST_CONTRACT_NO_ENTRY_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_OLDS)
|
||||
void init() /* override */ {
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
if(checking::already()) return;
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
||||
{
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
checking k;
|
||||
#endif
|
||||
// Obj exists (before dtor body), check static and non- inv.
|
||||
this->check_entry_all_inv();
|
||||
// Dtor cannot have pre because it has no parameters.
|
||||
}
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_OLDS
|
||||
this->copy_old();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
#if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
~destructor() BOOST_NOEXCEPT_IF(false) {
|
||||
this->assert_initialized();
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
if(checking::already()) return;
|
||||
checking k;
|
||||
#endif
|
||||
|
||||
// If dtor body threw, obj still exists so check subcontracted
|
||||
// static and non- inv (but no post because of throw). Otherwise,
|
||||
// obj destructed so check static inv and post (even if there is no
|
||||
// obj after dtor body, this library allows dtor post, for example
|
||||
// to check static members for an instance counter class).
|
||||
// NOTE: In theory C++ destructors should not throw, but the
|
||||
// language allows for that (even if in C++11 dtors declarations are
|
||||
// implicitly noexcept(true) unless specified otherwise) so this
|
||||
// library must handle such a case.
|
||||
if(std::uncaught_exception()) {
|
||||
#ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
||||
this->check_exit_all_inv();
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_EXCEPTS
|
||||
this->check_except();
|
||||
#endif
|
||||
} else {
|
||||
#ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
||||
this->check_exit_static_inv();
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
|
||||
this->check_post(none());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
} } } // namespace
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
82
macx64/include/boost/contract/detail/operation/function.hpp
Normal file
82
macx64/include/boost/contract/detail/operation/function.hpp
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_DETAIL_FUNCTION_HPP_
|
||||
#define BOOST_CONTRACT_DETAIL_FUNCTION_HPP_
|
||||
|
||||
// Copyright (C) 2008-2018 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 <boost/contract/core/exception.hpp>
|
||||
#include <boost/contract/core/config.hpp>
|
||||
#include <boost/contract/detail/condition/cond_post.hpp>
|
||||
#if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \
|
||||
!defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS))
|
||||
#include <boost/contract/detail/checking.hpp>
|
||||
#endif
|
||||
#if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
#include <boost/config.hpp>
|
||||
#include <exception>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace contract { namespace detail {
|
||||
|
||||
// Used for free function, private and protected member functions.
|
||||
class function : public cond_post</* VR = */ none> { // Non-copyable base.
|
||||
public:
|
||||
explicit function() : cond_post</* VR = */ none>(
|
||||
boost::contract::from_function) {}
|
||||
|
||||
private:
|
||||
#if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_OLDS)
|
||||
void init() /* override */ {
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
if(checking::already()) return;
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_PRECONDITIONS
|
||||
{
|
||||
#if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && \
|
||||
!defined( \
|
||||
BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION)
|
||||
checking k;
|
||||
#endif
|
||||
this->check_pre();
|
||||
}
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_OLDS
|
||||
this->copy_old();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
#if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
~function() BOOST_NOEXCEPT_IF(false) {
|
||||
this->assert_initialized();
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
if(checking::already()) return;
|
||||
checking k;
|
||||
#endif
|
||||
|
||||
if(std::uncaught_exception()) {
|
||||
#ifndef BOOST_CONTRACT_NO_EXCEPTS
|
||||
this->check_except();
|
||||
#endif
|
||||
} else {
|
||||
#ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
|
||||
this->check_post(none());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
} } } // namespace
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_DETAIL_PUBLIC_FUNCTION_HPP_
|
||||
#define BOOST_CONTRACT_DETAIL_PUBLIC_FUNCTION_HPP_
|
||||
|
||||
// Copyright (C) 2008-2018 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 <boost/contract/core/virtual.hpp>
|
||||
#include <boost/contract/core/exception.hpp>
|
||||
#include <boost/contract/core/config.hpp>
|
||||
#include <boost/contract/detail/condition/cond_subcontracting.hpp>
|
||||
#include <boost/contract/detail/tvariadic.hpp>
|
||||
#include <boost/contract/core/virtual.hpp>
|
||||
#if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \
|
||||
!defined(BOOST_CONTRACT_NO_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS))
|
||||
#include <boost/contract/detail/checking.hpp>
|
||||
#endif
|
||||
#if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
#if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
#include <exception>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace contract { namespace detail {
|
||||
|
||||
template<
|
||||
class O, typename VR, typename F, class C
|
||||
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 cond_subcontracting<
|
||||
O, VR, F, C
|
||||
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, VR& r
|
||||
BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS)
|
||||
BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAMS_Z(1,
|
||||
BOOST_CONTRACT_MAX_ARGS, Args, &, args)
|
||||
) :
|
||||
cond_subcontracting<
|
||||
O, VR, F, C
|
||||
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_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS)
|
||||
BOOST_CONTRACT_DETAIL_TVARIADIC_ARGS_Z(1,
|
||||
BOOST_CONTRACT_MAX_ARGS, args)
|
||||
)
|
||||
{}
|
||||
|
||||
private:
|
||||
#if !defined(BOOST_CONTRACT_NO_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
void init() /* override */ {
|
||||
#if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
this->init_subcontracted_old();
|
||||
#endif
|
||||
if(!this->base_call()) {
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
if(checking::already()) return;
|
||||
#endif
|
||||
{ // Acquire checking guard.
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
checking k;
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
||||
this->check_subcontracted_entry_inv();
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_PRECONDITIONS
|
||||
#ifndef \
|
||||
BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION
|
||||
this->check_subcontracted_pre();
|
||||
} // Release checking guard (after pre check).
|
||||
#else
|
||||
} // Release checking guard (before pre check).
|
||||
this->check_subcontracted_pre();
|
||||
#endif
|
||||
#else
|
||||
} // Release checking guard.
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_OLDS
|
||||
this->copy_subcontracted_old();
|
||||
#endif
|
||||
} else {
|
||||
#ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
||||
this->check_subcontracted_entry_inv();
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_PRECONDITIONS
|
||||
this->check_subcontracted_pre();
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_OLDS
|
||||
this->copy_subcontracted_old();
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
||||
this->check_subcontracted_exit_inv();
|
||||
#endif
|
||||
if(std::uncaught_exception()) {
|
||||
#ifndef BOOST_CONTRACT_NO_EXCEPTS
|
||||
this->check_subcontracted_except();
|
||||
#endif
|
||||
} else {
|
||||
#ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
|
||||
this->check_subcontracted_post();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
#if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
~public_function() BOOST_NOEXCEPT_IF(false) {
|
||||
this->assert_initialized();
|
||||
if(!this->base_call()) {
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
if(checking::already()) return;
|
||||
checking k;
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
||||
this->check_subcontracted_exit_inv();
|
||||
#endif
|
||||
if(std::uncaught_exception()) {
|
||||
#ifndef BOOST_CONTRACT_NO_EXCEPTS
|
||||
this->check_subcontracted_except();
|
||||
#endif
|
||||
} else {
|
||||
#ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
|
||||
this->check_subcontracted_post();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
} } } // namespace
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_DETAIL_STATIC_PUBLIC_FUNCTION_HPP_
|
||||
#define BOOST_CONTRACT_DETAIL_STATIC_PUBLIC_FUNCTION_HPP_
|
||||
|
||||
// Copyright (C) 2008-2018 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 <boost/contract/core/exception.hpp>
|
||||
#include <boost/contract/core/config.hpp>
|
||||
#include <boost/contract/detail/condition/cond_inv.hpp>
|
||||
#include <boost/contract/detail/none.hpp>
|
||||
#if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \
|
||||
!defined(BOOST_CONTRACT_NO_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS))
|
||||
#include <boost/contract/detail/checking.hpp>
|
||||
#endif
|
||||
#if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
#include <boost/config.hpp>
|
||||
#include <exception>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace contract { namespace detail {
|
||||
|
||||
// No subcontracting because static so no obj and no substitution principle.
|
||||
template<class C> // Non-copyable base.
|
||||
class static_public_function : public cond_inv</* VR = */ none, C> {
|
||||
public:
|
||||
explicit static_public_function() : cond_inv</* VR = */ none, C>(
|
||||
boost::contract::from_function, /* obj = */ 0) {}
|
||||
|
||||
private:
|
||||
#if !defined(BOOST_CONTRACT_NO_ENTRY_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_OLDS)
|
||||
void init() /* override */ {
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
if(checking::already()) return;
|
||||
#endif
|
||||
#if !defined(BOOST_CONTRACT_NO_ENTRY_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_PRECONDITIONS)
|
||||
{ // Acquire checking guard.
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
checking k;
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
||||
this->check_entry_static_inv();
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_PRECONDITIONS
|
||||
#ifndef \
|
||||
BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION
|
||||
this->check_pre();
|
||||
} // Release checking guard (after pre check).
|
||||
#else
|
||||
} // Release checking guard (before pre check).
|
||||
this->check_pre();
|
||||
#endif
|
||||
#else
|
||||
} // Release checking guard
|
||||
#endif
|
||||
#endif
|
||||
#ifndef BOOST_CONTRACT_NO_OLDS
|
||||
this->copy_old();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
#if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \
|
||||
!defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
|
||||
!defined(BOOST_CONTRACT_NO_EXCEPTS)
|
||||
~static_public_function() BOOST_NOEXCEPT_IF(false) {
|
||||
this->assert_initialized();
|
||||
#ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
|
||||
if(checking::already()) return;
|
||||
checking k;
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
||||
this->check_exit_static_inv();
|
||||
#endif
|
||||
if(std::uncaught_exception()) {
|
||||
#ifndef BOOST_CONTRACT_NO_EXCEPTS
|
||||
this->check_except();
|
||||
#endif
|
||||
} else {
|
||||
#ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
|
||||
this->check_post(none());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
} } } // namespace
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
Reference in New Issue
Block a user