Skip to content

Commit

Permalink
Remove workarounds from csbl headers to reduce dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Oct 13, 2023
1 parent 32d8199 commit 515d95c
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 197 deletions.
25 changes: 1 addition & 24 deletions include/boost/thread/csbl/deque.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,14 @@
#ifndef BOOST_CSBL_DEQUE_HPP
#define BOOST_CSBL_DEQUE_HPP

#include <boost/config.hpp>
// MSVC has some trouble instantiating a non_copyable type
//C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xmemory0(606) : error C2248: 'non_copyable::non_copyable' : cannot access private member declared in class 'non_copyable'
// ..\libs\thread\test\sync\mutual_exclusion\queue_views\single_thread_pass.cpp(24) : see declaration of 'non_copyable::non_copyable'
// ..\libs\thread\test\sync\mutual_exclusion\queue_views\single_thread_pass.cpp(23) : see declaration of 'non_copyable'
// C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xmemory0(605) : while compiling class template member function 'void std::allocator<_Ty>::construct(_Ty *,const _Ty &)'
// with
// [
// _Ty=non_copyable
// ]
#if defined BOOST_THREAD_USES_BOOST_DEQUE || defined BOOST_NO_CXX11_RVALUE_REFERENCES || (defined _MSC_VER && _MSC_FULL_VER < 180020827)
#ifndef BOOST_THREAD_USES_BOOST_DEQUE
#define BOOST_THREAD_USES_BOOST_DEQUE
#endif
#include <boost/container/deque.hpp>
#else
#include <deque>
#endif

namespace boost
{
namespace csbl
{
#if defined BOOST_THREAD_USES_BOOST_DEQUE
using ::boost::container::deque;

#else
using ::std::deque;

#endif

}
}

#endif // header
15 changes: 1 addition & 14 deletions include/boost/thread/csbl/functional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,12 @@
#ifndef BOOST_CSBL_FUNCTIONAL_HPP
#define BOOST_CSBL_FUNCTIONAL_HPP

#include <boost/config.hpp>

#include <functional>

#if defined BOOST_THREAD_USES_BOOST_FUNCTIONAL || defined BOOST_NO_CXX11_HDR_FUNCTIONAL || defined BOOST_NO_CXX11_RVALUE_REFERENCES
#ifndef BOOST_THREAD_USES_BOOST_FUNCTIONAL
#define BOOST_THREAD_USES_BOOST_FUNCTIONAL
#endif
#include <boost/function.hpp>
#endif

namespace boost
{
namespace csbl
{
#if defined BOOST_THREAD_USES_BOOST_FUNCTIONAL
using ::boost::function;
#else
// D.8.1, base (deprecated):
// 20.9.3, reference_wrapper:
// 20.9.4, arithmetic operations:
Expand All @@ -42,8 +30,7 @@ namespace boost
// 20.9.11 polymorphic function wrappers:
using ::std::function;
// 20.9.12, hash function primary template:
#endif

}
}

#endif // header
15 changes: 1 addition & 14 deletions include/boost/thread/csbl/list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,14 @@
#ifndef BOOST_CSBL_LIST_HPP
#define BOOST_CSBL_LIST_HPP

#include <boost/config.hpp>

#if defined BOOST_THREAD_USES_BOOST_LIST || defined BOOST_NO_CXX11_RVALUE_REFERENCES
#ifndef BOOST_THREAD_USES_BOOST_LIST
#define BOOST_THREAD_USES_BOOST_LIST
#endif
#include <boost/container/list.hpp>
#else
#include <list>
#endif

namespace boost
{
namespace csbl
{
#if defined BOOST_THREAD_USES_BOOST_LIST
using ::boost::container::list;
#else
using ::std::list;
#endif

}
}

#endif // header
14 changes: 2 additions & 12 deletions include/boost/thread/csbl/memory/allocator_arg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,7 @@
#include <boost/thread/csbl/memory/config.hpp>

// 20.7.6, allocator argument tag
#if defined BOOST_NO_CXX11_ALLOCATOR
#include <boost/container/scoped_allocator.hpp>

namespace boost
{
namespace csbl
{
using ::boost::container::allocator_arg_t;
using ::boost::container::allocator_arg;
}
}
#else
namespace boost
{
namespace csbl
Expand All @@ -32,10 +21,11 @@ namespace boost
using ::std::allocator_arg;
}
}
#endif // BOOST_NO_CXX11_ALLOCATOR

namespace boost
{
using ::boost::csbl::allocator_arg_t;
using ::boost::csbl::allocator_arg;
}

#endif // header
11 changes: 0 additions & 11 deletions include/boost/thread/csbl/memory/allocator_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,13 @@
#include <boost/thread/csbl/memory/config.hpp>

// 20.7.8, allocator traits
#if defined BOOST_NO_CXX11_ALLOCATOR
#include <boost/container/allocator_traits.hpp>

namespace boost
{
namespace csbl
{
using ::boost::container::allocator_traits;
}
}
#else
namespace boost
{
namespace csbl
{
using ::std::allocator_traits;
}
}
#endif // BOOST_NO_CXX11_POINTER_TRAITS

#endif // header
2 changes: 0 additions & 2 deletions include/boost/thread/csbl/memory/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#ifndef BOOST_CSBL_MEMORY_CONFIG_HPP
#define BOOST_CSBL_MEMORY_CONFIG_HPP

#include <boost/config.hpp>

#include <memory>

#endif // header
16 changes: 0 additions & 16 deletions include/boost/thread/csbl/memory/default_delete.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,12 @@
// 20.8.1 class template unique_ptr:
// default_delete

