mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[qfcc] Report errors for objects in function decls
The number of time's I've forgotten the * in a declaration in objective code (probably thanks to C#'s lack of them).
This commit is contained in:
parent
b544321609
commit
80d9401eee
1 changed files with 10 additions and 0 deletions
|
@ -46,6 +46,7 @@
|
|||
|
||||
#include "qfcc.h"
|
||||
|
||||
#include "class.h"
|
||||
#include "codespace.h"
|
||||
#include "debug.h"
|
||||
#include "def.h"
|
||||
|
@ -157,6 +158,11 @@ parse_params (type_t *type, param_t *parms)
|
|||
type_t *new;
|
||||
int count = 0;
|
||||
|
||||
if (type && obj_is_class (type)) {
|
||||
error (0, "cannot return an object (forgot *?)");
|
||||
type = &type_id;
|
||||
}
|
||||
|
||||
new = new_type ();
|
||||
new->type = ev_func;
|
||||
new->alignment = 1;
|
||||
|
@ -177,6 +183,10 @@ parse_params (type_t *type, param_t *parms)
|
|||
internal_error (0, 0);
|
||||
new->t.func.num_params = -(new->t.func.num_params + 1);
|
||||
} else if (p->type) {
|
||||
if (obj_is_class (p->type)) {
|
||||
error (0, "cannot use an object as a parameter (forgot *?)");
|
||||
p->type = &type_id;
|
||||
}
|
||||
new->t.func.param_types[new->t.func.num_params] = p->type;
|
||||
new->t.func.num_params++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue