cproc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/cproc
Log | Files | Refs | Submodules | README | LICENSE

commit fed14a31ca554b54c4f2eebefd09aeaeda782aba
parent 8f75d2840daf36870bee142709530586d138ce63
Author: Michael Forney <mforney@mforney.org>
Date:   Sun, 17 Feb 2019 12:33:32 -0800

Disallow functions returning array or function

Diffstat:
Mdecl.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/decl.c b/decl.c @@ -544,6 +544,12 @@ declarator(struct scope *s, struct type *base, char **name, bool allowabstract) t = listelement(l, struct type, link); t->base = base; switch (t->kind) { + case TYPEFUNC: + if (base->kind == TYPEFUNC) + error(&tok.loc, "function declarator specifies function return type"); + if (base->kind == TYPEARRAY) + error(&tok.loc, "function declarator specifies array return type"); + break; case TYPEARRAY: t->align = base->align; t->size = base->size * t->array.length; // XXX: overflow?