Module Name:    src
Committed By:   plunky
Date:           Thu Jun  3 19:07:59 UTC 2010

Modified Files:
        src/external/bsd/pcc/dist/pcc/cc: Makefile.in
        src/external/bsd/pcc/dist/pcc/cc/cc: cc.1
        src/external/bsd/pcc/dist/pcc/cc/ccom: ccom.1 pftn.c
        src/external/bsd/pcc/dist/pcc/cc/cpp: cpp.1
        src/external/bsd/pcc/dist/pcc/f77: Makefile.in

Log Message:
merge changes from pcc-090902 branch


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pcc/dist/pcc/cc/Makefile.in
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pcc/dist/pcc/cc/cc/cc.1
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pcc/dist/pcc/cc/ccom/ccom.1
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/pcc/dist/pcc/cc/ccom/pftn.c
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pcc/dist/pcc/cc/cpp/cpp.1
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pcc/dist/pcc/f77/Makefile.in

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

Modified files:

Index: src/external/bsd/pcc/dist/pcc/cc/Makefile.in
diff -u src/external/bsd/pcc/dist/pcc/cc/Makefile.in:1.2 src/external/bsd/pcc/dist/pcc/cc/Makefile.in:1.3
--- src/external/bsd/pcc/dist/pcc/cc/Makefile.in:1.2	Fri Jan 22 11:08:40 2010
+++ src/external/bsd/pcc/dist/pcc/cc/Makefile.in	Thu Jun  3 19:07:59 2010
@@ -1,4 +1,5 @@
-#	$Id: Makefile.in,v 1.2 2010/01/22 11:08:40 plunky Exp $
+#	Id: Makefile.in,v 1.3 2008/01/06 17:18:55 ragge Exp 	
+#	$NetBSD: Makefile.in,v 1.3 2010/06/03 19:07:59 plunky Exp $
 #
 # Makefile.in for top-level of pcc.
 #

Index: src/external/bsd/pcc/dist/pcc/cc/cc/cc.1
diff -u src/external/bsd/pcc/dist/pcc/cc/cc/cc.1:1.2 src/external/bsd/pcc/dist/pcc/cc/cc/cc.1:1.3
--- src/external/bsd/pcc/dist/pcc/cc/cc/cc.1:1.2	Fri Jan  8 16:31:51 2010
+++ src/external/bsd/pcc/dist/pcc/cc/cc/cc.1	Thu Jun  3 19:07:59 2010
@@ -1,5 +1,5 @@
-.\"	$Id: cc.1,v 1.2 2010/01/08 16:31:51 joerg Exp $
-.\"	$NetBSD: cc.1,v 1.2 2010/01/08 16:31:51 joerg Exp $
+.\"	Id: cc.1,v 1.16 2010/04/05 14:24:06 reed Exp 	
+.\"	$NetBSD: cc.1,v 1.3 2010/06/03 19:07:59 plunky Exp $
 .\"	$OpenBSD$
 .\"
 .\" Copyright (c) 2007 Jeremy C. Reed <[email protected]>
@@ -191,11 +191,11 @@
 Target-dependent option.
 .Bl -tag -width PowerPC
 .It ARM
--mlittle-endian -mbig-endian -mfpe=fpa -mfpe=vpf -msoft-float -march=armv1 -march=armv2 -march=armv2a -march=armv3 -march=armv4 -march=armv4t -march=armv4tej -march=armv5 -march=armv6 -march=armv6t2 -march=armv6kz -march=armv6k -march=armv7
+\-mlittle-endian \-mbig-endian \-mfpe=fpa \-mfpe=vpf \-msoft-float \-march=armv1 \-march=armv2 \-march=armv2a \-march=armv3 \-march=armv4 \-march=armv4t \-march=armv4tej \-march=armv5 \-march=armv6 \-march=armv6t2 \-march=armv6kz \-march=armv6k \-march=armv7
 .It HPPA
 .It i386
 .It MIPS
