ref: 52eb16bd024aab0ee1430f48f3a41c689359d8f2
parent: 3f38cfc966f9dc056be291b58d63819215e8fac2
parent: bde52bcdc34eb9fafe7336fa9a23110962a01612
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed May 11 08:23:32 EDT 2016
Merge remote-tracking branch 'origin/master'
--- a/cc1/code.c
+++ b/cc1/code.c
@@ -9,9 +9,7 @@
#include "cc1.h"
static void emitbin(unsigned, void *),
- emitswitcht(unsigned, void *),
emitcast(unsigned, void *),
- emitswitch(unsigned, void *),
emitsym(unsigned, void *),
emitexp(unsigned, void *),
emitsymid(unsigned, void *),
@@ -61,7 +59,7 @@
[OLABEL] = "L%d\n",
[ODEFAULT] = "\tf\tL%d\n",
[OBSWITCH] = "\ts",
- [OESWITCH] = "\tk\n",
+ [OESWITCH] = "\tk\tL%d\n",
[OCASE] = "\tv\tL%d",
[OJUMP] = "\tj\tL%d\n",
[OBRANCH] = "\ty\tL%d",
@@ -129,7 +127,7 @@
[ORET] = emittext,
[ODECL] = emitdcl,
[OBSWITCH] = emittext,
- [OESWITCH] = emittext,
+ [OESWITCH] = emitsymid,
[OPAR] = emitbin,
[OCALL] = emitbin,
[OINIT] = emitinit
@@ -188,11 +186,9 @@
static void
emitconst(Node *np)
{
- char *bp, c;
Symbol *sym = np->sym;
Type *tp = np->type;
TUINT u;
- size_t n;
switch (tp->op) {
case PTR:
@@ -241,7 +237,6 @@
emittype(Type *tp)
{
TINT n;
- Type **vp;
Symbol **sp;
char *tag;
@@ -291,7 +286,7 @@
char *bp, *s, *lim;
int n;
- bp = bp = sym->u.s;
+ bp = sym->u.s;
lim = &sym->u.s[tp->n.elem];
while (bp < lim) {
s = bp;
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -283,7 +283,6 @@
Symbol *syms[NR_FUNPARAM+1], **pars;
int k_r, ntypes, nsyms;
size_t size;
- void (*fp)(Type **, Symbol **, int *, int *);
pushctx();
expect('(');
@@ -367,7 +366,7 @@
specifier(int *sclass, int *qualifier)
{
Type *tp = NULL;
- int spec, qlf, sign, type, cls, size, mask;
+ int spec, qlf, sign, type, cls, size;
spec = qlf = sign = type = cls = size = 0;
--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -56,7 +56,6 @@
{
Type *tp;
Node *new;
- unsigned r;
struct limits *lim, *ilim;
tp = np->type;
@@ -85,7 +84,7 @@
static void
arithconv(Node **p1, Node **p2)
{
- int n, to = 0, s1, s2;
+ int to = 0, s1, s2;
unsigned r1, r2;
Type *tp1, *tp2;
Node *np1, *np2;
--- a/cc1/fold.c
+++ b/cc1/fold.c
@@ -383,7 +383,7 @@
static Node *
identity(int *op, Node *lp, Node *rp)
{
- int iszeror, isoner, istruer, val;
+ int iszeror, isoner, istruer;
int iszerol, isonel, istruel;
if (!rp)
--- a/cc1/init.c
+++ b/cc1/init.c
@@ -51,7 +51,6 @@
static TINT
fielddesig(Init *ip)
{
- TINT npos;
int ons;
Symbol *sym, **p;
Type *tp = ip->type;
@@ -79,7 +78,6 @@
static Init *
designation(Init *ip)
{
- struct designator *dp;
TINT (*fun)(Init *);
switch (yytoken) {
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
@@ -223,7 +223,7 @@
emit(OBSWITCH, NULL);
emit(OEXPR, cond);
stmt(lbreak, lcont, &sw);
- emit(OESWITCH, NULL);
+ emit(OESWITCH, lbreak);
emit(OLABEL, lbreak);
}
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -102,8 +102,6 @@
popctx(void)
{
Symbol *next, *sym;
- char *name;
- short f;
if (--curctx == GLOBALCTX) {
for (sym = labels; sym; sym = next) {
--- a/cc1/tests/test012.c
+++ b/cc1/tests/test012.c
@@ -12,7 +12,7 @@
s A3
v L5 #I0
L5
- k
+ k L4
L4
s A3
v L7 #I0
@@ -24,9 +24,9 @@
f L11
L11
h #I1
- k
+ k L8
L8
- k
+ k L6
L6
h #I2
L10
@@ -34,7 +34,7 @@
v L13 #I1
L13
h #I3
- k
+ k L12
L12
s A3
A3 #I2 :I
@@ -42,7 +42,7 @@
v L16 #I1
L16
h #I4
- k
+ k L14
L14
s A3
v L18 #I0
@@ -54,7 +54,7 @@
f L20
L20
h #I1
- k
+ k L17
L17
}
*/
--- a/cc1/tests/test036.c
+++ b/cc1/tests/test036.c
@@ -43,7 +43,7 @@
y L10 R7 #I1 :-I #I0 >I
b
L11
- k
+ k L8
L8
}
*/
--- a/cc2/arch/amd64-sysv/code.c
+++ b/cc2/arch/amd64-sysv/code.c
@@ -34,7 +34,6 @@
symname(Symbol *sym)
{
static char name[IDENTSIZ+1];
- static unsigned short id;
if (sym->name) {
switch (sym->kind) {
--- a/cc2/arch/i386-sysv/code.c
+++ b/cc2/arch/i386-sysv/code.c
@@ -34,7 +34,6 @@
symname(Symbol *sym)
{
static char name[IDENTSIZ+1];
- static unsigned short id;
if (sym->name) {
switch (sym->kind) {
--- a/cc2/arch/qbe/code.c
+++ b/cc2/arch/qbe/code.c
@@ -157,7 +157,6 @@
static char *
symname(Symbol *sym)
{
- static unsigned id;
char c = sigil(sym);
if (sym->name) {
--- a/cc2/arch/z80/code.c
+++ b/cc2/arch/z80/code.c
@@ -35,7 +35,6 @@
symname(Symbol *sym)
{
static char name[IDENTSIZ+1];
- static unsigned short id;
if (sym->name) {
switch (sym->kind) {
--- a/cc2/node.c
+++ b/cc2/node.c
@@ -20,7 +20,6 @@
static struct arena *arena;
static Node *freep;
-static int inhome;
Node *
newnode(int op)
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -32,8 +32,8 @@
typedef void parsefun(char *, union tokenop);
static parsefun type, symbol, getname, unary, binary, ternary, call,
- parameter, constant, composed, binit, einit,
- jump, oreturn, loop, assign, ocase, casetbl;
+ constant, composed, binit, einit,
+ jump, oreturn, loop, assign, casetbl;
typedef void evalfun(void);
static evalfun vardecl, beginfun, endfun, endpars, stmt,