Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libkern If GCC 4.0 or later, use __builtin_offsetof ...
details: https://anonhg.NetBSD.org/src/rev/fa18a73ad624
branches: trunk
changeset: 766956:fa18a73ad624
user: matt <matt%NetBSD.org@localhost>
date: Tue Jul 05 01:56:45 2011 +0000
description:
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
diffstat:
sys/lib/libkern/libkern.h | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diffs (23 lines):
diff -r 53e087501d9e -r fa18a73ad624 sys/lib/libkern/libkern.h
--- a/sys/lib/libkern/libkern.h Mon Jul 04 23:37:30 2011 +0000
+++ b/sys/lib/libkern/libkern.h Tue Jul 05 01:56:45 2011 +0000
@@ -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 {
Home |
Main Index |
Thread Index |
Old Index