Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt8
-rw-r--r--include/llfio/v2.0/config.hpp28
-rw-r--r--include/llfio/v2.0/io_handle.hpp66
-rw-r--r--src/llfio.cpp8
4 files changed, 51 insertions, 59 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 67ff41ba..48f199a3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -307,10 +307,10 @@ if(WIN32)
endif()
endif()
# Anyone using the static or dynamic libraries is not using the header only variant
-foreach(lib llfio_sl llfio_dl)
- target_compile_definitions(${lib} INTERFACE LLFIO_HEADERS_ONLY=0)
- target_compile_definitions(${lib} PRIVATE LLFIO_SOURCE=1)
-endforeach()
+target_compile_definitions(llfio_sl INTERFACE LLFIO_HEADERS_ONLY=0)
+target_compile_definitions(llfio_dl INTERFACE LLFIO_HEADERS_ONLY=0)
+target_compile_definitions(llfio_sl PRIVATE LLFIO_SOURCE=1 LLFIO_STATIC_LINK=1)
+target_compile_definitions(llfio_dl PRIVATE LLFIO_SOURCE=1 LLFIO_DYN_LINK=1)
if(TARGET llfio-example_single-header)
set(compiler_has_cxx_17 0)
foreach(feature ${CMAKE_CXX_COMPILE_FEATURES})
diff --git a/include/llfio/v2.0/config.hpp b/include/llfio/v2.0/config.hpp
index 5ef1ab0c..21f806cf 100644
--- a/include/llfio/v2.0/config.hpp
+++ b/include/llfio/v2.0/config.hpp
@@ -34,8 +34,8 @@ Distributed under the Boost Software License, Version 1.0.
//! \defgroup config Configuration macros
-#if !defined(LLFIO_HEADERS_ONLY) && !defined(BOOST_ALL_DYN_LINK)
-//! \brief Whether LLFIO is a headers only library. Defaults to 1 unless BOOST_ALL_DYN_LINK is defined. \ingroup config
+#if !defined(LLFIO_HEADERS_ONLY)
+//! \brief Whether LLFIO is a headers only library. Defaults to 1. \ingroup config
#define LLFIO_HEADERS_ONLY 1
#endif
@@ -267,11 +267,9 @@ LLFIO_V2_NAMESPACE_END
// Configure LLFIO_DECL
-#if(defined(LLFIO_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(LLFIO_STATIC_LINK)
-
+#if defined(LLFIO_DYN_LINK) && !defined(LLFIO_STATIC_LINK)
#if defined(LLFIO_SOURCE)
#define LLFIO_DECL QUICKCPPLIB_SYMBOL_EXPORT
-#define LLFIO_BUILD_DLL
#else
#define LLFIO_DECL QUICKCPPLIB_SYMBOL_IMPORT
#endif
@@ -419,23 +417,6 @@ namespace win
LLFIO_V2_NAMESPACE_END
-#if 0
-///////////////////////////////////////////////////////////////////////////////
-// Auto library naming
-#if !defined(LLFIO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(LLFIO_NO_LIB) && !LLFIO_STANDALONE && !LLFIO_HEADERS_ONLY
-
-#define BOOST_LIB_NAME boost_llfio
-
-// tell the auto-link code to select a dll when required:
-#if defined(BOOST_ALL_DYN_LINK) || defined(LLFIO_DYN_LINK)
-#define BOOST_DYN_LINK
-#endif
-
-#include <boost/config/auto_link.hpp>
-
-#endif // auto-linking disabled
-#endif
-
//#define BOOST_THREAD_VERSION 4
//#define BOOST_THREAD_PROVIDES_VARIADIC_THREAD
//#define BOOST_THREAD_DONT_PROVIDE_FUTURE
@@ -457,6 +438,9 @@ function exported from the LLFIO DLL if not building headers only.
*/
#define LLFIO_HEADERS_ONLY_VIRTUAL_SPEC inline virtual
#else
+#if LLFIO_SOURCE && !LLFIO_HEADERS_ONLY
+#error LLFIO_HEADERS_ONLY should never be zero when compiling the static or dynamic library
+#endif
#define LLFIO_HEADERS_ONLY_FUNC_SPEC extern LLFIO_DECL
#define LLFIO_HEADERS_ONLY_MEMFUNC_SPEC
#define LLFIO_HEADERS_ONLY_VIRTUAL_SPEC virtual
diff --git a/include/llfio/v2.0/io_handle.hpp b/include/llfio/v2.0/io_handle.hpp
index 0500a9b3..22850150 100644
--- a/include/llfio/v2.0/io_handle.hpp
+++ b/include/llfio/v2.0/io_handle.hpp
@@ -116,37 +116,7 @@ public:
\mallocs Multiple dynamic memory allocations and deallocations.
*/
- LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<void> set_multiplexer(io_multiplexer *c = this_thread::multiplexer()) noexcept
- {
- if(!is_multiplexable())
- {
- return errc::operation_not_supported;
- }
- if(c == _ctx)
- {
- return success();
- }
- if(_ctx != nullptr)
- {
- OUTCOME_TRY(_ctx->do_io_handle_deregister(this));
- _ctx = nullptr;
- }
- if(c != nullptr)
- {
- OUTCOME_TRY(state, c->do_io_handle_register(this));
- _v.behaviour = (_v.behaviour & ~(native_handle_type::disposition::_multiplexer_state_bit0 | native_handle_type::disposition::_multiplexer_state_bit1));
- if((state & 1) != 0)
- {
- _v.behaviour |= native_handle_type::disposition::_multiplexer_state_bit0;
- }
- if((state & 2) != 0)
- {
- _v.behaviour |= native_handle_type::disposition::_multiplexer_state_bit1;
- }
- }
- _ctx = c;
- return success();
- }
+ virtual result<void> set_multiplexer(io_multiplexer *c = this_thread::multiplexer()) noexcept; // implementation is below
protected:
//! The virtualised implementation of `max_buffers()` used if no multiplexer has been set.
@@ -499,6 +469,40 @@ public:
};
static_assert((sizeof(void *) == 4 && sizeof(io_handle) == 20) || (sizeof(void *) == 8 && sizeof(io_handle) == 32), "io_handle is not 20 or 32 bytes in size!");
+// Out of line definition purely to work around a bug in GCC where if marked inline,
+// its visibility is hidden and links fail
+inline result<void> io_handle::set_multiplexer(io_multiplexer *c) noexcept
+{
+ if(!is_multiplexable())
+ {
+ return errc::operation_not_supported;
+ }
+ if(c == _ctx)
+ {
+ return success();
+ }
+ if(_ctx != nullptr)
+ {
+ OUTCOME_TRY(_ctx->do_io_handle_deregister(this));
+ _ctx = nullptr;
+ }
+ if(c != nullptr)
+ {
+ OUTCOME_TRY(state, c->do_io_handle_register(this));
+ _v.behaviour = (_v.behaviour & ~(native_handle_type::disposition::_multiplexer_state_bit0 | native_handle_type::disposition::_multiplexer_state_bit1));
+ if((state & 1) != 0)
+ {
+ _v.behaviour |= native_handle_type::disposition::_multiplexer_state_bit0;
+ }
+ if((state & 2) != 0)
+ {
+ _v.behaviour |= native_handle_type::disposition::_multiplexer_state_bit1;
+ }
+ }
+ _ctx = c;
+ return success();
+}
+
inline size_t io_multiplexer::do_io_handle_max_buffers(const io_handle *h) const noexcept
{
return h->_do_max_buffers();
diff --git a/src/llfio.cpp b/src/llfio.cpp
index 4174d6d9..ada9477f 100644
--- a/src/llfio.cpp
+++ b/src/llfio.cpp
@@ -1,3 +1,7 @@
-#define LLFIO_DYN_LINK 1
-#define LLFIO_SOURCE 1
+#if !LLFIO_SOURCE
+#error This should not occur
+#endif
+#ifdef LLFIO_HEADERS_ONLY
+#error This should not occur
+#endif
#include "../include/llfio/llfio.hpp"