--mlittle-endian -mbig-endian -mhard-float -msoft-float
+\-mlittle-endian \-mbig-endian \-mhard-float \-msoft-float
 .It PDP-10
 .It PowerPC
 .It Sparc64
@@ -234,7 +234,7 @@
 preprocessor directive for
 .Xr cpp 1 .
 Uses
-.Sy -lpthread
+.Sy \-lpthread
 for the
 .Xr ld 1
 linker.
@@ -307,7 +307,7 @@
 .It __PCC_MINOR__
 Set to the minor version.
 .It __PCC_MINORMINOR__
-Set to the minor-minor version -- the number after the minor version.
+Set to the minor-minor version \(em the number after the minor version.
 .It _PTHREADS
 Defined when
 .Fl pthread

Index: src/external/bsd/pcc/dist/pcc/cc/ccom/ccom.1
diff -u src/external/bsd/pcc/dist/pcc/cc/ccom/ccom.1:1.2 src/external/bsd/pcc/dist/pcc/cc/ccom/ccom.1:1.3
--- src/external/bsd/pcc/dist/pcc/cc/ccom/ccom.1:1.2	Fri Jan  8 16:32:23 2010
+++ src/external/bsd/pcc/dist/pcc/cc/ccom/ccom.1	Thu Jun  3 19:07:59 2010
@@ -1,5 +1,5 @@
-.\"	$NetBSD: ccom.1,v 1.2 2010/01/08 16:32:23 joerg Exp $
-.\"	$Id: ccom.1,v 1.2 2010/01/08 16:32:23 joerg Exp $
+.\"	Id: ccom.1,v 1.9 2010/04/05 13:13:57 reed Exp 	
+.\"	$NetBSD: ccom.1,v 1.3 2010/06/03 19:07:59 plunky Exp $
 .\"
 .\" Copyright (c) 2007 Jeremy C. Reed <[email protected]>
 .\" Permission to use, copy, modify, and/or distribute this software for any

Index: src/external/bsd/pcc/dist/pcc/cc/ccom/pftn.c
diff -u src/external/bsd/pcc/dist/pcc/cc/ccom/pftn.c:1.4 src/external/bsd/pcc/dist/pcc/cc/ccom/pftn.c:1.5
--- src/external/bsd/pcc/dist/pcc/cc/ccom/pftn.c:1.4	Fri Sep  4 00:50:05 2009
+++ src/external/bsd/pcc/dist/pcc/cc/ccom/pftn.c	Thu Jun  3 19:07:59 2010
@@ -1,4 +1,5 @@
-/*	$Id: pftn.c,v 1.4 2009/09/04 00:50:05 gmcgarry Exp $	*/
+/*	Id: pftn.c,v 1.280 2010/05/23 19:52:04 ragge Exp 	*/	
+/*	$NetBSD: pftn.c,v 1.5 2010/06/03 19:07:59 plunky Exp $	*/
 /*
  * Copyright (c) 2003 Anders Magnusson ([email protected]).
  * All rights reserved.
@@ -65,8 +66,6 @@
 
 # include "pass1.h"
 
-#include <string.h> /* XXX - for strcmp */
-
 #include "cgram.h"
 
 struct symtab *cftnsp;
@@ -117,7 +116,7 @@
 NODE *arrstk[10];
 int arrstkp;
 static int intcompare;
-static NODE *parlink;
+NODE *parlink;
 
 void fixtype(NODE *p, int class);
 int fixclass(int class, TWORD type);
@@ -405,6 +404,9 @@
 		if ((ga = gcc_get_attr(sue, GCC_ATYP_ALIGNED))) {
 			sue->suealign = ga->a1.iarg;
 			SETOFF(sue->suesize, sue->suealign);
+		} else if ((ga = gcc_get_attr(sue, GCC_ATYP_MODE))) {
+			if (ga->a1.iarg)
+				p->stype = ga->a1.iarg;
 		}
 		ap->n_right = bcon(0);
 	}
@@ -432,15 +434,16 @@
 			oalloc(p, &autooff);
 		break;
 	case PARAM:
