From: Nadav Har'El <[email protected]>
Committer: Nadav Har'El <[email protected]>
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 <[email protected]>

---
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 *

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/000000000000fbf85b061bf469c4%40google.com.

Reply via email to