mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Scan the param list for problems with void.
This commit is contained in:
parent
c53001800a
commit
80ce179bc2
2 changed files with 27 additions and 0 deletions
|
@ -88,6 +88,7 @@ param_t *_reverse_params (param_t *params, param_t *next);
|
|||
param_t *reverse_params (param_t *params);
|
||||
param_t *copy_params (param_t *params);
|
||||
struct type_s *parse_params (struct type_s *type, param_t *params);
|
||||
param_t *check_params (param_t *params);
|
||||
|
||||
enum storage_class_e;
|
||||
void make_function (struct symbol_s *sym, const char *nice_name,
|
||||
|
|
|
@ -181,6 +181,32 @@ parse_params (type_t *type, param_t *parms)
|
|||
return find_type (&new);
|
||||
}
|
||||
|
||||
param_t *
|
||||
check_params (param_t *params)
|
||||
{
|
||||
int num = 1;
|
||||
param_t *p = params;
|
||||
if (!params)
|
||||
return 0;
|
||||
while (p) {
|
||||
if (p->type == &type_void) {
|
||||
if (p->name) {
|
||||
error (0, "parameter %d ('%s') has incomplete type", num,
|
||||
p->name);
|
||||
p->type = type_default;
|
||||
} else if (num > 1 || p->next) {
|
||||
error (0, "'void' must be the only parameter");
|
||||
p->name = "void";
|
||||
} else {
|
||||
// this is a void function
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
static overloaded_function_t *
|
||||
get_function (const char *name, type_t *type, int overload, int create)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue