Rename ALIGN to SHELL_ALIGN and simplify macro so that it does not have side
effects, and add double to it, so that it aligns doubles correctly too. This is just a workaround to fix the sparc64 problem where ALIGN() is now defined in some include file to be 16 instead of 8. Thanks to martin for debugging this.
This commit is contained in:
parent
dfbaa22bd7
commit
b9d3050e20
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: machdep.h,v 1.8 1995/05/11 21:29:21 christos Exp $ */
|
||||
/* $NetBSD: machdep.h,v 1.9 2002/10/04 13:15:51 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -43,11 +43,5 @@
|
||||
* in some way. The following macro will get this right on many machines.
|
||||
*/
|
||||
|
||||
#ifndef ALIGN
|
||||
union align {
|
||||
int i;
|
||||
char *cp;
|
||||
};
|
||||
|
||||
#define ALIGN(nbytes) (((nbytes) + sizeof(union align) - 1) & ~(sizeof(union align) - 1))
|
||||
#endif
|
||||
#define SHELL_SIZE (sizeof(union {int i; char *cp; double d; }) - 1)
|
||||
#define SHELL_ALIGN(nbytes) (((nbytes) + SHELL_SIZE) & ~SHELL_SIZE)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: memalloc.c,v 1.23 2000/11/01 19:56:01 christos Exp $ */
|
||||
/* $NetBSD: memalloc.c,v 1.24 2002/10/04 13:15:51 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)memalloc.c 8.3 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: memalloc.c,v 1.23 2000/11/01 19:56:01 christos Exp $");
|
||||
__RCSID("$NetBSD: memalloc.c,v 1.24 2002/10/04 13:15:51 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -139,7 +139,7 @@ stalloc(nbytes)
|
||||
{
|
||||
char *p;
|
||||
|
||||
nbytes = ALIGN(nbytes);
|
||||
nbytes = SHELL_ALIGN(nbytes);
|
||||
if (nbytes > stacknleft) {
|
||||
int blocksize;
|
||||
struct stack_block *sp;
|
||||
@ -220,7 +220,7 @@ popstackmark(mark)
|
||||
void
|
||||
growstackblock() {
|
||||
char *p;
|
||||
int newlen = ALIGN(stacknleft * 2 + 100);
|
||||
int newlen = SHELL_ALIGN(stacknleft * 2 + 100);
|
||||
char *oldspace = stacknxt;
|
||||
int oldlen = stacknleft;
|
||||
struct stack_block *sp;
|
||||
@ -264,7 +264,7 @@ void
|
||||
grabstackblock(len)
|
||||
int len;
|
||||
{
|
||||
len = ALIGN(len);
|
||||
len = SHELL_ALIGN(len);
|
||||
stacknxt += len;
|
||||
stacknleft -= len;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mknodes.c,v 1.19 2002/05/25 23:09:06 wiz Exp $ */
|
||||
/* $NetBSD: mknodes.c,v 1.20 2002/10/04 13:15:51 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -47,7 +47,7 @@ static const char copyright[] =
|
||||
static char sccsid[] = "@(#)mknodes.c 8.2 (Berkeley) 5/4/95";
|
||||
#else
|
||||
static const char rcsid[] =
|
||||
"$NetBSD: mknodes.c,v 1.19 2002/05/25 23:09:06 wiz Exp $";
|
||||
"$NetBSD: mknodes.c,v 1.20 2002/10/04 13:15:51 christos Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -292,7 +292,8 @@ outsizes(cfile)
|
||||
|
||||
fprintf(cfile, "static const short nodesize[%d] = {\n", ntypes);
|
||||
for (i = 0 ; i < ntypes ; i++) {
|
||||
fprintf(cfile, " ALIGN(sizeof (struct %s)),\n", nodestr[i]->tag);
|
||||
fprintf(cfile, " SHELL_ALIGN(sizeof (struct %s)),\n",
|
||||
nodestr[i]->tag);
|
||||
}
|
||||
fprintf(cfile, "};\n");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nodes.c.pat,v 1.8 1997/04/11 23:03:09 christos Exp $ */
|
||||
/* $NetBSD: nodes.c.pat,v 1.9 2002/10/04 13:15:51 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -100,7 +100,7 @@ sizenodelist(lp)
|
||||
struct nodelist *lp;
|
||||
{
|
||||
while (lp) {
|
||||
funcblocksize += ALIGN(sizeof(struct nodelist));
|
||||
funcblocksize += SHELL_ALIGN(sizeof(struct nodelist));
|
||||
calcsize(lp->n);
|
||||
lp = lp->next;
|
||||
}
|
||||
@ -129,7 +129,8 @@ copynodelist(lp)
|
||||
lpp = &start;
|
||||
while (lp) {
|
||||
*lpp = funcblock;
|
||||
funcblock = (char *) funcblock + ALIGN(sizeof(struct nodelist));
|
||||
funcblock = (char *) funcblock +
|
||||
SHELL_ALIGN(sizeof(struct nodelist));
|
||||
(*lpp)->n = copynode(lp->n);
|
||||
lp = lp->next;
|
||||
lpp = &(*lpp)->next;
|
||||
|
Loading…
Reference in New Issue
Block a user