Allow type qualifiers for pointer types to be used in type names (in casts and sizeof expressions).

This fixes the compco09.c test case.

This implementation permits duplicate copies of type qualifiers to appear. This is technically illegal in C90, but it’s legal in C99 and later, and ORCA/C already allows this in other contexts.
This commit is contained in:
Stephen Heumann 2016-12-13 21:00:08 -06:00
parent cf1cd085d8
commit 49ddf5abf1

View File

@ -1438,12 +1438,20 @@ var
{create a pointer type}
NextToken;
AbstractDeclarator;
tp := pointer(Malloc(sizeof(typeRecord)));
tp^.size := cgLongSize;
tp^.saveDisp := 0;
tp^.isConstant := false;
tp^.kind := pointerType;
while token.kind in [constsy,volatilesy] do begin
if token.kind = constsy then
tp^.isConstant := true
else {if token.kind = volatilesy then}
if not doingSizeof then
volatile := true;
NextToken;
end; {while}
AbstractDeclarator;
tp^.fType := tl;
tl := tp;
end {else if token.kind = asteriskch}