From 1ac7c19a527ea506cd3fd87d26b654ab27fd2741 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Thu, 4 Mar 2021 14:31:02 +0100 Subject: [PATCH] cleanup --- Makefile | 3 +-- ast.c | 4 ---- ast.h | 1 - genc.c | 2 +- splc.c | 2 +- 5 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 82ebc58..50af22d 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,7 @@ scan.c: scan.l parse.h parse.h: parse.c expr.c: y.tab.h -$(filter-out scan.o parse.o,$(OBJECTS)): CFLAGS+=-ffunction-sections +$(filter-out scan.o parse.o,$(OBJECTS)): CFLAGS+=-ffunction-sections -fdata-sections clean: $(RM) $(OBJECTS) y.output parse.h scan.h scan.c parse.c expr a.c - $(MAKE) -C test clean diff --git a/ast.c b/ast.c index 762a130..f74f43e 100644 --- a/ast.c +++ b/ast.c @@ -14,8 +14,6 @@ const char *binop_str[] = { [plus] = "+", [minus] = "-", [times] = "*", [divide] = "/", [modulo] = "%", [power] = "^", }; -const char *fieldspec_str[] = { - [fst] = "fst", [snd] = "snd", [hd] = "hd", [tl] = "tl"}; const char *unop_str[] = { [inverse] = "!", [negate] = "-", }; struct ast *ast(struct list *decls, YYLTYPE l) @@ -53,7 +51,6 @@ struct decl *decl_fun(struct fundecl *fundecl, YYLTYPE l) { struct decl *res = xalloc(1, struct decl); res->loc = l; - res->loc = l; res->type = dfundecl; res->data.dfun = fundecl; return res; @@ -63,7 +60,6 @@ struct decl *decl_var(struct vardecl *vardecl, YYLTYPE l) { struct decl *res = xalloc(1, struct decl); res->loc = l; - res->loc = l; res->type = dvardecl; res->data.dvar = vardecl; return res; diff --git a/ast.h b/ast.h index 0410d11..557ccc0 100644 --- a/ast.h +++ b/ast.h @@ -9,7 +9,6 @@ struct ast; #include "parse.h" -extern const char *fieldspec_str[]; extern const char *binop_str[]; extern const char *unop_str[]; diff --git a/genc.c b/genc.c index 72777c9..821a5c0 100644 --- a/genc.c +++ b/genc.c @@ -4,7 +4,7 @@ void expr_genc(struct expr *expr, FILE *cout); -void binop_genc(char *fun, struct expr *l, struct expr *r, FILE *cout) +static void binop_genc(char *fun, struct expr *l, struct expr *r, FILE *cout) { safe_fprintf(cout, "%s(", fun); expr_genc(l, cout); diff --git a/splc.c b/splc.c index cbe3a62..7ea51b2 100644 --- a/splc.c +++ b/splc.c @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) free(cfile); switch(lang) { case langc: -// genc(result, cout); + genc(result, cout); break; default: die("unsupported language\n"); -- 2.20.1