mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-02-07 11:30:54 +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}
|
||||
done,done2: boolean; {for loop termination}
|
||||
isPtr: boolean; {is the parenthesized expr a ptr?}
|
||||
isVoid: boolean; {is the type specifier void?}
|
||||
wp: parameterPtr; {used to build prototype var list}
|
||||
pvar: identPtr; {work pointer}
|
||||
tPtr2: typePtr; {work pointer}
|
||||
@ -1309,7 +1310,12 @@ var
|
||||
typeStack := ttPtr;
|
||||
ttPtr^.typeDef := tPtr2;
|
||||
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;
|
||||
printMacroExpansions := false;
|
||||
NextToken;
|
||||
|
Loading…
x
Reference in New Issue
Block a user