mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-02-10 01:31:00 +00:00
Remove some unnecessary parameters and code.
These are not needed after the refactoring of declaration specifier processing.
This commit is contained in:
parent
df029ce06f
commit
08b4f8da3e
2
CC.pas
2
CC.pas
@ -116,7 +116,7 @@ while token.kind <> eofsy do begin {compile the program}
|
|||||||
constsy,ident,asmsy,pascalsy,asmsy,segmentsy,
|
constsy,ident,asmsy,pascalsy,asmsy,segmentsy,
|
||||||
_Static_assertsy])
|
_Static_assertsy])
|
||||||
then
|
then
|
||||||
DoDeclaration(false, false)
|
DoDeclaration(false)
|
||||||
else begin
|
else begin
|
||||||
Error(26);
|
Error(26);
|
||||||
NextToken;
|
NextToken;
|
||||||
|
39
Parser.pas
39
Parser.pas
@ -27,13 +27,12 @@ uses CCommon, Table, MM, CGI, Scanner, Header, Symbol, Expression, Asm;
|
|||||||
|
|
||||||
{---------------------------------------------------------------}
|
{---------------------------------------------------------------}
|
||||||
|
|
||||||
procedure DoDeclaration (doingPrototypes, autoOrRegisterOnly: boolean);
|
procedure DoDeclaration (doingPrototypes: boolean);
|
||||||
|
|
||||||
{ process a variable or function declaration }
|
{ process a variable or function declaration }
|
||||||
{ }
|
{ }
|
||||||
{ parameters: }
|
{ parameters: }
|
||||||
{ doingPrototypes - are we processing a parameter list? }
|
{ doingPrototypes - are we processing a parameter list? }
|
||||||
{ autoOrRegisterOnly - limit storage classes allowed? }
|
|
||||||
|
|
||||||
|
|
||||||
procedure DoStatement;
|
procedure DoStatement;
|
||||||
@ -617,7 +616,7 @@ var
|
|||||||
structsy,unionsy,typedef,voidsy,volatilesy,constsy,
|
structsy,unionsy,typedef,voidsy,volatilesy,constsy,
|
||||||
externsy,staticsy,typedefsy,_Static_assertsy]) then begin
|
externsy,staticsy,typedefsy,_Static_assertsy]) then begin
|
||||||
doingForLoopClause1 := true;
|
doingForLoopClause1 := true;
|
||||||
DoDeclaration(false, true);
|
DoDeclaration(false);
|
||||||
doingForLoopClause1 := false;
|
doingForLoopClause1 := false;
|
||||||
end {if}
|
end {if}
|
||||||
else if token.kind <> semicolonch then begin
|
else if token.kind <> semicolonch then begin
|
||||||
@ -1404,7 +1403,7 @@ var
|
|||||||
typedef,voidsy,volatilesy,constsy])
|
typedef,voidsy,volatilesy,constsy])
|
||||||
then begin
|
then begin
|
||||||
lLastParameter := lastParameter;
|
lLastParameter := lastParameter;
|
||||||
DoDeclaration(true, false);
|
DoDeclaration(true);
|
||||||
lastParameter := lLastParameter;
|
lastParameter := lLastParameter;
|
||||||
if protoType <> nil then begin
|
if protoType <> nil then begin
|
||||||
wp := pointer(Malloc(sizeof(parameterRecord)));
|
wp := pointer(Malloc(sizeof(parameterRecord)));
|
||||||
@ -2539,12 +2538,11 @@ Match(semicolonch, 22);
|
|||||||
end; {DoStaticAssert}
|
end; {DoStaticAssert}
|
||||||
|
|
||||||
|
|
||||||
procedure DeclarationSpecifiers (isConstant: boolean; allowedTokens: tokenSet);
|
procedure DeclarationSpecifiers (allowedTokens: tokenSet);
|
||||||
|
|
||||||
{ handle declaration specifiers or a specifier-qualifier list }
|
{ handle declaration specifiers or a specifier-qualifier list }
|
||||||
{ }
|
{ }
|
||||||
{ parameters: }
|
{ parameters: }
|
||||||
{ isConstant - did we already find a constsy? }
|
|
||||||
{ allowedTokens - specifiers/qualifiers that can be used }
|
{ allowedTokens - specifiers/qualifiers that can be used }
|
||||||
{ }
|
{ }
|
||||||
{ outputs: }
|
{ outputs: }
|
||||||
@ -2574,6 +2572,8 @@ var
|
|||||||
typeSpecifiers: tokenSet; {set of tokens specifying the type}
|
typeSpecifiers: tokenSet; {set of tokens specifying the type}
|
||||||
typeDone: boolean; {no more type specifiers can be accepted}
|
typeDone: boolean; {no more type specifiers can be accepted}
|
||||||
|
|
||||||
|
isConstant: boolean; {did we find a constsy?}
|
||||||
|
|
||||||
myIsForwardDeclared: boolean; {value of isForwardDeclared to generate}
|
myIsForwardDeclared: boolean; {value of isForwardDeclared to generate}
|
||||||
mySkipDeclarator: boolean; {value of skipDeclarator to generate}
|
mySkipDeclarator: boolean; {value of skipDeclarator to generate}
|
||||||
myTypeSpec: typePtr; {value of typeSpec to generate}
|
myTypeSpec: typePtr; {value of typeSpec to generate}
|
||||||
@ -2618,7 +2618,7 @@ var
|
|||||||
goto 1;
|
goto 1;
|
||||||
end; {if}
|
end; {if}
|
||||||
typeSpec := wordPtr; {default type specifier is an integer}
|
typeSpec := wordPtr; {default type specifier is an integer}
|
||||||
DeclarationSpecifiers(false,specifierQualifierListElement);
|
DeclarationSpecifiers(specifierQualifierListElement);
|
||||||
if not skipDeclarator then
|
if not skipDeclarator then
|
||||||
repeat {declare the variables...}
|
repeat {declare the variables...}
|
||||||
if didFlexibleArray then
|
if didFlexibleArray then
|
||||||
@ -2802,6 +2802,7 @@ mySkipDeclarator := false; {declarations are required (so far)}
|
|||||||
myFunctionSpecifiers := [];
|
myFunctionSpecifiers := [];
|
||||||
typeSpecifiers := [];
|
typeSpecifiers := [];
|
||||||
typeDone := false;
|
typeDone := false;
|
||||||
|
isConstant := false;
|
||||||
while token.kind in allowedTokens do begin
|
while token.kind in allowedTokens do begin
|
||||||
case token.kind of
|
case token.kind of
|
||||||
{storage class specifiers}
|
{storage class specifiers}
|
||||||
@ -3113,7 +3114,7 @@ end; {DeclarationSpecifiers}
|
|||||||
|
|
||||||
{-- Externally available subroutines ---------------------------}
|
{-- Externally available subroutines ---------------------------}
|
||||||
|
|
||||||
procedure DoDeclaration {doingPrototypes, autoOrRegisterOnly: boolean};
|
procedure DoDeclaration {doingPrototypes: boolean};
|
||||||
|
|
||||||
{ process a variable or function declaration }
|
{ process a variable or function declaration }
|
||||||
{ }
|
{ }
|
||||||
@ -3124,7 +3125,6 @@ label 1,2,3,4;
|
|||||||
|
|
||||||
var
|
var
|
||||||
done: boolean; {for loop termination}
|
done: boolean; {for loop termination}
|
||||||
foundConstsy: boolean; {did we find a constsy?}
|
|
||||||
fName: stringPtr; {for forming uppercase names}
|
fName: stringPtr; {for forming uppercase names}
|
||||||
i: integer; {loop variable}
|
i: integer; {loop variable}
|
||||||
isAsm: boolean; {has the asm modifier been used?}
|
isAsm: boolean; {has the asm modifier been used?}
|
||||||
@ -3354,7 +3354,6 @@ if token.kind = _Static_assertsy then begin
|
|||||||
lDoingParameters := doingParameters; {record the status}
|
lDoingParameters := doingParameters; {record the status}
|
||||||
noFDefinitions := false; {are function definitions inhibited?}
|
noFDefinitions := false; {are function definitions inhibited?}
|
||||||
typeFound := false; {no explicit type found, yet}
|
typeFound := false; {no explicit type found, yet}
|
||||||
foundConstsy := false; {did not find a constsy}
|
|
||||||
if doingPrototypes then {prototypes implies a parm list}
|
if doingPrototypes then {prototypes implies a parm list}
|
||||||
doingParameters := true
|
doingParameters := true
|
||||||
else
|
else
|
||||||
@ -3365,23 +3364,13 @@ if not doingFunction then {handle any segment statements}
|
|||||||
while token.kind = segmentsy do
|
while token.kind = segmentsy do
|
||||||
SegmentStatement;
|
SegmentStatement;
|
||||||
inhibitHeader := true; {block imbedded includes in headers}
|
inhibitHeader := true; {block imbedded includes in headers}
|
||||||
if token.kind in [constsy,volatilesy] {handle leading constsy, volatile}
|
|
||||||
then begin
|
|
||||||
while token.kind in [constsy,volatilesy] do begin
|
|
||||||
if token.kind = constsy then
|
|
||||||
foundConstsy := true
|
|
||||||
else
|
|
||||||
volatile := true;
|
|
||||||
NextToken;
|
|
||||||
end; {while}
|
|
||||||
end; {if}
|
|
||||||
lUseGlobalPool := useGlobalPool;
|
lUseGlobalPool := useGlobalPool;
|
||||||
storageClass := ident;
|
storageClass := ident;
|
||||||
typeSpec := wordPtr; {default type specifier is an integer}
|
typeSpec := wordPtr; {default type specifier is an integer}
|
||||||
{handle a TypeSpecifier/declarator}
|
{handle a TypeSpecifier/declarator}
|
||||||
if token.kind in declarationSpecifiersElement then begin
|
if token.kind in declarationSpecifiersElement then begin
|
||||||
typeFound := true;
|
typeFound := true;
|
||||||
DeclarationSpecifiers(foundConstsy, declarationSpecifiersElement);
|
DeclarationSpecifiers(declarationSpecifiersElement);
|
||||||
isPascal := pascalsy in functionSpecifiers;
|
isPascal := pascalsy in functionSpecifiers;
|
||||||
isAsm := asmsy in functionSpecifiers;
|
isAsm := asmsy in functionSpecifiers;
|
||||||
isInline := inlinesy in functionSpecifiers;
|
isInline := inlinesy in functionSpecifiers;
|
||||||
@ -3554,7 +3543,7 @@ if isFunction then begin
|
|||||||
floatsy,doublesy,compsy,extendedsy,enumsy,
|
floatsy,doublesy,compsy,extendedsy,enumsy,
|
||||||
structsy,unionsy,typedef,voidsy,volatilesy,
|
structsy,unionsy,typedef,voidsy,volatilesy,
|
||||||
constsy,ident]) then
|
constsy,ident]) then
|
||||||
DoDeclaration(false, false)
|
DoDeclaration(false)
|
||||||
else begin
|
else begin
|
||||||
Error(27);
|
Error(27);
|
||||||
NextToken;
|
NextToken;
|
||||||
@ -3921,7 +3910,7 @@ var
|
|||||||
begin {TypeName}
|
begin {TypeName}
|
||||||
{read and process the type specifier}
|
{read and process the type specifier}
|
||||||
typeSpec := wordPtr;
|
typeSpec := wordPtr;
|
||||||
DeclarationSpecifiers(false,specifierQualifierListElement);
|
DeclarationSpecifiers(specifierQualifierListElement);
|
||||||
|
|
||||||
{handle the abstract-declarator part}
|
{handle the abstract-declarator part}
|
||||||
tl := nil; {no types so far}
|
tl := nil; {no types so far}
|
||||||
@ -3965,7 +3954,7 @@ case statementList^.kind of
|
|||||||
then begin
|
then begin
|
||||||
hasStatementNext := false;
|
hasStatementNext := false;
|
||||||
if token.kind <> typedef then
|
if token.kind <> typedef then
|
||||||
DoDeclaration(false, false)
|
DoDeclaration(false)
|
||||||
else begin
|
else begin
|
||||||
lToken := token;
|
lToken := token;
|
||||||
lPrintMacroExpansions := printMacroExpansions; {inhibit token echo}
|
lPrintMacroExpansions := printMacroExpansions; {inhibit token echo}
|
||||||
@ -3976,7 +3965,7 @@ case statementList^.kind of
|
|||||||
PutBackToken(nToken, false);
|
PutBackToken(nToken, false);
|
||||||
token := lToken;
|
token := lToken;
|
||||||
if nToken.kind <> colonch then
|
if nToken.kind <> colonch then
|
||||||
DoDeclaration(false, false)
|
DoDeclaration(false)
|
||||||
else
|
else
|
||||||
hasStatementNext := true;
|
hasStatementNext := true;
|
||||||
end {else}
|
end {else}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user