aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard>2001-12-02 14:59:18 +0000
committerbellard <bellard>2001-12-02 14:59:18 +0000
commitf22a32342bbd9d3e812876e9cb30ed9c2ce6043f (patch)
tree9e34e272b933d69e64944211236367ca1b5b7b07
parentdf9c04708275f775d5afef227a643f6f3dabfa60 (diff)
downloadtinycc-f22a32342bbd9d3e812876e9cb30ed9c2ce6043f.tar.gz
tinycc-f22a32342bbd9d3e812876e9cb30ed9c2ce6043f.tar.bz2
added K&R proto parsing
-rw-r--r--tcc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tcc.c b/tcc.c
index 9045c3a..3d39f7e 100644
--- a/tcc.c
+++ b/tcc.c
@@ -3289,7 +3289,15 @@ void decl(l)
int *a, t, b, v, u, n, addr, has_init;
Sym *sym;
- while (b = ist()) {
+ while (1) {
+ b = ist();
+ if (!b) {
+ /* special test for old K&R protos without explicit int
+ type. Only accepted when defining global data */
+ if (l == VT_LOCAL || tok < TOK_DEFINE)
+ break;
+ b = VT_INT;
+ }
if ((b & (VT_ENUM | VT_STRUCT)) && tok == ';') {
/* we accept no variable after */
next();