shithub: scc

Download patch

ref: bde52bcdc34eb9fafe7336fa9a23110962a01612
parent: 7b78b22025c26725219a68905ab405f007c6b30e
author: Hiltjo Posthuma <hiltjo@codemadness.org>
date: Tue May 10 15:36:12 EDT 2016

remove unused variables

--- 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 *),
@@ -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/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/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,