[COMMIT osv master] bsd: fix build error on gcc 14.1.1

1 view
Skip to first unread message

Commit Bot

unread,
Jun 28, 2024, 10:53:48 AMJun 28
to osv...@googlegroups.com, Nadav Har'El
From: Nadav Har'El <n...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

bsd: fix build error on gcc 14.1.1

bsd/sys/sys/buf_ring.h has a lot of inline functions, some of which assume
the caller has defined functions critical_exit, critical_enter(), or
has included <machine/atomic.h>. Before gcc 14.1.1, this didn't cause
problems - the undefined functions were implicitly assumed to exist and
return int, but if the source file never used these functions, it didn't
matter. Starting with gcc 14.1.1, this no longer builds.

The best solution would have been to fix bsd/sys/sys/buf_ring.h to include
what it needs, but this is messy (partly because we use the same header
for both C and C++) so the easier solution, used in this patch, to
define the unused stuff in the one source file that includes buf_ring.h
but didn't define these functions.

Signed-off-by: Nadav Har'El <n...@scylladb.com>

---
diff --git a/bsd/sys/kern/subr_bufring.c b/bsd/sys/kern/subr_bufring.c
--- a/bsd/sys/kern/subr_bufring.c
+++ b/bsd/sys/kern/subr_bufring.c
@@ -32,6 +32,12 @@
#include <sys/kernel.h>
#include <sys/malloc.h>
//#include <sys/ktr.h>
+
+// needed for buf_ring.h, but not used in this file :-(
+#include <machine/atomic.h>
+static inline void critical_enter() { abort(); }
+static inline void critical_exit() { abort(); }
+
#include <sys/buf_ring.h>

struct buf_ring *
Reply all
Reply to author
Forward
0 new messages