Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/pcc/dist/pcc/mip use offsetof() rather than rol...



details:   https://anonhg.NetBSD.org/src/rev/45c8eafd50a5
branches:  trunk
changeset: 768172:45c8eafd50a5
user:      plunky <plunky%NetBSD.org@localhost>
date:      Wed Aug 10 08:09:38 2011 +0000

description:
use offsetof() rather than rolling our own, to appease gcc 4.5

diffstat:

 external/bsd/pcc/dist/pcc/mip/common.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r d26bcdb618fd -r 45c8eafd50a5 external/bsd/pcc/dist/pcc/mip/common.c
--- a/external/bsd/pcc/dist/pcc/mip/common.c    Wed Aug 10 08:08:39 2011 +0000
+++ b/external/bsd/pcc/dist/pcc/mip/common.c    Wed Aug 10 08:09:38 2011 +0000
@@ -1,5 +1,5 @@
 /*     Id: common.c,v 1.92 2010/03/27 23:46:12 mickey Exp      */      
-/*     $NetBSD: common.c,v 1.1.1.3 2010/06/03 18:57:53 plunky Exp $    */
+/*     $NetBSD: common.c,v 1.2 2011/08/10 08:09:38 plunky Exp $        */
 /*
  * Copyright (c) 2003 Anders Magnusson (ragge%ludd.luth.se@localhost).
  * All rights reserved.
@@ -60,6 +60,7 @@
  */
 
 #include <stdarg.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -470,7 +471,7 @@
        } a2;
 };
 
-#define ALIGNMENT ((long)&((struct balloc *)0)->a2)
+#define ALIGNMENT offsetof(struct balloc, a2)
 #define        ROUNDUP(x) (((x) + ((ALIGNMENT)-1)) & ~((ALIGNMENT)-1))
 
 static char *allocpole;



Home | Main Index | Thread Index | Old Index