Module Name: src
Committed By: matt
Date: Tue Jul 5 01:56:45 UTC 2011
Modified Files:
src/sys/lib/libkern: libkern.h
Log Message:
If GCC 4.0 or later, use __builtin_offsetof for offsetof.
This make GCC 4.5 with offsetof in mbuf.h and kern_cpu.c
To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/lib/libkern/libkern.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.97 src/sys/lib/libkern/libkern.h:1.98
--- src/sys/lib/libkern/libkern.h:1.97 Sat Feb 19 02:02:14 2011
+++ src/sys/lib/libkern/libkern.h Tue Jul 5 01:56:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: libkern.h,v 1.97 2011/02/19 02:02:14 matt Exp $ */
+/* $NetBSD: libkern.h,v 1.98 2011/07/05 01:56:45 matt Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -245,9 +245,13 @@
#define SMALL_RANDOM
#ifndef offsetof
+#if __GNUC_PREREQ__(4, 0)
+#define offsetof(type, member) __builtin_offsetof(type, member)
+#else
#define offsetof(type, member) \
((size_t)(unsigned long)(&(((type *)0)->member)))
#endif
+#endif
#define MTPRNG_RLEN 624
struct mtprng_state {