Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop cxx03 #68

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build.jam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ constant boost_dependencies :
/boost/config//boost_config
/boost/core//boost_core
/boost/filesystem//boost_filesystem
/boost/function//boost_function
/boost/predef//boost_predef
/boost/smart_ptr//boost_smart_ptr
/boost/spirit//boost_spirit
Expand Down
8 changes: 0 additions & 8 deletions doc/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,7 @@ local doxygen_params =
\"forcedlinkfs{1}=\\xmlonly<link linkend='boost.dll.fs.\\1'>boost::dll::fs::\\1</link>\\endxmlonly\" \\
\"forcedmacrolink{1}=\\xmlonly<link linkend='\\1'>\\1</link>\\endxmlonly\" "
<doxygen:param>"PREDEFINED= \\
\"BOOST_RV_REF(T)=T&&\" \\
\"BOOST_RV_REF(shared_library)=shared_library&&\" \\
\"BOOST_COPY_ASSIGN_REF(shared_library)=const shared_library&\" \\
\"BOOST_MOVABLE_BUT_NOT_COPYABLE(shared_library)= \\
shared_library(const shared_library&) = delete; \\
shared_library& operator=(const shared_library&) = delete; \" \\
\"BOOST_DLL_IMPORT_RESULT_TYPE=result_type\" \\
\"BOOST_DLL_MANGLED_IMPORT_RESULT_TYPE=result_type\" \\
\"BOOST_EXPLICIT_OPERATOR_BOOL()=explicit operator bool() const noexcept;\" \\
\"BOOST_DLL_DOXYGEN\" "
;

Expand Down
40 changes: 30 additions & 10 deletions include/boost/dll/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
#endif

#ifdef BOOST_DLL_DOXYGEN
/// Define this macro to make Boost.DLL use C++17's std::filesystem::path, std::system_error and std::error_code.

/// Define this macro to make Boost.DLL use C++17's std::filesystem::path and std::system_error.
#define BOOST_DLL_USE_STD_FS BOOST_DLL_USE_STD_FS

/// This namespace contains aliases to the Boost or C++17 classes. Aliases are configured using BOOST_DLL_USE_STD_FS macro.
Expand All @@ -38,38 +39,57 @@ using system_error = std::conditional_t<BOOST_DLL_USE_STD_FS, std::system_error,

#endif

<<<<<<< HEAD
=======

>>>>>>> b753854... fixes
#ifdef BOOST_DLL_USE_STD_FS
#include <filesystem>
#include <system_error>

#include <system_error>

namespace boost { namespace dll { namespace fs {

using namespace std::filesystem;

using std::error_code;
<<<<<<< HEAD
<<<<<<< HEAD
using std::system_error;
=======
>>>>>>> 7d8af2a... wip
=======
using std::system_error;
using std::make_error_code;
using std::errc;
using std::system_category;
>>>>>>> af8fbe8... restore boost::system::system_error

}}}

#else // BOOST_DLL_USE_STD_FS

#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/system/error_code.hpp>
<<<<<<< HEAD
<<<<<<< HEAD
#include <boost/system/system_error.hpp>
=======
>>>>>>> 7d8af2a... wip
=======
#include <boost/system/system_error.hpp>
>>>>>>> b753854... fixes
#include <boost/system/error_code.hpp>

namespace boost { namespace dll { namespace fs {

using namespace boost::filesystem;

using boost::system::error_code;
<<<<<<< HEAD
<<<<<<< HEAD
using boost::system::system_error;
=======
>>>>>>> 7d8af2a... wip
=======
using boost::system::system_error;
using boost::system::errc::make_error_code;
namespace errc = boost::system::errc;
using boost::system::system_category;
>>>>>>> af8fbe8... restore boost::system::system_error

}}}