-		if (ISARY(p->stype)) {
-			/* remove array type on parameters before oalloc */
-			p->stype += (PTR-ARY);
-			p->sdf++;
-		}
-		if (arrstkp)
+		if (arrstkp) {
 			dynalloc(p, &argoff);
-		else
+		} else {
+			if (ISARY(p->stype)) {
+			/* remove array type on parameters before oalloc */
+				p->stype += (PTR-ARY);
+				p->sdf++;
+			}
 			oalloc(p, &argoff);
+		}
 		break;
 		
 	case STATIC:
@@ -1135,7 +1138,7 @@
 	if (ty == VOID)
 		sz = SZCHAR;
 #endif
-	if (ty != STRTY && ty != UNIONTY) {
+	if (!ISSOU(BTYPE(ty))) {
 		if (sz == 0) {
 			uerror("unknown size");
 			return(SZINT);
@@ -2061,269 +2064,6 @@
 	return r;
 }
 
-#ifndef NO_C_BUILTINS
-/*
- * replace an alloca function with direct allocation on stack.
- * return a destination temp node.
- */
-static NODE *
-builtin_alloca(NODE *f, NODE *a)
-{
-	struct symtab *sp;
-	NODE *t, *u;
-
-#ifdef notyet
-	if (xnobuiltins)
-		return NULL;
-#endif
-	sp = f->n_sp;
-
-	if (a == NULL || a->n_op == CM) {
-		uerror("wrong arg count for alloca");
-		return bcon(0);
-	}
-	t = tempnode(0, VOID|PTR, 0, MKSUE(INT) /* XXX */);
-	u = tempnode(regno(t), VOID|PTR, 0, MKSUE(INT) /* XXX */);
-	spalloc(t, a, SZCHAR);
-	tfree(f);
-	return u;
-}
-
-/*
- * See if there is a goto in the tree.
- * XXX this function is a hack for a flaw in handling of 
- * compound expressions and inline functions and should not be 
- * needed.
- */
-static int
-hasgoto(NODE *p)
-{
-	int o = coptype(p->n_op);
-
-	if (o == LTYPE)
-		return 0;
-	if (p->n_op == GOTO)
-		return 1;
-	if (o == UTYPE)
-		return hasgoto(p->n_left);
-	if (hasgoto(p->n_left))
-		return 1;
-	return hasgoto(p->n_right);
-}
-
-/*
- * Determine if a value is known to be constant at compile-time and
- * hence that PCC can perform constant-folding on expressions involving
- * that value.
- */
-static NODE *
-builtin_constant_p(NODE *f, NODE *a)
-{
-	int isconst = (a != NULL && a->n_op == ICON);
-
-	tfree(f);
-	if (a && hasgoto(a)) {
-		a = buildtree(COMOP, a, bcon(0));
-	} else {
-		tfree(a);
-		a = bcon(isconst);
-	}
-
-	return a;
-}
-
-/*
- * Hint to the compiler whether this expression will evaluate true or false.
- * Just ignored for now.
- */
-static NODE *
-builtin_expect(NODE *f, NODE *a)
-{
-
-	tfree(f);
-	if (a && a->n_op == CM) {
-		tfree(a->n_right);
-		f = a->n_left;
-		nfree(a);
-		a = f;
-	}
-
-	return a;
-}
-
-/*
- * Take integer absolute value.
- * Simply does: ((((x)>>(8*sizeof(x)-1))^(x))-((x)>>(8*sizeof(x)-1)))
- */
-static NODE *
-builtin_abs(NODE *f, NODE *a)
-{
-	NODE *p, *q, *r, *t, *t2, *t3;
-	int tmp1, tmp2, shift;
-
-	if (a == NULL)
-		goto bad;
-
-	if (a->n_type == FLOAT || a->n_type == DOUBLE || a->n_type == LDOUBLE)
-		goto bad;
-
-	tfree(f);
-
-	if (a->n_op == ICON) {
-		if (a->n_lval < 0)
-			a->n_lval = -a->n_lval;
-		p = a;
-	} else {
-		t = tempnode(0, a->n_type, a->n_df, a->n_sue);
-		tmp1 = regno(t);
-		p = buildtree(ASSIGN, t, a);
-
-		t = tempnode(tmp1, a->n_type, a->n_df, a->n_sue);
-		shift = (int)tsize(a->n_type, a->n_df, a->n_sue) - 1;
-		q = buildtree(RS, t, bcon(shift));
-
-		t2 = tempnode(0, a->n_type, a->n_df, a->n_sue);
-		tmp2 = regno(t2);
-		q = buildtree(ASSIGN, t2, q);
-
-		t = tempnode(tmp1, a->n_type, a->n_df, a->n_sue);
-		t2 = tempnode(tmp2, a->n_type, a->n_df, a->n_sue);
-		t3 = tempnode(tmp2, a->n_type, a->n_df, a->n_sue);
-		r = buildtree(MINUS, buildtree(ER, t, t2), t3);
-
-		p = buildtree(COMOP, p, buildtree(COMOP, q, r));
-	}
-
-	return p;
-
-bad:
-	uerror("bad argument to __builtin_abs");
-	return bcon(0);
-}
-
-#ifndef TARGET_STDARGS
-static NODE *
-builtin_stdarg_start(NODE *f, NODE *a)
-{
-	NODE *p, *q;
-	int sz;
-
-	/* check num args and type */
-	if (a == NULL || a->n_op != CM || a->n_left->n_op == CM ||
-	    !ISPTR(a->n_left->n_type))
-		goto bad;
-
-	/* must first deal with argument size; use int size */
-	p = a->n_right;
-	if (p->n_type < INT) {
-		sz = (int)(SZINT/tsize(p->n_type, p->n_df, p->n_sue));
-	} else
-		sz = 1;
-
-	/* do the real job */
-	p = buildtree(ADDROF, p, NIL); /* address of last arg */
-#ifdef BACKAUTO
-	p = optim(buildtree(PLUS, p, bcon(sz))); /* add one to it (next arg) */
-#else
-	p = optim(buildtree(MINUS, p, bcon(sz))); /* add one to it (next arg) */
-#endif
-	q = block(NAME, NIL, NIL, PTR+VOID, 0, 0); /* create cast node */
-	q = buildtree(CAST, q, p); /* cast to void * (for assignment) */
-	p = q->n_right;
-	nfree(q->n_left);
-	nfree(q);
-	p = buildtree(ASSIGN, a->n_left, p); /* assign to ap */
-	tfree(f);
-	nfree(a);
-	return p;
-bad:
-	uerror("bad argument to __builtin_stdarg_start");
-	return bcon(0);
-}
-
-static NODE *
-builtin_va_arg(NODE *f, NODE *a)
-{
-	NODE *p, *q, *r, *rv;
-	int sz, nodnum;
-
-	/* check num args and type */
-	if (a == NULL || a->n_op != CM || a->n_left->n_op == CM ||
-	    !ISPTR(a->n_left->n_type) || a->n_right->n_op != TYPE)
-		goto bad;
-
-	/* create a copy to a temp node of current ap */
-	p = ccopy(a->n_left);
-	q = tempnode(0, p->n_type, p->n_df, p->n_sue);
-	nodnum = regno(q);
-	rv = buildtree(ASSIGN, q, p);
-
-	r = a->n_right;
-	sz = (int)tsize(r->n_type, r->n_df, r->n_sue)/SZCHAR;
-	/* add one to ap */
-#ifdef BACKAUTO
-	rv = buildtree(COMOP, rv , buildtree(PLUSEQ, a->n_left, bcon(sz)));
-#else
-#error fix wrong eval order in builtin_va_arg
-	ecomp(buildtree(MINUSEQ, a->n_left, bcon(sz)));
-#endif
-
-	nfree(a->n_right);
-	nfree(a);
-	nfree(f);
-	r = tempnode(nodnum, INCREF(r->n_type), r->n_df, r->n_sue);
-	return buildtree(COMOP, rv, buildtree(UMUL, r, NIL));
-bad:
-	uerror("bad argument to __builtin_va_arg");
-	return bcon(0);
-
-}
-
-static NODE *
-builtin_va_end(NODE *f, NODE *a)
-{
-	tfree(f);
-	tfree(a);
-	return bcon(0); /* nothing */
-}
-
-static NODE *
-builtin_va_copy(NODE *f, NODE *a)
-{
-	if (a == NULL || a->n_op != CM || a->n_left->n_op == CM)
-		goto bad;
-	tfree(f);
-	f = buildtree(ASSIGN, a->n_left, a->n_right);
-	nfree(a);
-	return f;
-
-bad:
-	uerror("bad argument to __builtin_va_copy");
-	return bcon(0);
-}
-#endif /* TARGET_STDARGS */
-
-static struct bitable {
-	char *name;
-	NODE *(*fun)(NODE *f, NODE *a);
-} bitable[] = {
-	{ "__builtin_alloca", builtin_alloca },
-	{ "__builtin_constant_p", builtin_constant_p },
-	{ "__builtin_abs", builtin_abs },
-	{ "__builtin_expect", builtin_expect },
-#ifndef TARGET_STDARGS
-	{ "__builtin_stdarg_start", builtin_stdarg_start },
-	{ "__builtin_va_start", builtin_stdarg_start },
-	{ "__builtin_va_arg", builtin_va_arg },
-	{ "__builtin_va_end", builtin_va_end },
-	{ "__builtin_va_copy", builtin_va_copy },
-#endif
-#ifdef TARGET_BUILTINS
-	TARGET_BUILTINS
-#endif
-};
-#endif
-
 #ifdef PCC_DEBUG
 /*
  * Print a prototype.
@@ -2331,24 +2071,29 @@
 static void
 alprint(union arglist *al, int in)
 {
+	TWORD t;
 	int i = 0, j;
 
 	for (; al->type != TNULL; al++) {
 		for (j = in; j > 0; j--)
 			printf("  ");
 		printf("arg %d: ", i++);
-		tprint(stdout, al->type, 0);
-		if (ISARY(al->type)) {
-			al++;
-			printf(" dim %d\n", al->df->ddim);
-		} else if (BTYPE(al->type) == STRTY ||
-		    BTYPE(al->type) == UNIONTY) {
+		t = al->type;
+		tprint(stdout, t, 0);
+		while (t > BTMASK) {
+			if (ISARY(t)) {
+				al++;
+				printf(" dim %d ", al->df->ddim);
+			} else if (ISFTN(t)) {
+				al++;
+				alprint(al->df->dfun, in+1);
+			}
+			t = DECREF(t);
+		}
+		if (ISSTR(t)) {
 			al++;
 			printf(" (size %d align %d)", al->sue->suesize,
 			    al->sue->suealign);
-		} else if (ISFTN(DECREF(al->type))) {
-			al++;
-			alprint(al->df->dfun, in+1);
 		}
 		printf("\n");
 	}
@@ -2356,6 +2101,16 @@
 		printf("end arglist\n");
 }
 #endif
+static int
+suemeq(struct suedef *s1, struct suedef *s2)
+{
+
+	GETSUE(s1, s1);
+	GETSUE(s2, s2);
+
+	return (s1->suem == s2->suem);
+}
+
 /*
  * Do prototype checking and add conversions before calling a function.
  * Argument f is function and a is a CM-separated list of arguments.
@@ -2395,14 +2150,9 @@
 #ifndef NO_C_BUILTINS
 	/* check for builtins. function pointers are not allowed */
 	if (f->n_op == NAME &&
-	    f->n_sp->sname[0] == '_' && f->n_sp->sname[1] == '_') {
-		int i;
-
-		for (i = 0; i < (int)(sizeof(bitable)/sizeof(bitable[0])); i++) {
-			if (strcmp(bitable[i].name, f->n_sp->sname) == 0)
-				return (*bitable[i].fun)(f, a);
-		}
-	}
+	    f->n_sp->sname[0] == '_' && f->n_sp->sname[1] == '_')
+		if ((w = builtin_check(f, a)) != NIL)
+			return w;
 #endif
 
 	/* Check for undefined or late defined enums */
@@ -2544,7 +2294,7 @@
 				goto out;
 #endif
 			} else if (ISSOU(BTYPE(type))) {
-				if (apole->node->n_sue->suem != al[1].sue->suem)
+				if (!suemeq(apole->node->n_sue, al[1].sue))
 					goto incomp;
 			}
 			goto out;
