"Initializer entry defined twice" should not trigger with zero-size fields
commit8aed19aea597dd467e0de3402ed7e6feae70394c
authorJosh Triplett <josh@freedesktop.org>
Wed, 13 Sep 2006 22:01:15 +0000 (13 15:01 -0700)
committerJosh Triplett <josh@freedesktop.org>
Wed, 13 Sep 2006 22:14:00 +0000 (13 15:14 -0700)
tree0b741efa1f3ce367290c4e171ac4fcd48d0aa9b7
parent27ff96a96c95d0171f3215458dd5a2ebc4bfafbf
"Initializer entry defined twice" should not trigger with zero-size fields

If a field of a structure has size 0 (which happens with an empty struct), the
subsequent field will have the same offset.  Assigning to both thus triggers
the "Initializer entry defined twice" error, which should not happen.  Change
verify_nonoverlapping to not warn about overlaps where the first field has
size 0.

Add a validation file (validation/initializer-entry-defined-twice.c) for this
warning, which covers two cases where it should trigger (same struct field
twice; two fields of a union) and this case where it should not.

Signed-off-by: Josh Triplett <josh@freedesktop.org>
expand.c
validation/initializer-entry-defined-twice.c [new file with mode: 0644]