{
if (arg->type->type == PSI_T_FUNCTION) {
psi_decl_type_dump(fd, arg->type->real.func->func->type, level);
+ if (arg->type->real.func->func->type->type == PSI_T_FUNCTION) {
+ dprintf(fd, "(");
+ }
dprintf(fd, " %s(*%s)",
psi_t_indirection(arg->var->pointer_level - !! arg->var->array_size),
arg->var->name);
}
}
dprintf(fd, ")");
+ if (arg->type->real.func->func->type->type == PSI_T_FUNCTION) {
+ struct psi_decl *decl = arg->type->real.func->func->type->real.func;
+
+ dprintf(fd, "(");
+ if (decl->args) {
+ size_t i;
+ struct psi_decl_arg *arg;
+
+ for (i = 0; psi_plist_get(decl->args, i, &arg); ++i) {
+ if (i) {
+ dprintf(fd, ", ");
+ }
+ psi_decl_arg_dump(fd, arg, 0);
+ }
+ if (decl->varargs) {
+ dprintf(fd, ", ...");
+ }
+ }
+ dprintf(fd, "))");
+ }
if (arg->var->array_size) {
dprintf(fd, "[%u]", arg->var->array_size);
}
}
bool psi_decl_arg_validate(struct psi_data *data, struct psi_decl_arg *arg,
- struct psi_validate_stack *type_stack)
+ struct psi_validate_scope *scope)
{
- if (!psi_decl_type_validate(data, arg->type, arg->var->pointer_level, type_stack)) {
+ if (!psi_decl_type_validate(data, arg->type, arg, scope)) {
if (!arg->var->pointer_level) {
data->error(data, arg->type->token, PSI_WARNING,
"Cannot use '%s' as type for '%s'%s%s", arg->type->name,
}
bool psi_decl_arg_validate_typedef(struct psi_data *data,
- struct psi_decl_arg *def, struct psi_validate_stack *type_stack)
+ struct psi_decl_arg *def, struct psi_validate_scope *scope)
{
- if (psi_validate_stack_has_type(type_stack, def->var->name)) {
+ if (psi_validate_scope_has_type(scope, def->var->name)) {
return true;
}
- psi_validate_stack_add_type(type_stack, def->var->name, def);
+ psi_validate_scope_add_type(scope, def->var->name, def);
if (def->type->type == PSI_T_VOID) {
if (def->var->pointer_level) {
"Type '%s' cannot be aliased to 'void'", def->type->name);
return false;
}
- } else if (!psi_decl_type_validate(data, def->type, def->var->pointer_level, type_stack)) {
+ } else if (!psi_decl_type_validate(data, def->type, def, scope)) {
const char *pre;
switch (def->type->type) {