@@ -2564,7 +2314,7 @@
 		/* Check for struct/union compatibility */
 		if (type == arrt) {
 			if (ISSOU(BTYPE(type))) {
-				if (apole->node->n_sue->suem == al[1].sue->suem)
+				if (suemeq(apole->node->n_sue, al[1].sue))
 					goto out;
 			} else
 				goto out;
@@ -2629,7 +2379,9 @@
 			/* may be declared without dimension */
 			if (dsym->ddim == NOOFFSET)
 				dsym->ddim = ddef->ddim;
-			if (ddef->ddim != NOOFFSET && dsym->ddim != ddef->ddim)
+			if (dsym->ddim < 0 && ddef->ddim < 0)
+				; /* dynamic arrays as arguments */
+			else if (ddef->ddim > 0 && dsym->ddim != ddef->ddim)
 				return 1;
 			dsym++, ddef++;
 			break;
@@ -2988,10 +2740,10 @@
 	q = clocal(q);
 
 	p = block(NAME, NIL, NIL, INT, 0, MKSUE(INT));
+	p->n_qual = VOL >> TSHIFT;
 	p->n_sp = lookup(stack_chk_canary, SNORMAL);
 	defid(p, AUTO);
 	p = clocal(p);
-
 	ecomp(buildtree(ASSIGN, p, q));
 }
 

