summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2010-05-30 16:02:14 +0200
committerLubomir Rintel <lkundrak@v3.sk>2013-10-29 16:30:53 +0100
commit9df2b21f7ca1a595d1efadf7658203c750d91d96 (patch)
treecbaaab31569423e3cdeff4586cad2869259cbfe2
parent4dde350c4cf4e39b184e51a42cf3942e9f50adea (diff)
downloaddev86-9df2b21f7ca1a595d1efadf7658203c750d91d96.tar.gz
Add support for old K&R style initializers
-rw-r--r--bcc/declare.c17
1 files changed, 16 insertions, 1 deletions
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)