File tree Expand file tree Collapse file tree 3 files changed +18
-8
lines changed
Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 5353// ---------------------------------------------------------------------------------------------------------
5454
5555#if !defined(DASYNQ_HAVE_KQUEUE )
56- #if defined(__OpenBSD__ ) || defined(__APPLE__ ) || defined(__FreeBSD__ )
56+ #if defined(__OpenBSD__ ) || defined(__APPLE__ ) || defined(__FreeBSD__ ) || defined( __NetBSD__ )
5757#define DASYNQ_HAVE_KQUEUE 1
5858#endif
5959#endif
Original file line number Diff line number Diff line change 44#include < unistd.h>
55#include < fcntl.h>
66
7- #ifdef DASYNQ_HAVE_EVENTFD
7+ #include < system_error>
8+ #include < tuple>
9+
10+ #if DASYNQ_HAVE_EVENTFD
811#include < sys/eventfd.h>
912#endif
1013
@@ -24,7 +27,7 @@ template <typename Base, typename Mutex = typename Base::mutex_t> class interrup
2427template <typename Base> class interrupt_channel <Base, null_mutex> : public Base
2528{
2629 public:
27- void interrupt_wait ()
30+ void interrupt_wait () noexcept
2831 {
2932
3033 }
@@ -33,7 +36,7 @@ template <typename Base> class interrupt_channel<Base, null_mutex> : public Base
3336template <typename Base, typename Mutex> class interrupt_channel : public Base
3437{
3538#if !DASYNQ_HAVE_EVENTFD
36- static inline int create_pipe (int filedes[2 ])
39+ static inline int create_pipe (int filedes[2 ]) noexcept
3740 {
3841 return pipe2 (filedes, O_CLOEXEC | O_NONBLOCK);
3942 }
@@ -63,6 +66,9 @@ template <typename Base, typename Mutex> class interrupt_channel : public Base
6366 pipe_w_fd = pipedes[1 ];
6467#else
6568 pipe_r_fd = eventfd (0 , EFD_CLOEXEC | EFD_NONBLOCK);
69+ if (pipe_r_fd == -1 ) {
70+ throw std::system_error (errno, std::system_category ());
71+ }
6672#endif
6773
6874 try {
@@ -106,7 +112,7 @@ template <typename Base, typename Mutex> class interrupt_channel : public Base
106112 }
107113 }
108114
109- void interrupt_wait ()
115+ void interrupt_wait () noexcept
110116 {
111117#if !DASYNQ_HAVE_EVENTFD
112118 char buf[1 ] = { 0 };
Original file line number Diff line number Diff line change @@ -93,9 +93,14 @@ class svector
9393 bool change_capacity (size_type c)
9494 noexcept (std::is_nothrow_move_constructible<T>::value || std::is_nothrow_copy_constructible<T>::value)
9595 {
96+ _Pragma (" GCC diagnostic push" )
97+ _Pragma (" GCC diagnostic ignored \" -Walloc-size-larger-than=\" " )
98+
9699 T *new_storage = (T *)(new (std::nothrow) char [c * sizeof (T)]);
97100 if (new_storage == nullptr ) return false ;
98101
102+ _Pragma (" GCC diagnostic pop" )
103+
99104 // To transfer, we prefer move unless it is throwing and copy exists
100105 svec_helper::move_helper<T>::move (array, new_storage, size_v);
101106
@@ -223,9 +228,8 @@ class svector
223228 return std::numeric_limits<size_type>::max () / sizeof (T);
224229
225230 // if we were to support allocators:
226- // size_t max = std::allocator_traits<std::allocator<char>>::max_size(std::allocator<T>());
227- // return max / sizeof(T);
228- // (but not / sizeof(T) for C++17 apparently)
231+ // size_t max = std::allocator_traits<std::allocator<T>>::max_size(std::allocator<T>());
232+ // return max;
229233 }
230234
231235 void reserve (size_t amount)
You can’t perform that action at this time.
0 commit comments