Fix warnings reported by -Wpedantic
Previously CI hasn't been running with -Wpedantic (using autoconf), so
these haven't been reported previously.
- replace BUILD_ASSERT with static_assert()
- don't use %m GNU extension for printf
- don't use arithmetic on void*
- remove unused variables
Change-Id: I97d1acc908f06773b8b1ee95bfee80760fdc7a63
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
diff --git a/utils/mctp-capture.c b/utils/mctp-capture.c
index b38e92d..ea83146 100644
--- a/utils/mctp-capture.c
+++ b/utils/mctp-capture.c
@@ -30,8 +30,6 @@
int capture_prepare(struct capture *cap)
{
- int rc;
-
if (!(cap->pcap = pcap_open_dead(CAPTURE_LINKTYPE_LINUX_SLL2,
UINT16_MAX))) {
fprintf(stderr, "pcap_open_dead: failed\n");
@@ -135,7 +133,7 @@
/* Ignore the eid at start of buf */
memcpy(pktbuf + sizeof(struct sll2_header) + sizeof(struct mctp_hdr),
- buf + 1, len - 1);
+ (const uint8_t *)buf + 1, len - 1);
hdr.caplen = size;
hdr.len = size;
diff --git a/utils/mctp-capture.h b/utils/mctp-capture.h
index e432df9..261caba 100644
--- a/utils/mctp-capture.h
+++ b/utils/mctp-capture.h
@@ -3,7 +3,9 @@
#ifndef _UTILS_MCTP_CAPTURE_H
#define _UTILS_MCTP_CAPTURE_H
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
#include "compiler.h"
#include "libmctp.h"
diff --git a/utils/mctp-demux-daemon.c b/utils/mctp-demux-daemon.c
index fae4f35..7357d43 100644
--- a/utils/mctp-demux-daemon.c
+++ b/utils/mctp-demux-daemon.c
@@ -2,7 +2,9 @@
#define _GNU_SOURCE
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
#define SD_LISTEN_FDS_START 3
@@ -64,7 +66,7 @@
struct binding *binding;
bool verbose;
int local_eid;
- void *buf;
+ uint8_t *buf;
size_t buf_size;
int sock;