mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-07 22:32:05 +00:00
Simplify handling of const and volatile type qualifiers.
These qualifiers were previously sometimes accepted between the name and left brace of struct and enum type specifiers. This was non-standard and is no longer allowed.
This commit is contained in:
parent
428c991895
commit
3ce2be9f74
30
Parser.pas
30
Parser.pas
@ -2719,21 +2719,6 @@ var
|
|||||||
end; {FieldList}
|
end; {FieldList}
|
||||||
|
|
||||||
|
|
||||||
procedure CheckConst;
|
|
||||||
|
|
||||||
{ Check the token to see if it is a const or volatile }
|
|
||||||
|
|
||||||
begin {CheckConst}
|
|
||||||
while token.kind in [constsy,volatilesy] do begin
|
|
||||||
if token.kind = constsy then
|
|
||||||
isConstant := true
|
|
||||||
else
|
|
||||||
volatile := true;
|
|
||||||
NextToken;
|
|
||||||
end; {while}
|
|
||||||
end; {CheckConst}
|
|
||||||
|
|
||||||
|
|
||||||
procedure ResolveType;
|
procedure ResolveType;
|
||||||
|
|
||||||
{ Resolve a set of type specifier keywords to a type }
|
{ Resolve a set of type specifier keywords to a type }
|
||||||
@ -2803,9 +2788,18 @@ while token.kind in [unsignedsy,signedsy,intsy,longsy,charsy,shortsy,floatsy,
|
|||||||
doublesy,voidsy,compsy,extendedsy,enumsy,structsy,unionsy,typedef,
|
doublesy,voidsy,compsy,extendedsy,enumsy,structsy,unionsy,typedef,
|
||||||
constsy,volatilesy] do begin
|
constsy,volatilesy] do begin
|
||||||
case token.kind of
|
case token.kind of
|
||||||
constsy,volatilesy:
|
{type qualifiers}
|
||||||
CheckConst;
|
constsy: begin
|
||||||
|
isConstant := true;
|
||||||
|
NextToken;
|
||||||
|
end;
|
||||||
|
|
||||||
|
volatilesy: begin
|
||||||
|
volatile := true;
|
||||||
|
NextToken;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{type specifiers}
|
||||||
unsignedsy,signedsy,intsy,longsy,charsy,shortsy,floatsy,doublesy,voidsy,
|
unsignedsy,signedsy,intsy,longsy,charsy,shortsy,floatsy,doublesy,voidsy,
|
||||||
compsy,extendedsy: begin
|
compsy,extendedsy: begin
|
||||||
if typeDone then
|
if typeDone then
|
||||||
@ -2843,7 +2837,6 @@ while token.kind in [unsignedsy,signedsy,intsy,longsy,charsy,shortsy,floatsy,
|
|||||||
tPtr^.kind := enumType;
|
tPtr^.kind := enumType;
|
||||||
variable :=
|
variable :=
|
||||||
NewSymbol(ttoken.name, tPtr, storageClass, tagSpace, defined);
|
NewSymbol(ttoken.name, tPtr, storageClass, tagSpace, defined);
|
||||||
CheckConst;
|
|
||||||
end {if}
|
end {if}
|
||||||
else if token.kind <> lbracech then
|
else if token.kind <> lbracech then
|
||||||
Error(9);
|
Error(9);
|
||||||
@ -2943,7 +2936,6 @@ while token.kind in [unsignedsy,signedsy,intsy,longsy,charsy,shortsy,floatsy,
|
|||||||
end {else}
|
end {else}
|
||||||
else begin {record the existing structure type}
|
else begin {record the existing structure type}
|
||||||
structTypePtr := structPtr^.itype;
|
structTypePtr := structPtr^.itype;
|
||||||
CheckConst;
|
|
||||||
end; {else}
|
end; {else}
|
||||||
end {if}
|
end {if}
|
||||||
else if token.kind <> lbracech then
|
else if token.kind <> lbracech then
|
||||||
|
Loading…
Reference in New Issue
Block a user