git: dcbd1fccdc66 - main - types.h: use central definition of offsetof()

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Thu, 19 Feb 2026 16:25:38 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=dcbd1fccdc66ec33f0652be34a1c8bdd5293f90c

commit dcbd1fccdc66ec33f0652be34a1c8bdd5293f90c
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-02-19 16:13:57 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-02-19 16:25:26 +0000

    types.h: use central definition of offsetof()
    
    Previously this broke if included after (sys/)stddef.h.
    
    Reported by:    des
    Fixes:          2adc3f0db187 ("stddef.h: centralize definition of offsetof()")
---
 sys/sys/types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/sys/types.h b/sys/sys/types.h
index 8311c1901b7e..2d1035bda1e5 100644
--- a/sys/sys/types.h
+++ b/sys/sys/types.h
@@ -42,6 +42,7 @@
 /* Machine type dependent parameters. */
 #include <machine/endian.h>
 #include <sys/_types.h>
+#include <sys/_offsetof.h>
 
 #include <sys/_pthreadtypes.h>
 
@@ -291,7 +292,6 @@ typedef	__uint64_t	uoff_t;
 typedef	char		vm_memattr_t;	/* memory attribute codes */
 typedef	struct vm_page	*vm_page_t;
 
-#define offsetof(type, field) __offsetof(type, field)
 #endif /* _KERNEL */
 
 #if	defined(_KERNEL) || defined(_STANDALONE)