scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit e60a9960ac6986677dc7bd54e6d6e268f8be513b
parent 3c00b024fd74b6322d5628b571440c142334d611
Author: Dimitris Papastamos <sin@2f30.org>
Date:   Wed, 15 Jul 2015 20:05:36 +0100

Default to -ansi and declare at top of block

See attached.

>From 9732116e19ad933925fa37fc1bbf603bea47dcc6 Mon Sep 17 00:00:00 2001
From: sin <sin@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.

Diffstat:
Mcc1/Makefile | 2+-
Mcc1/cpp.c | 4++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 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 @@ -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;