mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-09-27 18:58:34 +00:00
Simplify some declaration-processing logic.
This should not cause any functional change.
This commit is contained in:
parent
9a7dc23c5d
commit
7d6b732d23
23
Parser.pas
23
Parser.pas
@ -189,7 +189,6 @@ var
|
||||
{ referencing a forward struct/union? }
|
||||
isFunction: boolean; {is the declaration a function?}
|
||||
returnLabel: integer; {label for exit point}
|
||||
skipDeclarator: boolean; {for enum,struct,union with no declarator}
|
||||
statementList: statementPtr; {list of open statements}
|
||||
savedVolatile: boolean; {saved copy of volatile}
|
||||
doingForLoopClause1: boolean; {doing the first clause of a for loop?}
|
||||
@ -2760,8 +2759,6 @@ procedure DeclarationSpecifiers (var declSpecifiers: declSpecifiersRecord;
|
||||
{ outputs: }
|
||||
{ isForwardDeclared - is the field list component }
|
||||
{ referencing a forward struct/union? }
|
||||
{ skipDeclarator - for enum,struct,union with no }
|
||||
{ declarator }
|
||||
{ declaredTagOrEnumConst - set if a tag or an enum const }
|
||||
{ is declared (otherwise unchanged) }
|
||||
|
||||
@ -2787,7 +2784,6 @@ var
|
||||
typeQualifiers: typeQualifierSet; {set of type qualifiers found}
|
||||
|
||||
myIsForwardDeclared: boolean; {value of isForwardDeclared to generate}
|
||||
mySkipDeclarator: boolean; {value of skipDeclarator to generate}
|
||||
myTypeSpec: typePtr; {value of typeSpec to generate}
|
||||
myDeclarationModifiers: tokenSet; {all modifiers in this declaration}
|
||||
myStorageClass: tokenEnum; {storage class}
|
||||
@ -3095,7 +3091,6 @@ var
|
||||
begin {DeclarationSpecifiers}
|
||||
myTypeSpec := nil;
|
||||
myIsForwardDeclared := false; {not doing a forward reference (yet)}
|
||||
mySkipDeclarator := false; {declarations are required (so far)}
|
||||
myDeclarationModifiers := [];
|
||||
myStorageClass := ident;
|
||||
typeQualifiers := [];
|
||||
@ -3308,8 +3303,7 @@ while token.kind in allowedTokens do begin
|
||||
SkipStatement;
|
||||
end; {else}
|
||||
end; {if}
|
||||
1: mySkipDeclarator := token.kind = semicolonch;
|
||||
myTypeSpec := intPtr;
|
||||
1: myTypeSpec := intPtr;
|
||||
typeDone := true;
|
||||
end;
|
||||
|
||||
@ -3412,7 +3406,6 @@ while token.kind in allowedTokens do begin
|
||||
if globalStruct then
|
||||
useGlobalPool := lUseGlobalPool;
|
||||
myTypeSpec := structTypePtr;
|
||||
mySkipDeclarator := token.kind = semicolonch;
|
||||
if tKind = structType then
|
||||
myDeclarationModifiers := myDeclarationModifiers + [structsy]
|
||||
else
|
||||
@ -3461,7 +3454,6 @@ while token.kind in allowedTokens do begin
|
||||
end; {while}
|
||||
3:
|
||||
isForwardDeclared := myIsForwardDeclared;
|
||||
skipDeclarator := mySkipDeclarator;
|
||||
declSpecifiers.declarationModifiers := myDeclarationModifiers;
|
||||
if _Thread_localsy in myDeclarationModifiers then
|
||||
if myStorageClass = ident then
|
||||
@ -3490,7 +3482,6 @@ procedure DoDeclaration {doingPrototypes: boolean};
|
||||
label 1,2,3,4;
|
||||
|
||||
var
|
||||
done: boolean; {for loop termination}
|
||||
fName: stringPtr; {for forming uppercase names}
|
||||
i: integer; {loop variable}
|
||||
isAsm: boolean; {has the asm modifier been used?}
|
||||
@ -3734,7 +3725,6 @@ if token.kind = semicolonch then
|
||||
if not doingPrototypes then
|
||||
if not declaredTagOrEnumConst then
|
||||
Error(176);
|
||||
if not skipDeclarator then begin
|
||||
variable := nil;
|
||||
Declarator(declSpecifiers, variable, variableSpace, doingPrototypes);
|
||||
if variable = nil then begin
|
||||
@ -3747,7 +3737,6 @@ if not skipDeclarator then begin
|
||||
end; {else}
|
||||
goto 1;
|
||||
end; {if}
|
||||
end; {if}
|
||||
|
||||
{make sure variables have some type info}
|
||||
if isFunction then begin
|
||||
@ -4052,8 +4041,6 @@ else {if not isFunction then} begin
|
||||
if alignmentSpecified then
|
||||
if declSpecifiers.storageClass in [typedefsy,registersy] then
|
||||
Error(142);
|
||||
if not SkipDeclarator then
|
||||
repeat
|
||||
if isPascal then
|
||||
variable^.itype := MakePascalType(variable^.itype);
|
||||
if isInline then
|
||||
@ -4089,8 +4076,7 @@ else {if not isFunction then} begin
|
||||
AutoInit(variable, startLine, false); {initialize auto variable}
|
||||
end; {if}
|
||||
if (token.kind = commach) and (not doingPrototypes) then begin
|
||||
done := false; {allow multiple variables on one line}
|
||||
NextToken;
|
||||
NextToken; {allow multiple variables on one line}
|
||||
variable := nil;
|
||||
Declarator(declSpecifiers, variable, variableSpace, doingPrototypes);
|
||||
if variable = nil then begin
|
||||
@ -4103,10 +4089,7 @@ else {if not isFunction then} begin
|
||||
goto 1;
|
||||
end; {if}
|
||||
goto 3;
|
||||
end {if}
|
||||
else
|
||||
done := true;
|
||||
until done or (token.kind = eofsy);
|
||||
end; {if}
|
||||
if doingPrototypes then begin
|
||||
protoVariable := variable; {make the var available to Declarator}
|
||||
if protoVariable = nil then
|
||||
|
Loading…
Reference in New Issue
Block a user