mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-08-15 07:27:27 +00:00
Avoid generating invalid .sym files if header ends with a partial prototyped function decl.
This could happen because the nested calls to DoDeclaration for the parameters would set inhibitHeader to false.
This commit is contained in:
10
Parser.pas
10
Parser.pas
@@ -3496,6 +3496,7 @@ var
|
|||||||
isPascal: boolean; {has the pascal modifier been used?}
|
isPascal: boolean; {has the pascal modifier been used?}
|
||||||
alignmentSpecified: boolean; {was an alignment explicitly specified?}
|
alignmentSpecified: boolean; {was an alignment explicitly specified?}
|
||||||
lDoingParameters: boolean; {local copy of doingParameters}
|
lDoingParameters: boolean; {local copy of doingParameters}
|
||||||
|
lInhibitHeader: boolean; {local copy of inhibitHeader}
|
||||||
lp,tlp,tlp2: identPtr; {for tracing parameter list}
|
lp,tlp,tlp2: identPtr; {for tracing parameter list}
|
||||||
lUseGlobalPool: boolean; {local copy of useGlobalPool}
|
lUseGlobalPool: boolean; {local copy of useGlobalPool}
|
||||||
nextPdisp: integer; {for calculating parameter disps}
|
nextPdisp: integer; {for calculating parameter disps}
|
||||||
@@ -3699,6 +3700,7 @@ var
|
|||||||
|
|
||||||
|
|
||||||
begin {DoDeclaration}
|
begin {DoDeclaration}
|
||||||
|
lInhibitHeader:= inhibitHeader;
|
||||||
inhibitHeader := true; {block imbedded includes in headers}
|
inhibitHeader := true; {block imbedded includes in headers}
|
||||||
if token.kind = _Static_assertsy then begin
|
if token.kind = _Static_assertsy then begin
|
||||||
DoStaticAssert;
|
DoStaticAssert;
|
||||||
@@ -3734,7 +3736,7 @@ isFunction := false; {assume it's not a function}
|
|||||||
variable := nil;
|
variable := nil;
|
||||||
Declarator(declSpecifiers, variable, variableSpace, doingPrototypes);
|
Declarator(declSpecifiers, variable, variableSpace, doingPrototypes);
|
||||||
if variable = nil then begin
|
if variable = nil then begin
|
||||||
inhibitHeader := false;
|
inhibitHeader := lInhibitHeader;
|
||||||
if token.kind = semicolonch then begin
|
if token.kind = semicolonch then begin
|
||||||
if not first then
|
if not first then
|
||||||
Error(176);
|
Error(176);
|
||||||
@@ -3830,7 +3832,7 @@ if isFunction then begin
|
|||||||
end; {with}
|
end; {with}
|
||||||
doingParameters := doingPrototypes; {not doing parms any more}
|
doingParameters := doingPrototypes; {not doing parms any more}
|
||||||
if token.kind = semicolonch then begin
|
if token.kind = semicolonch then begin
|
||||||
inhibitHeader := false;
|
inhibitHeader := lInhibitHeader;
|
||||||
NextToken; {skip the trailing semicolon}
|
NextToken; {skip the trailing semicolon}
|
||||||
end {if}
|
end {if}
|
||||||
else if (token.kind = commach) and (not doingPrototypes) then begin
|
else if (token.kind = commach) and (not doingPrototypes) then begin
|
||||||
@@ -4085,7 +4087,7 @@ else {if not isFunction then} begin
|
|||||||
protoType := protoVariable^.iType;
|
protoType := protoVariable^.iType;
|
||||||
end {if}
|
end {if}
|
||||||
else begin
|
else begin
|
||||||
inhibitHeader := false;
|
inhibitHeader := lInhibitHeader;
|
||||||
if token.kind = semicolonch then {must end with a semicolon}
|
if token.kind = semicolonch then {must end with a semicolon}
|
||||||
NextToken
|
NextToken
|
||||||
else begin
|
else begin
|
||||||
@@ -4098,7 +4100,7 @@ else {if not isFunction then} begin
|
|||||||
doingParameters := lDoingParameters; {restore the status}
|
doingParameters := lDoingParameters; {restore the status}
|
||||||
useGlobalPool := lUseGlobalPool;
|
useGlobalPool := lUseGlobalPool;
|
||||||
4:
|
4:
|
||||||
inhibitHeader := false;
|
inhibitHeader := lInhibitHeader;
|
||||||
end; {DoDeclaration}
|
end; {DoDeclaration}
|
||||||
|
|
||||||
|
|
||||||
|
2
cc.notes
2
cc.notes
@@ -1974,7 +1974,7 @@ int foo(int[42]);
|
|||||||
|
|
||||||
219. If a function is first declared as "static" and then subsequently redeclared or defined as "extern" or with no storage-class specifier, it should be private to the source file, the same as if it was just declared "static".
|
219. If a function is first declared as "static" and then subsequently redeclared or defined as "extern" or with no storage-class specifier, it should be private to the source file, the same as if it was just declared "static".
|
||||||
|
|
||||||
220. A header that ended with a partial declaration would not be represented correctly in the .sym file. This could cause errors or misbehavior on subsequent compiles.
|
220. In certain cases where a header starts or ends in the middle of a declaration, it would not be represented correctly in the .sym file. This could cause errors or misbehavior on subsequent compiles.
|
||||||
|
|
||||||
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user