From 02afe960644466b8e3854f3bec48c03a294c1e35 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Wed, 24 Jun 2020 01:39:32 +0200 Subject: Add some more annotations --- minecproxy/idle.c | 2 +- minecproxy/igmp.c | 12 ++++++------ minecproxy/main.c | 14 +++++++------- minecproxy/main.h | 2 +- minecproxy/server-config.c | 2 +- minecproxy/server-rcon.c | 2 +- minecproxy/signal-handler.c | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) (limited to 'minecproxy') diff --git a/minecproxy/idle.c b/minecproxy/idle.c index 79c7bab..90d7210 100644 --- a/minecproxy/idle.c +++ b/minecproxy/idle.c @@ -115,7 +115,7 @@ write_cmd(char **pos, const char *begin, const char *end) } static int -idle_check_handshake_complete(struct uring_task *task, int res) +idle_check_handshake_complete(struct uring_task *task, _unused_ int res) { size_t remain; char *pos; diff --git a/minecproxy/igmp.c b/minecproxy/igmp.c index dc43a9f..f1d380d 100644 --- a/minecproxy/igmp.c +++ b/minecproxy/igmp.c @@ -26,7 +26,7 @@ struct igmp { #define IPV4_MIN_HDR_LEN 20 #define IGMP_MIN_LEN 8 -struct __attribute__((packed, scalar_storage_order("big-endian"))) ipv4_hdr { +struct _big_endian_ ipv4_hdr { unsigned version:4; unsigned ihl:4; unsigned dscp:6; @@ -52,20 +52,20 @@ enum igmp_type { }; union igmp_msg { - struct __attribute__((packed, scalar_storage_order("big-endian"))) { + struct _big_endian_ { enum igmp_type type:8; unsigned unknown:8; unsigned checksum:16; } common; - struct __attribute__((packed, scalar_storage_order("big-endian"))) { + struct _big_endian_ { enum igmp_type type:8; unsigned resptime:8; unsigned checksum:16; unsigned addr:32; } v2; - struct __attribute__((packed, scalar_storage_order("big-endian"))) { + struct _big_endian_ { enum igmp_type type:8; unsigned reserved1:8; unsigned checksum:16; @@ -83,7 +83,7 @@ enum igmp_v3_record_type { }; union igmp_v3_record { - struct __attribute__((packed, scalar_storage_order("big-endian"))) { + struct _big_endian_ { enum igmp_v3_record_type type:8; unsigned auxlen:8; unsigned nsrcs:16; @@ -227,7 +227,7 @@ igmp_parse(struct igmp *igmp) switch (igmp_msg->common.type) { case IGMP_V1_MEMBERSHIP_REPORT: debug(DBG_IGMP, "igmp_v1_membership_report"); - /* fall through */ + _fallthrough_; case IGMP_V2_MEMBERSHIP_REPORT: { struct in_addr src; diff --git a/minecproxy/main.c b/minecproxy/main.c index 9a57aa8..8513766 100644 --- a/minecproxy/main.c +++ b/minecproxy/main.c @@ -156,7 +156,7 @@ __debug(enum debug_lvl lvl, const char *fmt, ...) va_end(ap); } -__attribute__((noreturn)) void +_noreturn_ void __die(const char *fmt, ...) { va_list ap; @@ -418,8 +418,8 @@ const struct { } }; -__attribute__((noreturn)) static void -usage(int argc, char **argv, bool invalid) +_noreturn_ static void +usage(char **argv, bool invalid) { if (invalid) info("Invalid option(s)"); @@ -548,23 +548,23 @@ cfg_init(int argc, char **argv) } if (!debug_category_str[i].name) - usage(argc, argv, true); + usage(argv, true); debug_mask |= DBG_VERBOSE; debug_mask |= debug_category_str[i].val; break; case 'h': - usage(argc, argv, false); + usage(argv, false); default: - usage(argc, argv, true); + usage(argv, true); } } if (optind < argc) - usage(argc, argv, true); + usage(argv, true); } static void diff --git a/minecproxy/main.h b/minecproxy/main.h index f1f5df2..8c8add0 100644 --- a/minecproxy/main.h +++ b/minecproxy/main.h @@ -51,7 +51,7 @@ struct uring_task_buf { struct uring_task { const char *name; - unsigned refcount; + int refcount; /* signed to catch refcount bugs */ int fd; struct uring_task *parent; void (*free)(struct uring_task *); diff --git a/minecproxy/server-config.c b/minecproxy/server-config.c index 5d8c724..8786f88 100644 --- a/minecproxy/server-config.c +++ b/minecproxy/server-config.c @@ -325,7 +325,7 @@ scfg_valid_filename(const char *name) struct server_cfg_monitor { struct uring_task task; - char buf[4096] __attribute__((aligned(__alignof__(struct inotify_event)))); + char buf[4096] _alignas_(struct inotify_event); }; static void diff --git a/minecproxy/server-rcon.c b/minecproxy/server-rcon.c index 1f8ef70..b19bdb1 100644 --- a/minecproxy/server-rcon.c +++ b/minecproxy/server-rcon.c @@ -17,7 +17,7 @@ #include "rcon-protocol.h" static int -rcon_packet_complete(struct uring_task *task, int res) +rcon_packet_complete(struct uring_task *task, _unused_ int res) { assert_return(task, -EINVAL); assert_task_alive_or(DBG_RCON, task, return -EINTR); diff --git a/minecproxy/signal-handler.c b/minecproxy/signal-handler.c index 0173bf8..15c3816 100644 --- a/minecproxy/signal-handler.c +++ b/minecproxy/signal-handler.c @@ -110,7 +110,7 @@ out: } static void -hack_signal_handler(int signum, siginfo_t *si, void *ucontext) +hack_signal_handler(int signum, siginfo_t *si, _unused_ void *ucontext) { ssize_t r; -- cgit v1.2.3