Index: src/external/bsd/pcc/dist/pcc/cc/cpp/cpp.1
diff -u src/external/bsd/pcc/dist/pcc/cc/cpp/cpp.1:1.2 src/external/bsd/pcc/dist/pcc/cc/cpp/cpp.1:1.3
--- src/external/bsd/pcc/dist/pcc/cc/cpp/cpp.1:1.2	Fri Jan  8 16:32:47 2010
+++ src/external/bsd/pcc/dist/pcc/cc/cpp/cpp.1	Thu Jun  3 19:07:59 2010
@@ -1,5 +1,5 @@
-.\"	$Id: cpp.1,v 1.2 2010/01/08 16:32:47 joerg Exp $
-.\"	$NetBSD: cpp.1,v 1.2 2010/01/08 16:32:47 joerg Exp $
+.\"	Id: cpp.1,v 1.11 2010/04/05 13:13:57 reed Exp 	
+.\"	$NetBSD: cpp.1,v 1.3 2010/06/03 19:07:59 plunky Exp $
 .\"	$OpenBSD$
 .\"
 .\" Copyright (c) 2007 Jeremy C. Reed <[email protected]>

Index: src/external/bsd/pcc/dist/pcc/f77/Makefile.in
diff -u src/external/bsd/pcc/dist/pcc/f77/Makefile.in:1.2 src/external/bsd/pcc/dist/pcc/f77/Makefile.in:1.3
--- src/external/bsd/pcc/dist/pcc/f77/Makefile.in:1.2	Fri Jan 22 11:08:40 2010
+++ src/external/bsd/pcc/dist/pcc/f77/Makefile.in	Thu Jun  3 19:07:59 2010
@@ -1,4 +1,5 @@
-#	$Id: Makefile.in,v 1.2 2010/01/22 11:08:40 plunky Exp $
+#	Id: Makefile.in,v 1.3 2008/07/18 14:00:38 gmcgarry Exp 	
+#	$NetBSD: Makefile.in,v 1.3 2010/06/03 19:07:59 plunky Exp $
 #
 # Makefile.in for top-level of pcc.
 #

Reply via email to