diff options
author | Michael Forney <mforney@mforney.org> | 2019-04-14 13:09:02 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-04-14 13:09:02 -0700 |
commit | b6e582d2842aa21e24a70675b760bba331dc0d72 (patch) | |
tree | a062aa83b3570188d8f5b957ec4b0de1eecc637d | |
parent | ea4a14c7a4943498f49c26824d68a8d4776c5ddc (diff) |
init: Error on bit-field initializers for now
-rw-r--r-- | init.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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) |