Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/pcc Update build system and merge changes for p...
details: https://anonhg.NetBSD.org/src/rev/5bdb1d963bf0
branches: trunk
changeset: 747141:5bdb1d963bf0
user: gmcgarry <gmcgarry%NetBSD.org@localhost>
date: Fri Sep 04 00:50:04 2009 +0000
description:
Update build system and merge changes for pcc 0.9.9 090902.
diffstat:
external/bsd/pcc/config.h | 6 +
external/bsd/pcc/dist/pcc/cc/ccom/pftn.c | 1255 ++++++++++++++++++++++-------
external/bsd/pcc/lib/libpcc/Makefile | 3 +-
external/bsd/pcc/libexec/ccom/Makefile | 4 +-
external/bsd/pcc/libexec/cpp/Makefile | 4 +-
5 files changed, 952 insertions(+), 320 deletions(-)
diffs (truncated from 1926 to 300 lines):
diff -r 3b16438c53b4 -r 5bdb1d963bf0 external/bsd/pcc/config.h
--- a/external/bsd/pcc/config.h Fri Sep 04 00:27:29 2009 +0000
+++ b/external/bsd/pcc/config.h Fri Sep 04 00:50:04 2009 +0000
@@ -189,6 +189,12 @@
/* Version string */
#define VERSSTR "pcc 0.9.9 for i386-pc-netbsdelf, greg@sparky Wed Aug 13 22:19:18 EST 2008"
+/* Size of wide character type */
+#define WCHAR_SIZE 4
+
+/* Type to use for wide characters */
+#define WCHAR_TYPE UNSIGNED
+
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#define YYTEXT_POINTER 1
diff -r 3b16438c53b4 -r 5bdb1d963bf0 external/bsd/pcc/dist/pcc/cc/ccom/pftn.c
--- a/external/bsd/pcc/dist/pcc/cc/ccom/pftn.c Fri Sep 04 00:27:29 2009 +0000
+++ b/external/bsd/pcc/dist/pcc/cc/ccom/pftn.c Fri Sep 04 00:50:04 2009 +0000
@@ -1,4 +1,4 @@
-/* $Id: pftn.c,v 1.3 2008/09/12 14:40:46 christos Exp $ */
+/* $Id: pftn.c,v 1.4 2009/09/04 00:50:05 gmcgarry Exp $ */
/*
* Copyright (c) 2003 Anders Magnusson (ragge%ludd.luth.se@localhost).
* All rights reserved.
@@ -11,8 +11,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -100,6 +98,7 @@
int rstr;
struct symtab *rsym;
struct symtab *rb;
+ NODE *rgp;
int flags;
#define LASTELM 1
} *rpole;
@@ -115,20 +114,22 @@
/* defines used for getting things off of the initialization stack */
-static NODE *arrstk[10];
-static int arrstkp;
+NODE *arrstk[10];
+int arrstkp;
static int intcompare;
static NODE *parlink;
void fixtype(NODE *p, int class);
int fixclass(int class, TWORD type);
-int falloc(struct symtab *p, int w, int new, NODE *pty);
static void dynalloc(struct symtab *p, int *poff);
void inforce(OFFSZ n);
void vfdalign(int n);
static void ssave(struct symtab *);
static void alprint(union arglist *al, int in);
static void lcommadd(struct symtab *sp);
+static NODE *mkcmplx(NODE *p, TWORD dt);
+extern int fun_inline;
+struct suedef *sueget(struct suedef *p);
int ddebug = 0;
@@ -138,19 +139,23 @@
*/
void
-defid(NODE *q, int class)
+defid(NODE *ap, int class)
{
- extern int fun_inline;
struct symtab *p;
TWORD type, qual;
TWORD stp, stq;
int scl;
union dimfun *dsym, *ddef;
int slev, temp, changed;
+ NODE *q = ap;
if (q == NIL)
return; /* an error was detected */
+#ifdef GCC_COMPAT
+ if (q->n_op == CM)
+ q = q->n_left;
+#endif
p = q->n_sp;
if (p->sname == NULL)
@@ -245,8 +250,12 @@
#endif
/* check that redeclarations are to the same structure */
- if ((temp == STRTY || temp == UNIONTY) && p->ssue != q->n_sue) {
- goto mismatch;
+ if (temp == STRTY || temp == UNIONTY) {
+ struct suedef *sue1, *sue2;
+ GETSUE(sue1, p->ssue);
+ GETSUE(sue2, q->n_sue);
+ if (sue1 != sue2)
+ goto mismatch;
}
scl = p->sclass;
@@ -256,6 +265,15 @@
printf(" previous class: %s\n", scnames(scl));
#endif
+#ifdef GCC_COMPAT
+ /* Its allowed to add attributes to existing declarations */
+ if (ap != q) {
+ p->ssue = sueget(p->ssue);
+ p->ssue->suega = gcc_attr_parse(ap->n_right);
+ ap->n_right = bcon(0);
+ }
+#endif
+
if (class & FIELD)
return;
switch(class) {
@@ -272,7 +290,14 @@
case FORTRAN:
case UFORTRAN:
goto done;
+ case SNULL:
+ if (p->sflags & SINLINE) {
+ p->sclass = EXTDEF;
+ inline_ref(p);
+ goto done;
}
+ break;
+ }
break;
case STATIC:
@@ -318,6 +343,15 @@
case USTATIC:
p->sclass = STATIC;
goto done;
+ case SNULL:
+ /*
+ * Handle redeclarations of inlined functions.
+ * This is allowed if the previous declaration is of
+ * type gnu_inline.
+ */
+ if (gcc_get_attr(p->ssue, GCC_ATYP_GNU_INLINE))
+ goto done;
+ break;
}
break;
@@ -356,11 +390,25 @@
#endif
p->stype = type;
p->squal = qual;
- p->sclass = class;
- p->slevel = blevel;
+ p->sclass = (char)class;
+ p->slevel = (char)blevel;
p->soffset = NOOFFSET;
if (q->n_sue == NULL)
cerror("q->n_sue == NULL");
+#ifdef GCC_COMPAT
+ if (ap != q) {
+ struct gcc_attrib *ga;
+ struct suedef *sue;
+
+ sue = q->n_sue = sueget(q->n_sue);
+ sue->suega = gcc_attr_parse(ap->n_right);
+ if ((ga = gcc_get_attr(sue, GCC_ATYP_ALIGNED))) {
+ sue->suealign = ga->a1.iarg;
+ SETOFF(sue->suesize, sue->suealign);
+ }
+ ap->n_right = bcon(0);
+ }
+#endif
p->ssue = q->n_sue;
/* copy dimensions */
@@ -371,7 +419,7 @@
/* allocate offsets */
if (class&FIELD) {
- (void) falloc(p, class&FLDSIZ, 0, NIL); /* new entry */
+ (void) falloc(p, class&FLDSIZ, NIL); /* new entry */
} else switch (class) {
case REGISTER:
@@ -415,10 +463,13 @@
rpole->rstr = 0;
break;
case SNULL:
+#ifdef notdef
if (fun_inline) {
p->slevel = 1;
p->soffset = getlab();
}
+#endif
+ break;
}
#ifdef STABS
@@ -457,6 +508,7 @@
void
ftnend()
{
+ extern NODE *cftnod;
extern struct savbc *savbc;
extern struct swdef *swpole;
extern int tvaloff;
@@ -464,13 +516,17 @@
if (retlab != NOLAB && nerrors == 0) { /* inside a real function */
plabel(retlab);
+ if (cftnod)
+ ecomp(buildtree(FORCE, cftnod, NIL));
efcode(); /* struct return handled here */
- c = cftnsp->soname;
+ if ((c = cftnsp->soname) == NULL)
+ c = addname(exname(cftnsp->sname));
SETOFF(maxautooff, ALCHAR);
- send_passt(IP_EPILOG, 0, maxautooff/SZCHAR, c,
+ send_passt(IP_EPILOG, maxautooff/SZCHAR, c,
cftnsp->stype, cftnsp->sclass == EXTDEF, retlab, tvaloff);
}
+ cftnod = NIL;
tcheck();
brklab = contlab = retlab = NOLAB;
flostat = 0;
@@ -484,6 +540,7 @@
}
savbc = NULL;
lparam = NULL;
+ cftnsp = NULL;
maxautooff = autooff = AUTOINIT;
reached = 1;
@@ -495,7 +552,7 @@
}
static struct symtab nulsym = {
- { NULL, 0, 0, 0, 0 }, "null", "null", INT, 0, NULL, NULL
+ NULL, 0, 0, 0, 0, "null", "null", INT, 0, NULL, NULL
};
void
@@ -581,6 +638,8 @@
plabel(prolab); /* after prolog, used in optimization */
retlab = getlab();
bfcode(parr, nparams);
+ if (fun_inline && xinline)
+ inline_args(parr, nparams);
plabel(getlab()); /* used when spilling */
if (parlink)
ecomp(parlink);
@@ -591,20 +650,38 @@
}
/*
+ * Alloc sue from either perm or tmp memory, depending on blevel.
+ */
+struct suedef *
+sueget(struct suedef *p)
+{
+ struct suedef *sue;
+
+ if (blevel == 0) {
+ sue = permalloc(sizeof(struct suedef));
+ suedefcnt++;
+ } else
+ sue = tmpalloc(sizeof(struct suedef));
+ sue = memset(sue, 0, sizeof(struct suedef));
+ sue->suep = p;
+ return sue;
+}
+
+/*
* Struct/union/enum symtab construction.
*/
static void
defstr(struct symtab *sp, int class)
{
sp->ssue = permalloc(sizeof(struct suedef));
- sp->ssue->suesize = 0;
- sp->ssue->sylnk = NULL;
- sp->ssue->suealign = 0;
- sp->sclass = class;
+ memset(sp->ssue, 0, sizeof(struct suedef));
+ sp->sclass = (char)class;
if (class == STNAME)
sp->stype = STRTY;
else if (class == UNAME)
sp->stype = UNIONTY;
+ else if (class == ENAME)
Home |
Main Index |
Thread Index |
Old Index