From 9df2b21f7ca1a595d1efadf7658203c750d91d96 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Sun, 30 May 2010 16:02:14 +0200 Subject: Add support for old K&R style initializers --- bcc/declare.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bcc/declare.c b/bcc/declare.c index a92c545..09859c6 100644 --- a/bcc/declare.c +++ b/bcc/declare.c @@ -857,11 +857,24 @@ PRIVATE void idecllist() gvarsymptr->flags = KEYWORD; gvarsymptr->offset.offsym = TYPEDEFNAME; } +#ifndef VERY_SMALL_MEMORY + if (sym == ASSIGNOP || (ancient && sym == LBRACE)) +#else if (sym == ASSIGNOP) +#endif { + /* This is always false for low-memory environments given */ + /* there's no ancient switch there. */ + int oldstyle = (sym == LBRACE); + if (gvarsymptr->flags & INITIALIZED) multidecl(gvarname); - nextsym(); + /* If we're initializing an array, let's pretend there */ + /* was a new-fashioned initializer with an equal sign */ + if (oldstyle && gvartype->constructor == ARRAY) + oldstyle = 0; + else + nextsym(); if (level == GLBLEVEL || gvarsc == STATICDECL) { #ifndef DIRECTPAGE @@ -914,6 +927,8 @@ PRIVATE void idecllist() break; } } + if (oldstyle) + rbrace(); } else if (level != GLBLEVEL && gvarsc == STATICDECL && gvartype->constructor != FUNCTION) -- cgit v1.2.1