summaryrefslogtreecommitdiff
path: root/sysdep
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-10-14 15:37:04 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2016-11-01 14:52:54 +0100
commit3e236955c9369475872b9b86a58502fa777b50b9 (patch)
treed43b519c2289a353e56c32b42c402f9fa12d0e13 /sysdep
parent17fe57d8dcc89aea520788914b252cf49cf060ff (diff)
Build: switch on -Wextra, get rid of most of the warnings
There are several unresolved -Wmissing-field-initializers on older versions of GCC than 5.1, all of them false positive.
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/bsd/krt-sock.c6
-rw-r--r--sysdep/bsd/krt-sys.h2
-rw-r--r--sysdep/bsd/sysio.h19
-rw-r--r--sysdep/linux/krt-sys.h2
-rw-r--r--sysdep/linux/netlink.c4
-rw-r--r--sysdep/unix/io.c12
-rw-r--r--sysdep/unix/krt.c4
-rw-r--r--sysdep/unix/main.c6
-rw-r--r--sysdep/unix/unix.h10
9 files changed, 35 insertions, 30 deletions
diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c
index f2ae81c3..9c9df51d 100644
--- a/sysdep/bsd/krt-sock.c
+++ b/sysdep/bsd/krt-sock.c
@@ -898,7 +898,7 @@ kif_do_scan(struct kif_proto *p)
/* Kernel sockets */
static int
-krt_sock_hook(sock *sk, int size UNUSED)
+krt_sock_hook(sock *sk, uint size UNUSED)
{
struct ks_msg msg;
int l = read(sk->fd, (char *)&msg, sizeof(msg));
@@ -918,7 +918,7 @@ krt_sock_err_hook(sock *sk, int e UNUSED)
}
static sock *
-krt_sock_open(pool *pool, void *data, int table_id)
+krt_sock_open(pool *pool, void *data, int table_id UNUSED)
{
sock *sk;
int fd;
@@ -1074,7 +1074,7 @@ kif_sys_shutdown(struct kif_proto *p)
struct ifa *
-kif_get_primary_ip(struct iface *i)
+kif_get_primary_ip(struct iface *i UNUSED6)
{
#ifndef IPV6
static int fd = -1;
diff --git a/sysdep/bsd/krt-sys.h b/sysdep/bsd/krt-sys.h
index a63f8caf..353ffcec 100644
--- a/sysdep/bsd/krt-sys.h
+++ b/sysdep/bsd/krt-sys.h
@@ -45,7 +45,7 @@ struct krt_state {
static inline void krt_sys_io_init(void) { }
static inline void krt_sys_init(struct krt_proto *p UNUSED) { }
-static inline int krt_sys_get_attr(eattr *a UNUSED, byte *buf UNUSED, int buflen UNUSED) { }
+static inline int krt_sys_get_attr(eattr *a UNUSED, byte *buf UNUSED, int buflen UNUSED) { return 0; }
#endif
diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h
index 6c20733f..8d87a3c3 100644
--- a/sysdep/bsd/sysio.h
+++ b/sysdep/bsd/sysio.h
@@ -28,7 +28,9 @@
#endif
+#ifndef SA_LEN
#define SA_LEN(x) (x).sa.sa_len
+#endif
/*
@@ -133,12 +135,12 @@ sk_process_cmsg4_ttl(sock *s, struct cmsghdr *cm)
s->rcv_ttl = * (byte *) CMSG_DATA(cm);
}
+#ifdef IP_SENDSRCADDR
static inline void
sk_prepare_cmsgs4(sock *s, struct msghdr *msg, void *cbuf, size_t cbuflen)
{
/* Unfortunately, IP_SENDSRCADDR does not work for raw IP sockets on BSD kernels */
-#ifdef IP_SENDSRCADDR
struct cmsghdr *cm;
struct in_addr *sa;
int controllen = 0;
@@ -156,10 +158,13 @@ sk_prepare_cmsgs4(sock *s, struct msghdr *msg, void *cbuf, size_t cbuflen)
*sa = ipa_to_in4(s->saddr);
msg->msg_controllen = controllen;
-#endif
}
+#else
+static inline void
+sk_prepare_cmsgs4(sock *s UNUSED, struct msghdr *msg UNUSED, void *cbuf UNUSED, size_t cbuflen UNUSED) { }
+#endif
-static void
+static void UNUSED
sk_prepare_ip_header(sock *s, void *hdr, int dlen)
{
struct ip *ip = hdr;
@@ -200,7 +205,7 @@ sk_prepare_ip_header(sock *s, void *hdr, int dlen)
#endif
int
-sk_set_md5_auth(sock *s, ip_addr local, ip_addr remote, struct iface *ifa, char *passwd, int setkey UNUSED)
+sk_set_md5_auth(sock *s, ip_addr local UNUSED, ip_addr remote UNUSED, struct iface *ifa UNUSED, char *passwd, int setkey UNUSED)
{
#ifdef USE_MD5SIG_SETKEY
if (setkey)
@@ -235,20 +240,20 @@ sk_set_min_ttl4(sock *s, int ttl)
}
static inline int
-sk_set_min_ttl6(sock *s, int ttl)
+sk_set_min_ttl6(sock *s, int ttl UNUSED)
{
ERR_MSG("Kernel does not support IPv6 TTL security");
}
static inline int
-sk_disable_mtu_disc4(sock *s)
+sk_disable_mtu_disc4(sock *s UNUSED)
{
/* TODO: Set IP_DONTFRAG to 0 ? */
return 0;
}
static inline int
-sk_disable_mtu_disc6(sock *s)
+sk_disable_mtu_disc6(sock *s UNUSED)
{
/* TODO: Set IPV6_DONTFRAG to 0 ? */
return 0;
diff --git a/sysdep/linux/krt-sys.h b/sysdep/linux/krt-sys.h
index 6d6586d1..76ae29b7 100644
--- a/sysdep/linux/krt-sys.h
+++ b/sysdep/linux/krt-sys.h
@@ -27,7 +27,7 @@ static inline void kif_sys_postconfig(struct kif_config *c UNUSED) { }
static inline void kif_sys_init_config(struct kif_config *c UNUSED) { }
static inline void kif_sys_copy_config(struct kif_config *d UNUSED, struct kif_config *s UNUSED) { }
-static inline struct ifa * kif_get_primary_ip(struct iface *i) { return NULL; }
+static inline struct ifa * kif_get_primary_ip(struct iface *i UNUSED) { return NULL; }
/* Kernel routes */
diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index 79dd1405..368e0ef9 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -487,7 +487,7 @@ nl_parse_multipath(struct krt_proto *p, struct rtattr *ra)
struct rtattr *a[BIRD_RTA_MAX];
struct rtnexthop *nh = RTA_DATA(ra);
struct mpnh *rv, *first, **last;
- int len = RTA_PAYLOAD(ra);
+ unsigned len = RTA_PAYLOAD(ra);
first = NULL;
last = &first;
@@ -1473,7 +1473,7 @@ nl_async_msg(struct nlmsghdr *h)
}
static int
-nl_async_hook(sock *sk, int size UNUSED)
+nl_async_hook(sock *sk, uint size UNUSED)
{
struct iovec iov = { nl_async_rx_buffer, NL_RX_SIZE };
struct sockaddr_nl sa;
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index 3ceadd98..873b5805 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -507,11 +507,11 @@ tm_format_datetime(char *x, struct timeformat *fmt_spec, bird_clock_t t)
* Sockaddr helper functions
*/
-static inline int sockaddr_length(int af)
+static inline int UNUSED sockaddr_length(int af)
{ return (af == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); }
static inline void
-sockaddr_fill4(struct sockaddr_in *sa, ip_addr a, struct iface *ifa, uint port)
+sockaddr_fill4(struct sockaddr_in *sa, ip_addr a, uint port)
{
memset(sa, 0, sizeof(struct sockaddr_in));
#ifdef HAVE_SIN_LEN
@@ -542,7 +542,7 @@ void
sockaddr_fill(sockaddr *sa, int af, ip_addr a, struct iface *ifa, uint port)
{
if (af == AF_INET)
- sockaddr_fill4((struct sockaddr_in *) sa, a, ifa, port);
+ sockaddr_fill4((struct sockaddr_in *) sa, a, port);
else if (af == AF_INET6)
sockaddr_fill6((struct sockaddr_in6 *) sa, a, ifa, port);
else
@@ -550,7 +550,7 @@ sockaddr_fill(sockaddr *sa, int af, ip_addr a, struct iface *ifa, uint port)
}
static inline void
-sockaddr_read4(struct sockaddr_in *sa, ip_addr *a, struct iface **ifa, uint *port)
+sockaddr_read4(struct sockaddr_in *sa, ip_addr *a, uint *port)
{
*port = ntohs(sa->sin_port);
*a = ipa_from_in4(sa->sin_addr);
@@ -573,7 +573,7 @@ sockaddr_read(sockaddr *sa, int af, ip_addr *a, struct iface **ifa, uint *port)
goto fail;
if (af == AF_INET)
- sockaddr_read4((struct sockaddr_in *) sa, a, ifa, port);
+ sockaddr_read4((struct sockaddr_in *) sa, a, port);
else if (af == AF_INET6)
sockaddr_read6((struct sockaddr_in6 *) sa, a, ifa, port);
else
@@ -770,7 +770,7 @@ sk_set_tos6(sock *s, int tos)
}
static inline int
-sk_set_high_port(sock *s)
+sk_set_high_port(sock *s UNUSED)
{
/* Port range setting is optional, ignore it if not supported */
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c
index ef98cb3a..07a55c0d 100644
--- a/sysdep/unix/krt.c
+++ b/sysdep/unix/krt.c
@@ -909,7 +909,7 @@ krt_scan_timer_start(struct krt_proto *p)
}
static void
-krt_scan_timer_stop(struct krt_proto *p)
+krt_scan_timer_stop(struct krt_proto *p UNUSED)
{
krt_scan_count--;
@@ -998,7 +998,7 @@ krt_store_tmp_attrs(rte *rt, struct ea_list *attrs)
}
static int
-krt_import_control(struct proto *P, rte **new, ea_list **attrs, struct linpool *pool)
+krt_import_control(struct proto *P, rte **new, ea_list **attrs UNUSED, struct linpool *pool UNUSED)
{
struct krt_proto *p = (struct krt_proto *) P;
rte *e = *new;
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index a7989920..35bc3fd1 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -73,7 +73,7 @@ async_dump(void)
#else
static inline void
-drop_uid(uid_t uid)
+drop_uid(uid_t uid UNUSED)
{
die("Cannot change user on this platform");
}
@@ -419,7 +419,7 @@ cli_get_command(cli *c)
}
static int
-cli_rx(sock *s, int size UNUSED)
+cli_rx(sock *s, uint size UNUSED)
{
cli_kick(s->data);
return 0;
@@ -439,7 +439,7 @@ cli_err(sock *s, int err)
}
static int
-cli_connect(sock *s, int size UNUSED)
+cli_connect(sock *s, uint size UNUSED)
{
cli *c;
diff --git a/sysdep/unix/unix.h b/sysdep/unix/unix.h
index 4e0ff841..3ef2e3ef 100644
--- a/sysdep/unix/unix.h
+++ b/sysdep/unix/unix.h
@@ -63,16 +63,16 @@ typedef struct sockaddr_bird {
#endif
-static inline ip_addr ipa_from_in4(struct in_addr a)
+static inline ip_addr ipa_from_in4(struct in_addr a UNUSED6)
{ return ipa_from_u32(ntohl(a.s_addr)); }
-static inline ip_addr ipa_from_in6(struct in6_addr a)
+static inline ip_addr ipa_from_in6(struct in6_addr a UNUSED4)
{ return ipa_build6(ntohl(a.s6_addr32[0]), ntohl(a.s6_addr32[1]), ntohl(a.s6_addr32[2]), ntohl(a.s6_addr32[3])); }
-static inline ip_addr ipa_from_sa4(sockaddr *sa)
+static inline ip_addr ipa_from_sa4(sockaddr *sa UNUSED6)
{ return ipa_from_in4(((struct sockaddr_in *) sa)->sin_addr); }
-static inline ip_addr ipa_from_sa6(sockaddr *sa)
+static inline ip_addr ipa_from_sa6(sockaddr *sa UNUSED4)
{ return ipa_from_in6(((struct sockaddr_in6 *) sa)->sin6_addr); }
static inline struct in_addr ipa_to_in4(ip_addr a)
@@ -83,7 +83,7 @@ static inline struct in6_addr ipa_to_in6(ip_addr a)
{ return (struct in6_addr) { .s6_addr32 = { htonl(_I0(a)), htonl(_I1(a)), htonl(_I2(a)), htonl(_I3(a)) } }; }
#else
/* Temporary dummy */
-static inline struct in6_addr ipa_to_in6(ip_addr a)
+static inline struct in6_addr ipa_to_in6(ip_addr a UNUSED)
{ return (struct in6_addr) { .s6_addr32 = { 0, 0, 0, 0 } }; }
#endif