From 49ddf5abf1b9c34947dbf6f5ba860a30f568d0cf Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Tue, 13 Dec 2016 21:00:08 -0600 Subject: [PATCH] Allow type qualifiers for pointer types to be used in type names (in casts and sizeof expressions). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Expression.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Expression.pas b/Expression.pas index 0001b58..59617e8 100644 --- a/Expression.pas +++ b/Expression.pas @@ -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}