See attached.
>From 9732116e19ad933925fa37fc1bbf603bea47dcc6 Mon Sep 17 00:00:00 2001
From: sin <s...@2f30.org>
Date: Wed, 15 Jul 2015 19:52:21 +0100
Subject: [PATCH] Default to -ansi and declare at top of block

Without -ansi, the typeof() function was throwing errors.
---
 cc1/Makefile | 2 +-
 cc1/cpp.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cc1/Makefile b/cc1/Makefile
index c073ae6..ed8ac07 100644
--- a/cc1/Makefile
+++ b/cc1/Makefile
@@ -1,4 +1,4 @@
-
+CFLAGS = -ansi
 OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \
        code.o stmt.o cpp.o
 
diff --git a/cc1/cpp.c b/cc1/cpp.c
index cb2ce98..13ec31b 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -218,7 +218,7 @@ int
 expand(Symbol *sym)
 {
        unsigned len;
-       int r;
+       int r, n;
        char *arglist[NR_MACROARG], arguments[INPUTSIZ], buffer[BUFSIZE];
        char prevc, c, *bp, *lim, *arg, *s = sym->u.s;
 
@@ -236,7 +236,7 @@ expand(Symbol *sym)
        if ((r = parsepars(arguments, arglist, atoi(s))) < 1)
                return r;
 
-       for (int n = 0; n < atoi(s); ++n)
+       for (n = 0; n < atoi(s); ++n)
                fprintf(stderr, "PAR%d:%s\n", n, arglist[n]);
 
        len = INPUTSIZ-1;
-- 
2.4.5

Reply via email to