mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-06 12:29:33 +00:00
Allow a typedef'd version of "void" to be used in the parameter list of a function taking no arguments.
For example, the following is now allowed: typedef void v; void foo(v) {} This appears to be permitted under at least C99 and C11 (the C89 wording is less clear), and is accepted by other modern compilers.
This commit is contained in:
parent
65009db03f
commit
c588eda94e
|
@ -1169,6 +1169,7 @@ var
|
||||||
cp,cpList: pointerListPtr; {pointer list}
|
cp,cpList: pointerListPtr; {pointer list}
|
||||||
done,done2: boolean; {for loop termination}
|
done,done2: boolean; {for loop termination}
|
||||||
isPtr: boolean; {is the parenthesized expr a ptr?}
|
isPtr: boolean; {is the parenthesized expr a ptr?}
|
||||||
|
isVoid: boolean; {is the type specifier void?}
|
||||||
wp: parameterPtr; {used to build prototype var list}
|
wp: parameterPtr; {used to build prototype var list}
|
||||||
pvar: identPtr; {work pointer}
|
pvar: identPtr; {work pointer}
|
||||||
tPtr2: typePtr; {work pointer}
|
tPtr2: typePtr; {work pointer}
|
||||||
|
@ -1309,7 +1310,12 @@ var
|
||||||
typeStack := ttPtr;
|
typeStack := ttPtr;
|
||||||
ttPtr^.typeDef := tPtr2;
|
ttPtr^.typeDef := tPtr2;
|
||||||
NextToken; {skip the '(' token}
|
NextToken; {skip the '(' token}
|
||||||
if token.kind = voidsy then begin {check for a void prototype}
|
isVoid := token.kind = voidsy;
|
||||||
|
if token.kind = typedef then
|
||||||
|
if token.symbolPtr^.itype^.kind = scalarType then
|
||||||
|
if token.symbolPtr^.itype^.baseType = cgVoid then
|
||||||
|
isVoid := true;
|
||||||
|
if isVoid then begin {check for a void prototype}
|
||||||
lPrintMacroExpansions := printMacroExpansions;
|
lPrintMacroExpansions := printMacroExpansions;
|
||||||
printMacroExpansions := false;
|
printMacroExpansions := false;
|
||||||
NextToken;
|
NextToken;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user