mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-17 12:32:07 +00:00
Prevent spurious errors about structs containing function pointers.
If a struct contained a function pointer with a prototyped parameter list, processing the parameters could reset the declaredTagOrEnumConst flag, potentially leading to a spurious error, as in this example: struct S { int (*f)(int); }; This also gives a better error for structs declared as containing functions.
This commit is contained in:
parent
a864954353
commit
afe40c0f67
@ -1330,6 +1330,7 @@ var
|
||||
lLastParameter: identPtr; {next parameter to process}
|
||||
luseGlobalPool: boolean; {local copy of useGlobalPool}
|
||||
lSuppressMacroExpansions: boolean;{local copy of suppressMacroExpansions}
|
||||
ldeclaredTagOrEnumConst: boolean; {local copy of declaredTagOrEnumConst}
|
||||
|
||||
begin {StackDeclarations}
|
||||
lastWasIdentifier := false; {used to see if the declaration is a fn}
|
||||
@ -1484,9 +1485,12 @@ var
|
||||
prototyped := true; {it is prototyped}
|
||||
repeat {collect the declarations}
|
||||
if token.kind in declarationSpecifiersElement then begin
|
||||
ldeclaredTagOrEnumConst := declaredTagOrEnumConst;
|
||||
lLastParameter := lastParameter;
|
||||
DoDeclaration(true);
|
||||
lastParameter := lLastParameter;
|
||||
declaredTagOrEnumConst :=
|
||||
ldeclaredTagOrEnumConst or declaredTagOrEnumConst;
|
||||
if protoType <> nil then begin
|
||||
wp := pointer(Malloc(sizeof(parameterRecord)));
|
||||
wp^.next := parameterList;
|
||||
|
@ -693,7 +693,7 @@ if list or (numErr <> 0) then begin
|
||||
114: msg := @'a function call was made to a non-function';
|
||||
115: msg := @'illegal bit field declaration';
|
||||
116: msg := @'missing field name';
|
||||
117: msg := @'field cannot have incomplete type';
|
||||
117: msg := @'field cannot have incomplete or function type';
|
||||
118: msg := @'flexible array must be last member of structure';
|
||||
119: msg := @'inline specifier is only allowed on functions';
|
||||
120: msg := @'non-static inline functions are not supported';
|
||||
|
Loading…
x
Reference in New Issue
Block a user