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 b6e582d2842aa21e24a70675b760bba331dc0d72
parent ea4a14c7a4943498f49c26824d68a8d4776c5ddc
Author: Michael Forney <mforney@mforney.org>
Date:   Sun, 14 Apr 2019 13:09:02 -0700

init: Error on bit-field initializers for now

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

diff --git a/init.c b/init.c @@ -197,6 +197,12 @@ advance(struct initparser *p) } } +static bool +isbitfield(struct member *m) +{ + return m->bits.before || m->bits.after; +} + /* 6.7.9 Initialization */ struct init * parseinit(struct scope *s, struct type *t) @@ -259,6 +265,11 @@ parseinit(struct scope *s, struct type *t) focus(&p); } add: + if (p.sub > p.obj) { + t = p.sub[-1].type; + if ((t->kind == TYPESTRUCT || t->kind == TYPEUNION) && isbitfield(p.sub[-1].mem)) + error(&tok.loc, "bit-field initializers are not yet supported"); + } initadd(&init, mkinit(p.sub->offset, p.sub->offset + p.sub->type->size, expr)); for (;;) { if (p.sub->type->kind == TYPEARRAY && p.sub->type->incomplete)