shithub: scc

Download patch

ref: e60a9960ac6986677dc7bd54e6d6e268f8be513b
parent: 3c00b024fd74b6322d5628b571440c142334d611
author: Dimitris Papastamos <[email protected]>
date: Wed Jul 15 16:05:36 EDT 2015

Default to -ansi and declare at top of block

See attached.

>From 9732116e19ad933925fa37fc1bbf603bea47dcc6 Mon Sep 17 00:00:00 2001
From: sin <[email protected]>
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.

--- 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
 
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -218,7 +218,7 @@
 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 @@
 	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;