Module Name:    src
Committed By:   matt
Date:           Tue Jul  5 05:19:02 UTC 2011

Modified Files:
        src/usr.bin/genassym: genassym.sh

Log Message:
Use __builtin_offsetof if __GNUC__ >= 4


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/genassym/genassym.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/genassym/genassym.sh
diff -u src/usr.bin/genassym/genassym.sh:1.6 src/usr.bin/genassym/genassym.sh:1.7
--- src/usr.bin/genassym/genassym.sh:1.6	Sat Nov 28 20:30:01 2009
+++ src/usr.bin/genassym/genassym.sh	Tue Jul  5 05:19:02 2011
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: genassym.sh,v 1.6 2009/11/28 20:30:01 dsl Exp $
+#	$NetBSD: genassym.sh,v 1.7 2011/07/05 05:19:02 matt Exp $
 #
 # Copyright (c) 1997 Matthias Pfaller.
 # All rights reserved.
@@ -79,7 +79,11 @@
 
 $AWK '
 BEGIN {
+	printf("#if __GNUC__ >= 4\n");
+	printf("#define	offsetof(type, member) __builtin_offsetof(type, member)\n");
+	printf("#else\n");
 	printf("#define	offsetof(type, member) ((size_t)(&((type *)0)->member))\n");
+	printf("#endif\n");
 	defining = 0;
 	type = "long";
 	asmtype = "n";

Reply via email to