Expand Down
8 changes: 4 additions & 4 deletions include/boost/dll/detail/aggressive_ptr_cast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace boost { namespace dll { namespace detail {
// 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
aggressive_ptr_cast(From v) noexcept
{
static_assert(
boost::is_pointer<To>::value && boost::is_pointer<From>::value,
Expand Down Expand Up @@ -61,7 +61,7 @@ BOOST_FORCEINLINE typename boost::disable_if_c<boost::is_member_pointer<To>::val

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
aggressive_ptr_cast(From v) noexcept
{
static_assert(
boost::is_pointer<From>::value,
Expand Down Expand Up @@ -90,7 +90,7 @@ BOOST_FORCEINLINE typename boost::disable_if_c<!boost::is_reference<To>::value |

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
aggressive_ptr_cast(From v) noexcept
{
static_assert(
boost::is_pointer<From>::value,
Expand All @@ -109,7 +109,7 @@ BOOST_FORCEINLINE typename boost::disable_if_c<!boost::is_member_pointer<To>::va

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
aggressive_ptr_cast(From /* v */) noexcept
{
static_assert(
boost::is_pointer<To>::value,
Expand Down
2 changes: 1 addition & 1 deletion include/boost/dll/detail/elf_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class elf_info {
read_raw(fs, symbols[0], static_cast<std::size_t>(symtab_size - (symtab_size % sizeof(symbol_t))) );
}

static bool is_visible(const symbol_t& sym) BOOST_NOEXCEPT {
static bool is_visible(const symbol_t& sym) noexcept {
const unsigned char visibility = (sym.st_other & 0x03);
// `(sym.st_info >> 4) != STB_LOCAL_ && !!sym.st_size` check also workarounds the
// GCC's issue https://sourceware.org/bugzilla/show_bug.cgi?id=13621
Expand Down
2 changes: 1 addition & 1 deletion include/boost/dll/detail/pe_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class pe_info {
MSVCR110D.dll
*/
/*
static std::vector<std::string> depend_of(boost::dll::fs::error_code &ec) BOOST_NOEXCEPT {
static std::vector<std::string> depend_of(boost::dll::fs::error_code &ec) noexcept {
std::vector<std::string> ret;
IMAGE_DOS_HEADER* image_dos_header = (IMAGE_DOS_HEADER*)native();
Expand Down
16 changes: 8 additions & 8 deletions include/boost/dll/detail/posix/path_from_handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
# include <cstddef> // for std::ptrdiff_t

namespace boost { namespace dll { namespace detail {
inline void* strip_handle(void* handle) BOOST_NOEXCEPT {
inline void* strip_handle(void* handle) noexcept {
return reinterpret_cast<void*>(
(reinterpret_cast<std::ptrdiff_t>(handle) >> 2) << 2
);
}

inline boost::dll::fs::path path_from_handle(void* handle, boost::dll::fs::error_code &ec) {
inline boost::dll::fs::path path_from_handle(void* handle, std::error_code &ec) {
handle = strip_handle(handle);

// Iterate through all images currently in memory
Expand All @@ -53,8 +53,8 @@ namespace boost { namespace dll { namespace detail {
}

boost::dll::detail::reset_dlerror();
ec = boost::dll::fs::make_error_code(
boost::dll::fs::errc::bad_file_descriptor
ec = std::make_error_code(
std::errc::bad_file_descriptor
);

return boost::dll::fs::path();
Expand All @@ -78,7 +78,7 @@ namespace boost { namespace dll { namespace detail {
// ... // Ignoring remaning parts of the structure
};

inline boost::dll::fs::path path_from_handle(const void* handle, boost::dll::fs::error_code &ec) {
inline boost::dll::fs::path path_from_handle(const void* handle, std::error_code &ec) {
static const std::size_t work_around_b_24465209__offset = 128;
const struct soinfo* si = reinterpret_cast<const struct soinfo*>(
static_cast<const char*>(handle) + work_around_b_24465209__offset
Expand Down Expand Up @@ -119,7 +119,7 @@ namespace boost { namespace dll { namespace detail {
};
#endif // #if BOOST_OS_QNX

inline boost::dll::fs::path path_from_handle(void* handle, boost::dll::fs::error_code &ec) {
inline boost::dll::fs::path path_from_handle(void* handle, std::error_code &ec) {
// RTLD_DI_LINKMAP (RTLD_DI_ORIGIN returns only folder and is not suitable for this case)
// Obtain the Link_map for the handle that is specified.
// The p argument points to a Link_map pointer (Link_map
Expand All @@ -144,8 +144,8 @@ namespace boost { namespace dll { namespace detail {
#endif
if (!link_map) {
boost::dll::detail::reset_dlerror();
ec = boost::dll::fs::make_error_code(
boost::dll::fs::errc::bad_file_descriptor
ec = std::make_error_code(
std::errc::bad_file_descriptor
);

return boost::dll::fs::path();
Expand Down
27 changes: 15 additions & 12 deletions include/boost/dll/detail/posix/program_location_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <mach-o/dyld.h>

namespace boost { namespace dll { namespace detail {
inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code &ec) {
inline boost::dll::fs::path program_location_impl(std::error_code &ec) {
ec.clear();

char path[1024];
Expand All @@ -31,8 +31,8 @@ namespace boost { namespace dll { namespace detail {

char *p = new char[size];
if (_NSGetExecutablePath(p, &size) != 0) {
ec = boost::dll::fs::make_error_code(
boost::dll::fs::errc::bad_file_descriptor
ec = std::make_error_code(
std::errc::bad_file_descriptor
);
}

Expand All @@ -46,7 +46,7 @@ namespace boost { namespace dll { namespace detail {

#include <stdlib.h>
namespace boost { namespace dll { namespace detail {
inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code& ec) {
inline boost::dll::fs::path program_location_impl(std::error_code& ec) {
ec.clear();

return boost::dll::fs::path(getexecname());
Expand All @@ -60,7 +60,7 @@ namespace boost { namespace dll { namespace detail {
#include <stdlib.h>

namespace boost { namespace dll { namespace detail {
inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code& ec) {
inline boost::dll::fs::path program_location_impl(std::error_code& ec) {
ec.clear();

int mib[4];
Expand All @@ -81,7 +81,7 @@ namespace boost { namespace dll { namespace detail {
#elif BOOST_OS_BSD_NET

namespace boost { namespace dll { namespace detail {
inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code &ec) {
inline boost::dll::fs::path program_location_impl(std::error_code &ec) {
return boost::dll::fs::read_symlink("/proc/curproc/exe", ec);
}
}}} // namespace boost::dll::detail
Expand All @@ -90,7 +90,7 @@ namespace boost { namespace dll { namespace detail {


namespace boost { namespace dll { namespace detail {
inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code &ec) {
inline boost::dll::fs::path program_location_impl(std::error_code &ec) {
return boost::dll::fs::read_symlink("/proc/curproc/file", ec);
}
}}} // namespace boost::dll::detail
Expand All @@ -100,16 +100,16 @@ namespace boost { namespace dll { namespace detail {
#include <fstream>
#include <string> // for std::getline
namespace boost { namespace dll { namespace detail {
inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code &ec) {
inline boost::dll::fs::path program_location_impl(std::error_code &ec) {
ec.clear();

std::string s;
std::ifstream ifs("/proc/self/exefile");
std::getline(ifs, s);

if (ifs.fail() || s.empty()) {
ec = boost::dll::fs::make_error_code(
boost::dll::fs::errc::bad_file_descriptor
ec = std::make_error_code(
std::errc::bad_file_descriptor
);
}

Expand All @@ -120,12 +120,15 @@ namespace boost { namespace dll { namespace detail {
#else // BOOST_OS_LINUX || BOOST_OS_UNIX || BOOST_OS_HPUX || BOOST_OS_ANDROID

namespace boost { namespace dll { namespace detail {
inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code &ec) {
inline boost::dll::fs::path program_location_impl(std::error_code &ec) {
// We can not use
// boost::dll::detail::path_from_handle(dlopen(NULL, RTLD_LAZY | RTLD_LOCAL), ignore);
// because such code returns empty path.

return boost::dll::fs::read_symlink("/proc/self/exe", ec); // Linux specific
boost::dll::fs::error_code fs_errc;
auto result = boost::dll::fs::read_symlink("/proc/self/exe", fs_errc); // Linux specific
ec = fs_errc;
return result;
}
}}} // namespace boost::dll::detail

Expand Down
26 changes: 13 additions & 13 deletions include/boost/dll/detail/posix/shared_library_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ class shared_library_impl {
return actual_path;
}

void load(boost::dll::fs::path sl, load_mode::type portable_mode, boost::dll::fs::error_code &ec) {
void load(boost::dll::fs::path sl, load_mode::type portable_mode, std::error_code &ec) {
typedef int native_mode_t;
native_mode_t native_mode = static_cast<native_mode_t>(portable_mode);
unload();

// Do not allow opening NULL paths. User must use program_location() instead
if (sl.empty()) {
boost::dll::detail::reset_dlerror();
ec = boost::dll::fs::make_error_code(
boost::dll::fs::errc::bad_file_descriptor
ec = std::make_error_code(
std::errc::bad_file_descriptor
);

return;
Expand Down Expand Up @@ -122,8 +122,8 @@ class shared_library_impl {
boost::dll::fs::path loc = boost::dll::detail::program_location_impl(prog_loc_err);
if (boost::dll::fs::exists(actual_path) && !boost::dll::fs::equivalent(sl, loc, prog_loc_err)) {
// decorated path exists : current error is not a bad file descriptor and we are not trying to load the executable itself
ec = boost::dll::fs::make_error_code(
boost::dll::fs::errc::executable_format_error
ec = std::make_error_code(
std::errc::executable_format_error
);
return;
}
Expand All @@ -136,8 +136,8 @@ class shared_library_impl {
return;
}

ec = boost::dll::fs::make_error_code(
boost::dll::fs::errc::bad_file_descriptor
ec = std::make_error_code(
std::errc::bad_file_descriptor
);

// Maybe user wanted to load the executable itself? Checking...
Expand All @@ -154,8 +154,8 @@ class shared_library_impl {
boost::dll::detail::reset_dlerror();
handle_ = dlopen(NULL, native_mode);
if (!handle_) {
ec = boost::dll::fs::make_error_code(
boost::dll::fs::errc::bad_file_descriptor
ec = std::make_error_code(
std::errc::bad_file_descriptor
);
}
}
Expand All @@ -178,7 +178,7 @@ class shared_library_impl {
boost::core::invoke_swap(handle_, rhs.handle_);
}

boost::dll::fs::path full_module_path(boost::dll::fs::error_code &ec) const {
boost::dll::fs::path full_module_path(std::error_code &ec) const {
return boost::dll::detail::path_from_handle(handle_, ec);
}

Expand All @@ -191,12 +191,12 @@ class shared_library_impl {
#endif
}

void* symbol_addr(const char* sb, boost::dll::fs::error_code &ec) const noexcept {
void* symbol_addr(const char* sb, std::error_code &ec) const noexcept {
// dlsym - obtain the address of a symbol from a dlopen object
void* const symbol = dlsym(handle_, sb);
if (symbol == NULL) {
ec = boost::dll::fs::make_error_code(
boost::dll::fs::errc::invalid_seek
ec = std::make_error_code(
std::errc::invalid_seek
);
}

Expand Down
4 changes: 2 additions & 2 deletions include/boost/dll/detail/system_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

namespace boost { namespace dll { namespace detail {

inline void reset_dlerror() BOOST_NOEXCEPT {
inline void reset_dlerror() noexcept {
#if !BOOST_OS_WINDOWS
const char* const error_txt = dlerror();
(void)error_txt;
#endif
}

inline void report_error(const boost::dll::fs::error_code& ec, const char* message) {
inline void report_error(const std::error_code& ec, const char* message) {
#if !BOOST_OS_WINDOWS
const char* const error_txt = dlerror();
if (error_txt) {
Expand Down
Loading
Loading