Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160425649
D55307.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D55307.diff
View Options
diff --git a/include/stddef.h b/include/stddef.h
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -33,6 +33,7 @@
#define _STDDEF_H_
#include <sys/_null.h>
+#include <sys/_offsetof.h>
#include <sys/_types.h>
#include <sys/_visible.h>
@@ -68,10 +69,6 @@
#endif
#endif
-#ifndef offsetof
-#define offsetof(type, field) __builtin_offsetof(type, field)
-#endif
-
#if __EXT1_VISIBLE
/* ISO/IEC 9899:2011 K.3.3.2 */
#ifndef _RSIZE_T_DEFINED
diff --git a/sys/sys/_offsetof.h b/sys/sys/_offsetof.h
new file mode 100644
--- /dev/null
+++ b/sys/sys/_offsetof.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2026 Capabilities Limited
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * This software was developed by SRI International, the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology), and Capabilities Limited under Defense Advanced Research
+ * Projects Agency / Air Force Research Laboratory (DARPA/AFRL) Contract
+ * No. FA8750-24-C-B047 ("DEC").
+ */
+#ifndef _SYS__OFFSETOF_H_
+#define _SYS__OFFSETOF_H_
+
+#ifndef offsetof
+#define offsetof(type, field) __builtin_offsetof(type, field)
+#endif
+
+#endif /* _SYS__OFFSETOF_H_ */
diff --git a/sys/sys/stddef.h b/sys/sys/stddef.h
--- a/sys/sys/stddef.h
+++ b/sys/sys/stddef.h
@@ -31,6 +31,7 @@
#include <sys/cdefs.h>
#include <sys/_null.h>
+#include <sys/_offsetof.h>
#include <sys/_types.h>
#include <sys/_visible.h>
@@ -46,6 +47,4 @@
#define _PTRDIFF_T_DECLARED
#endif
-#define offsetof(type, field) __offsetof(type, field)
-
#endif /* !_SYS_STDDEF_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jun 25, 8:03 AM (20 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34314778
Default Alt Text
D55307.diff (1 KB)
Attached To
Mode
D55307: stddef.h: centralize definition of offsetof()
Attached
Detach File
Event Timeline
Log In to Comment