#if defined BOOST_NO_CXX11_SMART_PTR
#include <boost/move/unique_ptr.hpp>

namespace boost
{
namespace csbl
{
using ::boost::movelib::default_delete;
}
}
#else
namespace boost
{
namespace csbl
{
using ::std::default_delete;
}
}
#endif // defined BOOST_NO_CXX11_SMART_PTR

namespace boost
{
using ::boost::csbl::default_delete;
}
#endif // header
11 changes: 0 additions & 11 deletions include/boost/thread/csbl/memory/pointer_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,13 @@
#include <boost/thread/csbl/memory/config.hpp>

// 20.7.3, pointer traits
#if defined BOOST_NO_CXX11_ALLOCATOR
#include <boost/intrusive/pointer_traits.hpp>

namespace boost
{
namespace csbl
{
using ::boost::intrusive::pointer_traits;
}
}
#else
namespace boost
{
namespace csbl
{
using ::std::pointer_traits;
}
}
#endif // BOOST_NO_CXX11_ALLOCATOR

#endif // header
11 changes: 0 additions & 11 deletions include/boost/thread/csbl/memory/scoped_allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,13 @@
#include <boost/thread/csbl/memory/config.hpp>

// 20.7.7, uses_allocator
#if defined BOOST_NO_CXX11_ALLOCATOR
#include <boost/container/scoped_allocator.hpp>

namespace boost
{
namespace csbl
{
using ::boost::container::uses_allocator;
}
}
#else
namespace boost
{
namespace csbl
{
using ::std::uses_allocator;
}
}
#endif // BOOST_NO_CXX11_POINTER_TRAITS

#endif // header
19 changes: 0 additions & 19 deletions include/boost/thread/csbl/memory/shared_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,6 @@

#include <boost/thread/csbl/memory/config.hpp>

#if defined BOOST_NO_CXX11_SMART_PTR

#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/smart_ptr/make_shared.hpp>

namespace boost
{
namespace csbl
{
using ::boost::shared_ptr;
using ::boost::make_shared;
}
}

#else

#include <boost/shared_ptr.hpp>

namespace boost
{
namespace csbl
Expand All @@ -38,5 +20,4 @@ namespace boost
}
}

#endif
#endif // header
8 changes: 3 additions & 5 deletions include/boost/thread/csbl/memory/unique_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@

#include <boost/thread/csbl/memory/config.hpp>

#include <boost/move/unique_ptr.hpp>
#include <boost/move/make_unique.hpp>

namespace boost
{
namespace csbl
{
using ::boost::movelib::unique_ptr;
using ::boost::movelib::make_unique;
using ::std::unique_ptr;
using ::std::make_unique;

}
}

#endif // header
28 changes: 2 additions & 26 deletions include/boost/thread/csbl/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,18 @@
//
// 2013/10 Vicente J. Botet Escriba
// Creation.
#if 0

#ifndef BOOST_CSBL_QUEUE_HPP
#define BOOST_CSBL_QUEUE_HPP

#include <boost/config.hpp>
// MSVC has some trouble instantiating a non_copyable type
//C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xmemory0(606) : error C2248: 'non_copyable::non_copyable' : cannot access private member declared in class 'non_copyable'
// ..\libs\thread\test\sync\mutual_exclusion\queue_views\single_thread_pass.cpp(24) : see declaration of 'non_copyable::non_copyable'
// ..\libs\thread\test\sync\mutual_exclusion\queue_views\single_thread_pass.cpp(23) : see declaration of 'non_copyable'
// C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xmemory0(605) : while compiling class template member function 'void std::allocator<_Ty>::construct(_Ty *,const _Ty &)'
// with
// [
// _Ty=non_copyable
// ]
#if defined BOOST_THREAD_USES_BOOST_QUEUE || defined BOOST_NO_CXX11_RVALUE_REFERENCES || (defined _MSC_VER && _MSC_FULL_VER < 180020827)
#ifndef BOOST_THREAD_USES_BOOST_QUEUE
#define BOOST_THREAD_USES_BOOST_QUEUE
#endif
#include <boost/container/queue.hpp>
#else
#include <queue>
#endif

namespace boost
{
namespace csbl
{
#if defined BOOST_THREAD_USES_BOOST_QUEUE
using ::boost::container::queue;

#else
using ::std::queue;

#endif

}
}

#endif // header
#endif
19 changes: 1 addition & 18 deletions include/boost/thread/csbl/tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,12 @@
#ifndef BOOST_CSBL_TUPLE_HPP
#define BOOST_CSBL_TUPLE_HPP

#include <boost/config.hpp>

#if defined BOOST_THREAD_USES_BOOST_TUPLE || defined BOOST_NO_CXX11_HDR_TUPLE || defined BOOST_NO_CXX11_RVALUE_REFERENCES
#include <boost/tuple/tuple.hpp>
#ifndef BOOST_THREAD_USES_BOOST_TUPLE
#define BOOST_THREAD_USES_BOOST_TUPLE
#endif

#else
#include <tuple>
#endif

namespace boost
{
namespace csbl
{
#if defined BOOST_THREAD_USES_BOOST_TUPLE
using ::boost::tuple;
using ::boost::get;
using ::boost::make_tuple;
//using ::boost::tuple_size;
#else
// 20.4.2, class template tuple:
using ::std::tuple;
using ::std::get;
Expand All @@ -42,8 +26,7 @@ namespace boost
// 20.4.2.7, relational operators:
// 20.4.2.8, allocator-related traits
// 20.4.2.9, specialized algorithms:
#endif

}
}

#endif // header
Loading

0 comments on commit 515d95c

Please sign in to comment.