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 53
53
// ---------------------------------------------------------------------------------------------------------
54
54
55
55
#if !defined(DASYNQ_HAVE_KQUEUE )
56
- #if defined(__OpenBSD__ ) || defined(__APPLE__ ) || defined(__FreeBSD__ )
56
+ #if defined(__OpenBSD__ ) || defined(__APPLE__ ) || defined(__FreeBSD__ ) || defined( __NetBSD__ )
57
57
#define DASYNQ_HAVE_KQUEUE 1
58
58
#endif
59
59
#endif
Original file line number Diff line number Diff line change 4
4
#include < unistd.h>
5
5
#include < fcntl.h>
6
6
7
- #ifdef DASYNQ_HAVE_EVENTFD
7
+ #include < system_error>
8
+ #include < tuple>
9
+
10
+ #if DASYNQ_HAVE_EVENTFD
8
11
#include < sys/eventfd.h>
9
12
#endif
10
13
@@ -24,7 +27,7 @@ template <typename Base, typename Mutex = typename Base::mutex_t> class interrup
24
27
template <typename Base> class interrupt_channel <Base, null_mutex> : public Base
25
28
{
26
29
public:
27
- void interrupt_wait ()
30
+ void interrupt_wait () noexcept
28
31
{
29
32
30
33
}
@@ -33,7 +36,7 @@ template <typename Base> class interrupt_channel<Base, null_mutex> : public Base
33
36
template <typename Base, typename Mutex> class interrupt_channel : public Base
34
37
{
35
38
#if !DASYNQ_HAVE_EVENTFD
36
- static inline int create_pipe (int filedes[2 ])
39
+ static inline int create_pipe (int filedes[2 ]) noexcept
37
40
{
38
41
return pipe2 (filedes, O_CLOEXEC | O_NONBLOCK);
39
42
}
@@ -63,6 +66,9 @@ template <typename Base, typename Mutex> class interrupt_channel : public Base
63
66
pipe_w_fd = pipedes[1 ];
64
67
#else
65
68
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
+ }
66
72
#endif
67
73
68
74
try {
@@ -106,7 +112,7 @@ template <typename Base, typename Mutex> class interrupt_channel : public Base
106
112
}
107
113
}
108
114
109
- void interrupt_wait ()
115
+ void interrupt_wait () noexcept
110
116
{
111
117
#if !DASYNQ_HAVE_EVENTFD
112
118
char buf[1 ] = { 0 };
Original file line number Diff line number Diff line change @@ -93,9 +93,14 @@ class svector
93
93
bool change_capacity (size_type c)
94
94
noexcept (std::is_nothrow_move_constructible<T>::value || std::is_nothrow_copy_constructible<T>::value)
95
95
{
96
+ _Pragma (" GCC diagnostic push" )
97
+ _Pragma (" GCC diagnostic ignored \" -Walloc-size-larger-than=\" " )
98
+
96
99
T *new_storage = (T *)(new (std::nothrow) char [c * sizeof (T)]);
97
100
if (new_storage == nullptr ) return false ;
98
101
102
+ _Pragma (" GCC diagnostic pop" )
103
+
99
104
// To transfer, we prefer move unless it is throwing and copy exists
100
105
svec_helper::move_helper<T>::move (array, new_storage, size_v);
101
106
@@ -223,9 +228,8 @@ class svector
223
228
return std::numeric_limits<size_type>::max () / sizeof (T);
224
229
225
230
// 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;
229
233
}
230
234
231
235
void reserve (size_t amount)
You can’t perform that action at this time.
0 commit comments