Valid-paramdecl
Validate a parameter declaration.
- Signature
(valid-paramdecl paramdecl fundef-params-p table ienv)
→
(mv erp new-paramdecl return-types new-table)
- Arguments
- paramdecl — Guard (paramdeclp paramdecl).
- fundef-params-p — Guard (booleanp fundef-params-p).
- table — Guard (valid-tablep table).
- ienv — Guard (ienvp ienv).
- Returns
- new-paramdecl — Type (paramdeclp new-paramdecl).
- return-types — Type (type-setp return-types).
- new-table — Type (valid-tablep new-table).
The fundef-params-p input is t iff
we are validating the parameter of a function definition.
We validate the declaration specifiers,
which results in a type,
a list of storage class specifiers,
and a possibly updated table.
We ensure that the list of storage class specifiers
is either empty or the singleton register [C:6.7.6.3/2].
We validate the parameter declarator,
ensuring that it has an identifier if fundef-params-p is t
[C:6.9.1/5].
We adjust the type if necessary [C:6.7.6.3/7] [C:6.7.6.3/8].
If the parameter declarator has an identifier,
we extend the validation table with it,
unless there is already an ordinary identifier
with the same name in the same (i.e. current) scope;
since parameters have no linkage [C:6.2.2/6],
they can be only declared once in the same scope [C:6.7/3].
Parameters of function declarations have no linkage [C:6.2.2/6].
Since storage is allocated for them when the function is called,
they are considered defined [C:6.7/5].