From b0dc17edf5dbddf0948286a7125a2ad500adde58 Mon Sep 17 00:00:00 2001 From: plunky Date: Mon, 26 Mar 2012 14:30:46 +0000 Subject: [PATCH] resolve merge conflicts --- external/bsd/pcc/dist/pcc/cc/ccom/ccom.1 | 171 +++++++++++++++++- .../bsd/pcc/dist/pcc/cc/ccom/gcc_compat.c | 7 +- external/bsd/pcc/dist/pcc/cc/ccom/pass1.h | 9 +- external/bsd/pcc/dist/pcc/cc/ccom/pftn.c | 26 ++- external/bsd/pcc/dist/pcc/mip/common.c | 10 +- 5 files changed, 198 insertions(+), 25 deletions(-) diff --git a/external/bsd/pcc/dist/pcc/cc/ccom/ccom.1 b/external/bsd/pcc/dist/pcc/cc/ccom/ccom.1 index daa60a121a61..0a298d60a201 100644 --- a/external/bsd/pcc/dist/pcc/cc/ccom/ccom.1 +++ b/external/bsd/pcc/dist/pcc/cc/ccom/ccom.1 @@ -1,5 +1,5 @@ -.\" Id: ccom.1,v 1.24 2011/11/14 16:46:17 plunky Exp -.\" $NetBSD: ccom.1,v 1.5 2012/01/11 20:46:48 plunky Exp $ +.\" Id: ccom.1,v 1.27 2012/03/22 21:09:41 plunky Exp +.\" $NetBSD: ccom.1,v 1.6 2012/03/26 14:30:46 plunky Exp $ .\" .\" Copyright (c) 2007 Jeremy C. Reed .\" @@ -16,7 +16,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF .\" THIS SOFTWARE. .\" -.Dd November 14, 2011 +.Dd March 22, 2012 .Dt CCOM 1 .Os .Sh NAME @@ -222,7 +222,7 @@ Do dead code elimination. Delete redundant jumps and dead code. .It Sy gnu89 .It Sy gnu99 -Use gcc semantics rather than C99 for some things. +Use GNU C semantics rather than C99 for some things. Currently only inline. .It Sy inline Replace calls to functions marked with an inline specifier with a copy @@ -254,6 +254,8 @@ Code printout Trees when entering pass2 .It Sy f Instruction matcher, may provide much output +.It Sy g +Print flow graphs .It Sy n Memory allocation .It Sy o @@ -270,6 +272,167 @@ Sethi-Ullman computations Target-specific flag, used in machine-dependent code .El .El +.Sh PRAGMAS +Input lines starting with a +.Dq #pragma +directive can be used to modify behaviour of +.Nm +during compilation. +All tokens up to the first unescaped newline are considered part +of the pragma command, with the following operations being recognized: +.Bl -tag +.It Sy STDC +Standard C99 operator follows. +Currently no C99 operations are implemented, and any directives starting +with this token will be silently ignored. +.It Sy GCC diagnostic Ar effect Qq Ar option +GNU C compatibility. +Alter the effects of compiler diagnostics. +The required +.Ar effect +should be stated as +.Sy warning , +.Sy error +or +.Sy ignored , +followed by the compiler diagnostic +.Ar option +in double quotes. +For example, to force unknown pragmas to always generate an error, +a standard header might include +.Bd -literal -offset 2n +#pragma GCC diagnostic error "-Wunknown-pragmas" +.Ed +.It Sy GCC poison Ar identifier ... +GNU C compatibility. +Cause an error if any of the following +.Ar identifier Ns s +subsequently appear in the code +.Pq but not in any macro expansions . +Currently not implemented. +.It Sy GCC visibility +GNU C compatibility. +Currently not implemented. +.It Sy pack Ns Pq Op Ar n +Set the default maximum alignment for structures and unions, such that +members will have their natural alignment requirements clamped at this +value and may be stored misaligned. +If +.Ar n +is not given, the alignment is reset to the target default. +.It Sy pack Ns Pq Sy push Ns Op , Ar n +Push the current pack setting onto an internal stack then, if +.Ar n +is given, change the default alignment for structures and unions. +Currently not implemented. +.It Sy pack Ns Pq Sy pop +Change the pack setting to the most recently pushed value, and remove +that setting from the stack. +Currently not implemented. +.It Sy packed Op Ar n +Set the maximum alignment for the structure or union defined +in the current statement. +If +.Ar n +is not given, the default value of 1 is used. +.Pq Currently this works except Ar n is not used +.It Sy aligned Op Ar n +Set the minimum alignment for the structure or union defined +in the current statement. +.It Sy rename Ar name +Provide an alternative +.Ar name +which will be used to reference the object declared in the current statement. +.It Sy weak Ar name Ns Op = Ns Ar alias +Mark +.Ar name +as a weak rather than a global symbol, to allow its definition to be +overridden at link time. +If an +.Ar alias +is given, this will be used as the default value of +.Ar name. +.It Sy ident +Currently not implemented. +.El +.Lp +and the following target-specific operations are handled by +machine-dependent code: +.Bl -tag +.It Sy tls +For AMD64 and i386 targets, the variable declared in the current statement +will be referenced via the +.Dq thread-local storage +mechanism. +.It Sy init +For AMD64, ARM, HPPA, i386, MIPS and PowerPC targets, when the current statement is a +function declaration, generate a reference in the +.Sy .ctors +section, enabling library code to call the function prior to entering +.Fn main . +.It Sy fini +For AMD64, ARM, HPPA, i386, MIPS and PowerPC targets, when the current statement is a +function declaration, generate a reference in the +.Sy .dtors +section, enabling library code to call the function when +.Fn main +returns or the +.Fn exit +function is called. +.It Sy section Ar name +For AMD64, ARM, HPPA and i386 targets, place the subsequent code in the named +section. +.Pq This is currently broken . +.It Sy alias Ar name +For AMD64, HPPA and i386 targets, emit assembler instructions providing an +alias for the symbol defined by the current statement. +.It Sy stdcall +For i386 targets, enable +.Dq stdcall +semantics during code generation, where function arguments are passed on +the stack in right-to-left order, and the callee is responsible for adjusting +the stack pointer before returning. +Any function result is passed in the EAX register. +On win32, the function name is postfixed with an +.Dq @ +and the size of the stack adjustment. +.It Sy cdecl +For i386 targets, enable +.Dq cdecl +semantics during code generation, where function arguments are passed on +the stack in right-to-left order, and the caller is responsible for cleaning +up the stack after the function returns. +Any function result is passed in the EAX register. +This is the default. +.It Sy fastcall +For i386-win32 targets, enable +.Dq fastcall +semantics during code generation. +.Po +Currently this is equivalent to +.Sy stdcall , +which is likely wrong +.Pc . +.It Sy dllimport +For i386-win32 targets, references to the external symbol defined by +the current statement will be made via indirect access through a +location identified by the symbol name prefixed with +.Dq __imp_ . +.It Sy dllexport +For i386-win32 targets, the external symbol declared by the current +statement will be exported as an indirect reference to be +accessed with +.Sy dllimport . +The global locator will be the symbol name prefixed with +.Dq __imp_ . +Currently this is not completely implemented. +.El +.Pp +Any unknown +.Dq #pragma +directives will be ignored unless the +.Fl Wunknown-pragmas +diagnostic is in effect. .Sh SEE ALSO .Xr as 1 , .Xr cpp 1 , diff --git a/external/bsd/pcc/dist/pcc/cc/ccom/gcc_compat.c b/external/bsd/pcc/dist/pcc/cc/ccom/gcc_compat.c index 7a514bc06176..721d14e8f276 100644 --- a/external/bsd/pcc/dist/pcc/cc/ccom/gcc_compat.c +++ b/external/bsd/pcc/dist/pcc/cc/ccom/gcc_compat.c @@ -1,5 +1,5 @@ -/* Id: gcc_compat.c,v 1.81 2011/07/27 13:41:44 ragge Exp */ -/* $NetBSD: gcc_compat.c,v 1.2 2012/03/12 09:09:40 plunky Exp $ */ +/* Id: gcc_compat.c,v 1.83 2012/03/22 18:04:41 plunky Exp */ +/* $NetBSD: gcc_compat.c,v 1.3 2012/03/26 14:30:46 plunky Exp $ */ /* * Copyright (c) 2004 Anders Magnusson (ragge@ludd.luth.se). * All rights reserved. @@ -514,7 +514,8 @@ gcc_tcattrfix(NODE *p) int pragmas_gcc(char *t) { - int ign, warn, err, i, u; + char u; + int ign, warn, err, i; extern bittype warnary[], werrary[]; extern char *flagstr[], *pragstore; diff --git a/external/bsd/pcc/dist/pcc/cc/ccom/pass1.h b/external/bsd/pcc/dist/pcc/cc/ccom/pass1.h index 3275f298c35b..0f5f3a42ed41 100644 --- a/external/bsd/pcc/dist/pcc/cc/ccom/pass1.h +++ b/external/bsd/pcc/dist/pcc/cc/ccom/pass1.h @@ -1,5 +1,5 @@ -/* Id: pass1.h,v 1.235 2011/08/14 14:52:29 ragge Exp */ -/* $NetBSD: pass1.h,v 1.2 2012/03/12 09:09:40 plunky Exp $ */ +/* Id: pass1.h,v 1.237 2012/03/22 18:51:40 plunky Exp */ +/* $NetBSD: pass1.h,v 1.3 2012/03/26 14:30:46 plunky Exp $ */ /* * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved. * @@ -169,7 +169,6 @@ int mygenswitch(int, TWORD, struct swents **, int); extern int blevel; extern int instruct, got_type; extern int oldstyle; -extern int oflag; extern int lineno, nerrors; @@ -183,8 +182,8 @@ extern OFFSZ inoff; extern int reached; extern int isinlining; extern int xinline, xgnu89, xgnu99; - -extern int sdebug, idebug, pdebug; +extern int bdebug, ddebug, edebug, idebug, ndebug; +extern int odebug, pdebug, sdebug, tdebug, xdebug; /* various labels */ extern int brklab; diff --git a/external/bsd/pcc/dist/pcc/cc/ccom/pftn.c b/external/bsd/pcc/dist/pcc/cc/ccom/pftn.c index ba8abdb61229..46f8d9485035 100644 --- a/external/bsd/pcc/dist/pcc/cc/ccom/pftn.c +++ b/external/bsd/pcc/dist/pcc/cc/ccom/pftn.c @@ -1,5 +1,5 @@ -/* Id: pftn.c,v 1.339 2011/08/31 18:02:24 plunky Exp */ -/* $NetBSD: pftn.c,v 1.7 2011/09/01 12:55:29 plunky Exp $ */ +/* Id: pftn.c,v 1.342 2012/03/22 18:51:40 plunky Exp */ +/* $NetBSD: pftn.c,v 1.8 2012/03/26 14:30:46 plunky Exp $ */ /* * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se). * All rights reserved. @@ -131,8 +131,6 @@ static void lcommadd(struct symtab *sp); static NODE *mkcmplx(NODE *p, TWORD dt); extern int fun_inline; -int ddebug = 0; - /* * Declaration of an identifier. Handles redeclarations, hiding, * incomplete types and forward declarations. @@ -1992,6 +1990,10 @@ arglist(NODE *n) if (w->n_right->n_op == ELLIPSIS) continue; ty = w->n_right->n_type; + if (ty == ENUMTY) { + uerror("arg %d enum undeclared", cnt); + ty = w->n_right->n_type = INT; + } if (BTYPE(ty) == STRTY || BTYPE(ty) == UNIONTY) num++; while (ISFTN(ty) == 0 && ISARY(ty) == 0 && ty > BTMASK) @@ -2001,6 +2003,10 @@ arglist(NODE *n) } cnt++; ty = w->n_type; + if (ty == ENUMTY) { + uerror("arg %d enum undeclared", cnt); + ty = w->n_type = INT; + } if (BTYPE(ty) == STRTY || BTYPE(ty) == UNIONTY) num++; while (ISFTN(ty) == 0 && ISARY(ty) == 0 && ty > BTMASK) @@ -2168,7 +2174,10 @@ alprint(union arglist *al, int in) printf(" dim %d ", al->df->ddim); } else if (ISFTN(t)) { al++; - alprint(al->df->dfun, in+1); + if (al->df->dfun) { + printf("\n"); + alprint(al->df->dfun, in+1); + } } t = DECREF(t); } @@ -2183,6 +2192,7 @@ alprint(union arglist *al, int in) printf("end arglist\n"); } #endif + int suemeq(struct attr *s1, struct attr *s2) { @@ -2976,9 +2986,9 @@ complinit() struct rstack *rp; NODE *p, *q; char *n[] = { "0f", "0d", "0l" }; - int i, odebug; + int i, d_debug; - odebug = ddebug; + d_debug = ddebug; ddebug = 0; real = addname("__real"); imag = addname("__imag"); @@ -2996,7 +3006,7 @@ complinit() nfree(q); } nfree(p); - ddebug = odebug; + ddebug = d_debug; } /* diff --git a/external/bsd/pcc/dist/pcc/mip/common.c b/external/bsd/pcc/dist/pcc/mip/common.c index cd192bb1eb32..0446bd932d6a 100644 --- a/external/bsd/pcc/dist/pcc/mip/common.c +++ b/external/bsd/pcc/dist/pcc/mip/common.c @@ -1,5 +1,5 @@ -/* Id: common.c,v 1.99 2011/11/14 11:52:13 plunky Exp */ -/* $NetBSD: common.c,v 1.4 2012/01/11 20:46:48 plunky Exp $ */ +/* Id: common.c,v 1.100 2012/03/22 18:51:40 plunky Exp */ +/* $NetBSD: common.c,v 1.5 2012/03/26 14:30:47 plunky Exp $ */ /* * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se). * All rights reserved. @@ -263,14 +263,14 @@ talloc() freelink = p->next; if (p->n_op != FREE) cerror("node not FREE: %p", p); - if (nflag) + if (ndebug) printf("alloc node %p from freelist\n", p); return p; } p = permalloc(sizeof(NODE)); p->n_op = FREE; - if (nflag) + if (ndebug) printf("alloc node %p from memory\n", p); return p; } @@ -351,7 +351,7 @@ nfree(NODE *p) } #endif - if (nflag) + if (ndebug) printf("freeing node %p\n", p); p->n_op = FREE; p->next = freelink;