mirror of
https://github.com/cc65/cc65.git
synced 2025-02-06 12:31:12 +00:00
Revoked part of last change - didn't work
git-svn-id: svn://svn.cc65.org/cc65/trunk@2025 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
6f52726647
commit
f6376d7d60
@ -1114,9 +1114,6 @@ static unsigned ParseArrayInit (type* T, int AllowFlexibleMembers)
|
|||||||
/* Special handling for a character array initialized by a literal */
|
/* Special handling for a character array initialized by a literal */
|
||||||
if (IsTypeChar (ElementType) && CurTok.Tok == TOK_SCONST) {
|
if (IsTypeChar (ElementType) && CurTok.Tok == TOK_SCONST) {
|
||||||
|
|
||||||
/* Optional curly braces */
|
|
||||||
unsigned BraceCount = OpeningCurlyBraces (0);
|
|
||||||
|
|
||||||
/* Char array initialized by string constant */
|
/* Char array initialized by string constant */
|
||||||
const char* Str = GetLiteral (CurTok.IVal);
|
const char* Str = GetLiteral (CurTok.IVal);
|
||||||
Count = GetLiteralPoolOffs () - CurTok.IVal;
|
Count = GetLiteralPoolOffs () - CurTok.IVal;
|
||||||
@ -1129,13 +1126,10 @@ static unsigned ParseArrayInit (type* T, int AllowFlexibleMembers)
|
|||||||
ResetLiteralPoolOffs (CurTok.IVal);
|
ResetLiteralPoolOffs (CurTok.IVal);
|
||||||
NextToken ();
|
NextToken ();
|
||||||
|
|
||||||
/* Closing curly braces (if we had any opening ones) */
|
|
||||||
ClosingCurlyBraces (BraceCount);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* Optional curly braces */
|
/* Curly brace */
|
||||||
unsigned BraceCount = OpeningCurlyBraces (1);
|
ConsumeLCurly ();
|
||||||
|
|
||||||
/* Initialize the array members */
|
/* Initialize the array members */
|
||||||
Count = 0;
|
Count = 0;
|
||||||
@ -1151,8 +1145,8 @@ static unsigned ParseArrayInit (type* T, int AllowFlexibleMembers)
|
|||||||
NextToken ();
|
NextToken ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Closing curly braces (if we had any opening ones) */
|
/* Closing curly braces */
|
||||||
ClosingCurlyBraces (BraceCount);
|
ConsumeRCurly ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1185,7 +1179,7 @@ static unsigned ParseStructInit (type* Type, int AllowFlexibleMembers)
|
|||||||
|
|
||||||
|
|
||||||
/* Consume the opening curly brace */
|
/* Consume the opening curly brace */
|
||||||
unsigned BraceCount = OpeningCurlyBraces (1);
|
ConsumeLCurly ();
|
||||||
|
|
||||||
/* Get a pointer to the struct entry from the type */
|
/* Get a pointer to the struct entry from the type */
|
||||||
Entry = DecodePtr (Type + 1);
|
Entry = DecodePtr (Type + 1);
|
||||||
@ -1200,7 +1194,7 @@ static unsigned ParseStructInit (type* Type, int AllowFlexibleMembers)
|
|||||||
if (Tab == 0) {
|
if (Tab == 0) {
|
||||||
Error ("Cannot initialize variables with incomplete type");
|
Error ("Cannot initialize variables with incomplete type");
|
||||||
/* Try error recovery */
|
/* Try error recovery */
|
||||||
SkipInitializer (BraceCount);
|
SkipInitializer (1);
|
||||||
/* Nothing initialized */
|
/* Nothing initialized */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1213,7 +1207,7 @@ static unsigned ParseStructInit (type* Type, int AllowFlexibleMembers)
|
|||||||
while (CurTok.Tok != TOK_RCURLY) {
|
while (CurTok.Tok != TOK_RCURLY) {
|
||||||
if (Entry == 0) {
|
if (Entry == 0) {
|
||||||
Error ("Too many initializers");
|
Error ("Too many initializers");
|
||||||
SkipInitializer (BraceCount);
|
SkipInitializer (1);
|
||||||
return Size;
|
return Size;
|
||||||
}
|
}
|
||||||
/* Parse initialization of one field. Flexible array members may
|
/* Parse initialization of one field. Flexible array members may
|
||||||
@ -1228,7 +1222,7 @@ static unsigned ParseStructInit (type* Type, int AllowFlexibleMembers)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Consume the closing curly brace */
|
/* Consume the closing curly brace */
|
||||||
ClosingCurlyBraces (BraceCount);
|
ConsumeRCurly ();
|
||||||
|
|
||||||
/* If there are struct fields left, reserve additional storage */
|
/* If there are struct fields left, reserve additional storage */
|
||||||
if (Size < StructSize) {
|
if (Size < StructSize) {
|
||||||
@ -1254,7 +1248,7 @@ static unsigned ParseVoidInit (void)
|
|||||||
unsigned Size;
|
unsigned Size;
|
||||||
|
|
||||||
/* Opening brace */
|
/* Opening brace */
|
||||||
unsigned BraceCount = OpeningCurlyBraces (1);
|
ConsumeLCurly ();
|
||||||
|
|
||||||
/* Allow an arbitrary list of values */
|
/* Allow an arbitrary list of values */
|
||||||
Size = 0;
|
Size = 0;
|
||||||
@ -1306,7 +1300,7 @@ static unsigned ParseVoidInit (void)
|
|||||||
} while (CurTok.Tok != TOK_RCURLY);
|
} while (CurTok.Tok != TOK_RCURLY);
|
||||||
|
|
||||||
/* Closing brace */
|
/* Closing brace */
|
||||||
ClosingCurlyBraces (BraceCount);
|
ConsumeRCurly ();
|
||||||
|
|
||||||
/* Return the number of bytes initialized */
|
/* Return the number of bytes initialized */
|
||||||
return Size;
|
return Size;
|
||||||
@ -1350,7 +1344,7 @@ static unsigned ParseInitInternal (type* T, int AllowFlexibleMembers)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned ParseInit (type* T)
|
unsigned ParseInit (type* T)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user