Commit 1c1e17d8 authored by Mccaskey, Alex's avatar Mccaskey, Alex

removing boost-dll

parent c77d9bd8
......@@ -82,7 +82,6 @@ install(FILES "${CMAKE_BINARY_DIR}/xacc_config.hpp" DESTINATION include/xacc)
include_directories(${CMAKE_BINARY_DIR})
include_directories(${MPI_INCLUDE_PATH})
include_directories(${Boost_INCLUDE_DIRS})
include_directories(tpls/boost-dll)
include_directories(${CppMicroServices_INCLUDE_DIR})
include_directories("${CMAKE_SOURCE_DIR}/xacc")
include_directories("${CMAKE_SOURCE_DIR}/xacc/ir")
......@@ -92,7 +91,6 @@ include_directories("${CMAKE_SOURCE_DIR}/xacc/accelerator")
include_directories("${CMAKE_SOURCE_DIR}/xacc/utils")
# Add subdirectories
add_subdirectory(tpls)
add_subdirectory(xacc)
add_subdirectory(quantum)
add_subdirectory(impls)
......
add_subdirectory(boost-dll)
file(GLOB BOOST_DLL_FILES boost/dll/*.hpp)
file(GLOB BOOST_DLL_DETAIL_FILES boost/dll/detail/*.hpp)
file(GLOB BOOST_DLL_DETAIL_POSIX_FILES boost/dll/detail/posix/*.hpp)
file(GLOB BOOST_DLL_DETAIL_DEMANGLING_FILES boost/dll/detail/demangling/*.hpp)
file(GLOB BOOST_DLL_DETAIL_WINDOWS_FILES boost/dll/detail/windows/*.hpp)
install(FILES "boost/dll.hpp" DESTINATION include/boost)
install(FILES ${BOOST_DLL_FILES} DESTINATION include/boost/dll)
install(FILES ${BOOST_DLL_DETAIL_FILES} DESTINATION include/boost/dll/detail)
install(FILES ${BOOST_DLL_DETAIL_POSIX_FILES} DESTINATION include/boost/dll/detail/posix)
install(FILES ${BOOST_DLL_DETAIL_DEMANGLING_FILES} DESTINATION include/boost/dll/detail/demangling)
install(FILES ${BOOST_DLL_DETAIL_WINDOWS_FILES} DESTINATION include/boost/dll/detail/windows)
\ No newline at end of file
// Copyright 2014 Renato Tegon Forti, Antony Polukhin.
// Copyright 2015-2016 Antony Polukhin.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_DLL_DLL_HPP
#define BOOST_DLL_DLL_HPP
/// \file boost/dll.hpp
/// \brief Includes all the non-experimental headers of the Boost.DLL library.
#include <boost/config.hpp>
#include <boost/dll/shared_library.hpp>
#include <boost/dll/alias.hpp>
#include <boost/dll/import.hpp>
#include <boost/dll/library_info.hpp>
#include <boost/dll/runtime_symbol_info.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#endif // BOOST_DLL_DLL_HPP
This diff is collapsed.
// Copyright 2014 Renato Tegon Forti, Antony Polukhin.
// Copyright 2015-2017 Antony Polukhin.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_DLL_DETAIL_AGGRESSIVE_PTR_CAST_HPP
#define BOOST_DLL_DETAIL_AGGRESSIVE_PTR_CAST_HPP
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/type_traits/is_member_pointer.hpp>
#include <boost/type_traits/is_void.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/utility/enable_if.hpp>
#include <cstring> // std::memcpy
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 301)
# pragma GCC system_header
#endif
namespace boost { namespace dll { namespace detail {
// GCC warns when reinterpret_cast between function pointer and object pointer occur.
// This method suppress the warnings and ensures that such casts are safe.
template <class To, class From>
BOOST_FORCEINLINE typename boost::disable_if_c<boost::is_member_pointer<To>::value || boost::is_reference<To>::value || boost::is_member_pointer<From>::value, To>::type
aggressive_ptr_cast(From v) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT_MSG(
boost::is_pointer<To>::value && boost::is_pointer<From>::value,
"`agressive_ptr_cast` function must be used only for pointer casting."
);
BOOST_STATIC_ASSERT_MSG(
boost::is_void< typename boost::remove_pointer<To>::type >::value
|| boost::is_void< typename boost::remove_pointer<From>::type >::value,
"`agressive_ptr_cast` function must be used only for casting to or from void pointers."
);
BOOST_STATIC_ASSERT_MSG(
sizeof(v) == sizeof(To),
"Pointer to function and pointer to object differ in size on your platform."
);
return reinterpret_cast<To>(v);
}
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable: 4172) // "returning address of local variable or temporary" but **v is not local!
#endif
template <class To, class From>
BOOST_FORCEINLINE typename boost::disable_if_c<!boost::is_reference<To>::value || boost::is_member_pointer<From>::value, To>::type
aggressive_ptr_cast(From v) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT_MSG(
boost::is_pointer<From>::value,
"`agressive_ptr_cast` function must be used only for pointer casting."
);
BOOST_STATIC_ASSERT_MSG(
boost::is_void< typename boost::remove_pointer<From>::type >::value,
"`agressive_ptr_cast` function must be used only for casting to or from void pointers."
);
BOOST_STATIC_ASSERT_MSG(
sizeof(v) == sizeof(typename boost::remove_reference<To>::type*),
"Pointer to function and pointer to object differ in size on your platform."
);
return static_cast<To>(
**reinterpret_cast<typename boost::remove_reference<To>::type**>(
v
)
);
}
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif
template <class To, class From>
BOOST_FORCEINLINE typename boost::disable_if_c<!boost::is_member_pointer<To>::value || boost::is_member_pointer<From>::value, To>::type
aggressive_ptr_cast(From v) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT_MSG(
boost::is_pointer<From>::value,
"`agressive_ptr_cast` function must be used only for pointer casting."
);
BOOST_STATIC_ASSERT_MSG(
boost::is_void< typename boost::remove_pointer<From>::type >::value,
"`agressive_ptr_cast` function must be used only for casting to or from void pointers."
);
To res = 0;
std::memcpy(&res, &v, sizeof(From));
return res;
}
template <class To, class From>
BOOST_FORCEINLINE typename boost::disable_if_c<boost::is_member_pointer<To>::value || !boost::is_member_pointer<From>::value, To>::type
aggressive_ptr_cast(From /* v */) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT_MSG(
boost::is_pointer<To>::value,
"`agressive_ptr_cast` function must be used only for pointer casting."
);
BOOST_STATIC_ASSERT_MSG(
boost::is_void< typename boost::remove_pointer<To>::type >::value,
"`agressive_ptr_cast` function must be used only for casting to or from void pointers."
);
BOOST_STATIC_ASSERT_MSG(
!sizeof(From),
"Casting from member pointers to void pointer is not implemnted in `agressive_ptr_cast`."
);
return 0;
}
}}} // boost::dll::detail
#endif // BOOST_DLL_DETAIL_AGGRESSIVE_PTR_CAST_HPP
// Copyright 2016 Klemens Morgenstern, Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_DLL_DETAIL_CTOR_DTOR_HPP_
#define BOOST_DLL_DETAIL_CTOR_DTOR_HPP_
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#include <boost/dll/detail/aggressive_ptr_cast.hpp>
#include <boost/dll/detail/get_mem_fn_type.hpp>
#if defined(BOOST_MSVC) || defined(BOOST_MSVC_VER)
# include <boost/dll/detail/demangling/msvc.hpp>
#else
# include <boost/dll/detail/demangling/itanium.hpp>
#endif
namespace boost { namespace dll { namespace detail {
/*!
* This class stores a constructor.
*
* In some compilers there are several constructors in code, which may include an allocating one.
* This can be used if the imported class shall be put on the heap, which is why the class provied both types.
*/
template<typename Signature>
struct constructor;
template<typename Class, typename ...Args>
struct constructor<Class(Args...)> {
typedef typename detail::get_mem_fn_type<Class, void(Args...)>::mem_fn standard_t;
typedef Class*(*allocating_t)(Args...);
//! The standard, i.e. not allocating constructor. @warning May differ with the compiler. Use @ref constructor::call_standard instead.
standard_t standard;
//! The allocating constructor. @warning May differ with the compiler. Use @ref constructor::call_allocating instead.
allocating_t allocating;
//! Call the standard contructor
void call_standard (Class * const ptr, Args...args){ (ptr->*standard)(static_cast<Args>(args)...); }
//! Call the deleting destructor
Class * call_allocating(Args...args){ return allocating(static_cast<Args>(args)...); }
//! True if a allocating constructor could be loaded.
bool has_allocating() const { return allocating != nullptr; }
//! True if a standard constructor could be loaded.
bool has_standard() const { return standard != nullptr; }
//! False if neither the allocating nor the standard constructor is available.
bool is_empty() const { return (allocating == nullptr) && (standard == nullptr) ; }
constructor() = delete;
constructor(const constructor &) = default;
explicit constructor(standard_t standard, allocating_t allocating = nullptr)
: standard(standard)
, allocating(allocating)
{}
};
template <typename Class>
struct destructor {
#if !defined(_WIN32)
typedef void(*type)(Class* const);
#elif !defined(_WIN64)
typedef void(__thiscall * type)(Class* const);
#else
typedef void(__cdecl * type)(Class* const);
#endif
typedef type standard_t;
typedef type deleting_t;
//! The standard, i.e. not deleting destructor. @warning May differ with the compiler. Use @ref destructor::call_standard instead.
standard_t standard;
//! The deleting destructor. @warning May differ with the compiler. Use @ref destructor::call_deallocating instead.
deleting_t deleting;
//! Call the standard contructor
void call_standard(Class * const ptr){ standard(ptr); }
//! Call the deleting destructor
void call_deleting(Class * const ptr){ deleting(ptr); }
//! True if a deleting destructor could be loaded.
bool has_deleting() const { return deleting != nullptr; }
//! True if a standard destructor could be loaded.
bool has_standard() const { return standard != nullptr; }
//! False if neither the deleting nor the standard destructor is available.
bool is_empty() const { return (deleting == nullptr) && (standard == nullptr) ; }
destructor() = delete;
//! Copy destructor.
destructor(const destructor &) = default;
//! Construct it from both the standard destructor and the allocating destructor
explicit destructor(const standard_t &standard, const deleting_t &deleting = nullptr)
: standard(standard)
, deleting(deleting)
{}
};
#if defined(BOOST_MSVC) || defined(BOOST_MSVC_VER)
template<typename Signature, typename Lib>
constructor<Signature> load_ctor(Lib & lib, const mangled_storage_impl::ctor_sym & ct) {
typedef typename constructor<Signature>::standard_t standard_t;
standard_t ctor = lib.template get<standard_t>(ct);
return constructor<Signature>(ctor);
}
template<typename Class, typename Lib>
destructor<Class> load_dtor(Lib & lib, const mangled_storage_impl::dtor_sym & dt) {
typedef typename destructor<Class>::standard_t standard_t;
//@apolukhin That does NOT work this way with MSVC-14 x32 via memcpy. The x64 is different.
//standard_t dtor = &lib.template get< typename boost::remove_pointer<standard_t>::type >(dt);
void * buf = &lib.template get<int>(dt);
standard_t dtor;
std::memcpy(&dtor, &buf, sizeof(dtor));
return destructor<Class>(dtor);
}
#else
template<typename Signature, typename Lib>
constructor<Signature> load_ctor(Lib & lib, const mangled_storage_impl::ctor_sym & ct) {
typedef typename constructor<Signature>::standard_t stand;
typedef typename constructor<Signature>::allocating_t alloc;
stand s = nullptr;
alloc a = nullptr;
//see here for the abi http://mentorembedded.github.io/cxx-abi/abi.html#mangling-special-ctor-dtor
if (!ct.C1.empty())
{
//the only way this works on mingw/win.
//For some reason there is always an 0xA in the following poniter, which screws with the this pointer.
void *buf = &lib.template get<int>(ct.C1);
std::memcpy(&s, &buf, sizeof(void*));
}
if (!ct.C3.empty())
{
void *buf = &lib.template get<int>(ct.C3);
std::memcpy(&a, &buf, sizeof(void*));
}
return constructor<Signature>(s,a);
}
template<typename Class, typename Lib>
destructor<Class> load_dtor(Lib & lib, const mangled_storage_impl::dtor_sym & dt) {
typedef typename destructor<Class>::standard_t stand;
typedef typename destructor<Class>::deleting_t delet;
stand s = nullptr;
delet d = nullptr;
//see here for the abi http://mentorembedded.github.io/cxx-abi/abi.html#mangling-special-ctor-dtor
if (!dt.D1.empty()) {
s = &lib.template get< typename boost::remove_pointer<stand>::type >(dt.D1);
}
if (!dt.D0.empty()) {
d = &lib.template get< typename boost::remove_pointer<delet>::type >(dt.D0);
}
return destructor<Class>(s,d);
}
#endif
}}} // namespace boost::dll::detail
#endif /* BOOST_DLL_DETAIL_CTOR_DTOR_HPP_ */
// Copyright 2015 Klemens Morgenstern
//
// This file provides a demangling for function names, i.e. entry points of a dll.
//
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_DLL_DEMANGLE_SYMBOL_HPP_
#define BOOST_DLL_DEMANGLE_SYMBOL_HPP_
#include <boost/config.hpp>
#include <string>
#include <algorithm>
#if defined(BOOST_MSVC) || defined(BOOST_MSVC_FULL_VER)
namespace boost
{
namespace dll
{
namespace detail
{
typedef void * (__cdecl * allocation_function)(std::size_t);
typedef void (__cdecl * free_function)(void *);
extern "C" char* __unDName( char* outputString,
const char* name,
int maxStringLength, // Note, COMMA is leading following optional arguments
allocation_function pAlloc,
free_function pFree,
unsigned short disableFlags
);
inline std::string demangle_symbol(const char *mangled_name)
{
allocation_function alloc = [](std::size_t size){return static_cast<void*>(new char[size]);};
free_function free_f = [](void* p){delete [] static_cast<char*>(p);};
std::unique_ptr<char> name { __unDName(
nullptr,
mangled_name,
0,
alloc,
free_f,
static_cast<unsigned short>(0))};
return std::string(name.get());
}
inline std::string demangle_symbol(const std::string& mangled_name)
{
return demangle_symbol(mangled_name.c_str());
}
}}}
#else
#include <boost/core/demangle.hpp>
namespace boost
{
namespace dll
{
namespace detail
{
inline std::string demangle_symbol(const char *mangled_name)
{
if (*mangled_name == '_')
{
//because it start's with an underline _
auto dm = boost::core::demangle(mangled_name);
if (!dm.empty())
return dm;
else
return (mangled_name);
}
//could not demangled
return "";
}
//for my personal convinience
inline std::string demangle_symbol(const std::string& mangled_name)
{
return demangle_symbol(mangled_name.c_str());
}
}
namespace experimental
{
using ::boost::dll::detail::demangle_symbol;
}
}}
#endif
#endif /* BOOST_DEMANGLE_HPP_ */
// Copyright 2016 Klemens Morgenstern
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_DLL_DETAIL_DEMANGLING_ITANIUM_HPP_
#define BOOST_DLL_DETAIL_DEMANGLING_ITANIUM_HPP_
#include <boost/dll/detail/demangling/mangled_storage_base.hpp>
#include <iterator>
#include <algorithm>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/is_rvalue_reference.hpp>
#include <boost/type_traits/is_lvalue_reference.hpp>
#include <boost/type_traits/function_traits.hpp>
namespace boost { namespace dll { namespace detail {
class mangled_storage_impl : public mangled_storage_base
{
template<typename T>
struct dummy {};
template<typename Return, typename ...Args>
std::vector<std::string> get_func_params(dummy<Return(Args...)>) const
{
return {get_name<Args>()...};
}
template<typename Return, typename ...Args>
std::string get_return_type(dummy<Return(Args...)>) const
{
return get_name<Return>();
}
public:
using mangled_storage_base::mangled_storage_base;
struct ctor_sym
{
std::string C1;
std::string C2;
std::string C3;
bool empty() const
{
return C1.empty() && C2.empty() && C3.empty();
}
};
struct dtor_sym
{
std::string D0;
std::string D1;
std::string D2;
bool empty() const
{
return D0.empty() && D1.empty() && D2.empty();
}
};
template<typename T>
std::string get_variable(const std::string &name) const;
template<typename Func>
std::string get_function(const std::string &name) const;
template<typename Class, typename Func>
std::string get_mem_fn(const std::string &name) const;
template<typename Signature>
ctor_sym get_constructor() const;
template<typename Class>
dtor_sym get_destructor() const;
template<typename T>
std::string get_type_info() const;
template<typename T>
std::vector<std::string> get_related() const;
};
namespace parser
{
inline std::string const_rule_impl(true_type ) {return " const";}
inline std::string const_rule_impl(false_type) {return "";}
template<typename T>
std::string const_rule() {using t = is_const<typename remove_reference<T>::type>; return const_rule_impl(t());}
inline std::string volatile_rule_impl(true_type ) {return " volatile";}
inline std::string volatile_rule_impl(false_type) {return "";}
template<typename T>
std::string volatile_rule() {using t = is_volatile<typename remove_reference<T>::type>; return volatile_rule_impl(t());}
inline std::string reference_rule_impl(false_type, false_type) {return "";}
inline std::string reference_rule_impl(true_type, false_type) {return "&" ;}
inline std::string reference_rule_impl(false_type, true_type ) {return "&&";}
template<typename T>
std::string reference_rule() {using t_l = is_lvalue_reference<T>; using t_r = is_rvalue_reference<T>; return reference_rule_impl(t_l(), t_r());}
//it takes a string, because it may be overloaded.
template<typename T>
std::string type_rule(const std::string & type_name)
{
using namespace std;
return type_name +
const_rule<T>() +
volatile_rule<T>() +
reference_rule<T>();