]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
Annotate `set_privileged_socket_opt` with UNUSED
authorflu0r1ne <flu0r1ne@flu0r1ne.net>
Mon, 2 Oct 2023 23:10:43 +0000 (18:10 -0500)
committerflu0r1ne <flu0r1ne@flu0r1ne.net>
Mon, 2 Oct 2023 23:10:43 +0000 (18:10 -0500)
The `set_privileged_socket_opt` function is currently called only when
`SO_MARK` or `SO_BINDTODEVICE` are defined. On systems that do not support
either feature, `set_privileged_socket_opt` is expected to be unused. Adding
an annotation suppresses compiler warnings.

packet/construct_unix.c

index 8df9997a212a9addea38fa9a6e3b687fb44bbfa9..0d3b1f2fa4b359e0760dfce5aacc01ddd9f0f528 100644 (file)
@@ -294,21 +294,19 @@ int construct_udp6_packet(
 typedef cap_value_t mayadd_cap_value_t;
 #define MAYADD_CAP_NET_RAW CAP_NET_RAW
 #define MAYADD_CAP_NET_ADMIN CAP_NET_ADMIN
-#define MAYADD_UNUSED
 
 #else /* ifdef HAVE_LIBCAP */
 
 typedef int mayadd_cap_value_t;
 #define MAYADD_CAP_NET_RAW ((mayadd_cap_value_t) 0)
 #define MAYADD_CAP_NET_ADMIN ((mayadd_cap_value_t) 0)
-#define MAYADD_UNUSED UNUSED
 
 #endif /* ifdef HAVE_LIBCAP */
 
-static
+UNUSED static
 int set_privileged_socket_opt(int socket, int option_name,
     void const * option_value, socklen_t option_len,
-    MAYADD_UNUSED mayadd_cap_value_t required_cap) {
+    UNUSED mayadd_cap_value_t required_cap) {
 
     int result = -1;