From 7a980b64893fa6c25a1426fb1efe3eb4222bb12b Mon Sep 17 00:00:00 2001 From: Ethan Dicks Date: Tue, 20 Oct 2020 13:17:31 -0400 Subject: [PATCH 1/2] Minor updates to quiet compiler warnings and errors to work with post-C99 compilers --- lex.l | 1 + main.c | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/lex.l b/lex.l index 3c637c6..c527f07 100644 --- a/lex.l +++ b/lex.l @@ -32,6 +32,7 @@ char *strcpy(); %} %option nounput +%option noinput digit [0-9] hexdigit [0-9a-fA-F] diff --git a/main.c b/main.c index a6f101d..27c9810 100644 --- a/main.c +++ b/main.c @@ -230,7 +230,8 @@ void start_trace (addr_t loc, char *name) void do_ptrace (void) { - for (int i = 0; i 0; len--) + for(i = base_addr; len > 0; len--) f[i++] |= LOADED; start_trace(base_addr+6, "**BOOT**"); @@ -616,7 +620,7 @@ void binaryloadfile (void) { FILE *fp; addr_t i; - int c; + int c, j; addr_t reset, irq, nmi; fp = fopen (file, "r"); @@ -645,7 +649,7 @@ void binaryloadfile (void) if (entry_count) { - for (int j = 0; j < entry_count; j++) + for (j = 0; j < entry_count; j++) { char *label = malloc(7); sprintf (label, "e_%04x", entry_address[j]); From 7713b87d32a0d901d862da22f1b5088c565c3829 Mon Sep 17 00:00:00 2001 From: Ethan Dicks Date: Tue, 20 Oct 2020 13:17:31 -0400 Subject: [PATCH 2/2] Explicit use of --std=c99 to quiet gcc warnings. Quiet other warnings. --- Makefile | 2 +- lex.l | 1 + main.c | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9f52cce..51fe20e 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ DEBUG=1 #STATIC=1 -CFLAGS = -Wall +CFLAGS = -Wall --std=c99 LDFLAGS = LDLIBS = diff --git a/lex.l b/lex.l index 3c637c6..c527f07 100644 --- a/lex.l +++ b/lex.l @@ -32,6 +32,7 @@ char *strcpy(); %} %option nounput +%option noinput digit [0-9] hexdigit [0-9a-fA-F] diff --git a/main.c b/main.c index a6f101d..a93ea34 100644 --- a/main.c +++ b/main.c @@ -272,7 +272,7 @@ void do_jtab (void) } void do_jtab2 (void) -{ +{ for (int i = 0; i < jtab2_count; i++) { int loc_l = jtab2_addr_low [i]; @@ -492,7 +492,7 @@ void loadboot (void) FILE *fp; int base_addr; - int len; + int len, i; fp = fopen(file, "r"); cur_file = NULL; @@ -511,7 +511,7 @@ void loadboot (void) if (fread((char *)&d[base_addr], 1, len, fp) != len) crash("input too short"); - for(int i = base_addr; len > 0; len--) + for(i = base_addr; len > 0; len--) f[i++] |= LOADED; start_trace(base_addr+6, "**BOOT**");