aboutsummaryrefslogtreecommitdiff
path: root/nio.h
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-11-26 12:35:33 +0100
committerToni Uhlig <matzeton@googlemail.com>2023-12-01 06:43:39 +0100
commitff77bab398157de9c5a271b28708ee02bd735ccb (patch)
tree6ae3e8b0abcf3dda481154e91bc6e97f6536a47f /nio.h
parentd274a06176156b6eb8b1523375f94cbe5ecbbab7 (diff)
Warn about unused return values that are quite important.
* CI: ArchLinux build should now instrument `-Werror` * CI: Increased OpenWrt build verbosity Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'nio.h')
-rw-r--r--nio.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/nio.h b/nio.h
index 76bb7c8cb..60e1b0926 100644
--- a/nio.h
+++ b/nio.h
@@ -3,6 +3,8 @@
#include <poll.h>
+#define WARN_UNUSED __attribute__((__warn_unused_result__))
+
enum
{
NIO_SUCCESS = 0,
@@ -34,41 +36,55 @@ struct nio
void nio_init(struct nio * io);
+WARN_UNUSED
int nio_use_poll(struct nio * io, nfds_t max_fds);
+WARN_UNUSED
int nio_use_epoll(struct nio * io, int max_events);
+WARN_UNUSED
int nio_add_fd(struct nio * io, int fd, int event_flags, void * ptr);
+WARN_UNUSED
int nio_mod_fd(struct nio * io, int fd, int event_flags, void * ptr);
+WARN_UNUSED
int nio_del_fd(struct nio * io, int fd);
+WARN_UNUSED
int nio_run(struct nio * io, int timeout);
+WARN_UNUSED
static inline int nio_get_nready(struct nio const * const io)
{
return io->nready;
}
+WARN_UNUSED
int nio_check(struct nio * io, int index, int events);
+WARN_UNUSED
int nio_is_valid(struct nio const * const io, int index);
+WARN_UNUSED
int nio_get_fd(struct nio * io, int index);
+WARN_UNUSED
void * nio_get_ptr(struct nio * io, int index);
+WARN_UNUSED
static inline int nio_has_input(struct nio * io, int index)
{
return nio_check(io, index, NIO_EVENT_INPUT);
}
+WARN_UNUSED
static inline int nio_can_output(struct nio * io, int index)
{
return nio_check(io, index, NIO_EVENT_OUTPUT);
}
+WARN_UNUSED
static inline int nio_has_error(struct nio * io, int index)
{
return nio_check(io, index, NIO_EVENT_ERROR);