From cc9e98f382d6c1158075e0f18f895b04bca352a9 Mon Sep 17 00:00:00 2001 From: "easyaspi314 (Devin)" Date: Thu, 8 Nov 2018 23:32:14 -0500 Subject: [PATCH] Conditionally enable the exception-throwing constructors This allows MIO to be compiled with -fno-exceptions, as that is the only place where MIO uses them. --- include/mio/mmap.hpp | 3 ++- include/mio/shared_mmap.hpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/mio/mmap.hpp b/include/mio/mmap.hpp index 2e69e63..b7803ea 100644 --- a/include/mio/mmap.hpp +++ b/include/mio/mmap.hpp @@ -103,6 +103,7 @@ public: */ basic_mmap() = default; +#ifdef __cpp_exceptions /** * The same as invoking the `map` function, except any error that may occur * while establishing the mapping is wrapped in a `std::system_error` and is @@ -127,7 +128,7 @@ public: map(handle, offset, length, error); if(error) { throw std::system_error(error); } } - +#endif /** * `basic_mmap` has single-ownership semantics, so transferring ownership * may only be accomplished by moving the object. diff --git a/include/mio/shared_mmap.hpp b/include/mio/shared_mmap.hpp index 6ce187f..19be761 100644 --- a/include/mio/shared_mmap.hpp +++ b/include/mio/shared_mmap.hpp @@ -87,6 +87,7 @@ public: return *this; } +#ifdef __cpp_exceptions /** * The same as invoking the `map` function, except any error that may occur * while establishing the mapping is wrapped in a `std::system_error` and is @@ -111,6 +112,7 @@ public: map(handle, offset, length, error); if(error) { throw std::system_error(error); } } +#endif /** * If this is a read-write mapping and the last reference to the mapping,