diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-04-06 15:50:23 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-05-19 05:35:01 +0200 |
| commit | b1672eab399fdce2c050e8aa07767489a2071981 (patch) | |
| tree | 7a7edd535f4747c5e8f84dc6f1ab3181e50746a3 /parse.h | |
| parent | 816e13f57644116daf20debe548e3e53ec4e5073 (diff) | |
| download | sparse-dev-b1672eab399fdce2c050e8aa07767489a2071981.tar.gz | |
fix implicit zero initializer.
The C standard requires that, when initializing an aggregate, all
fieds not explicitly initialized shall be implicity zero-initialized
(more exactly "the same as objects that have static storage duration"
[6.7.9.21]).
Until now sparse didn't did this.
Fix this (when an initializer is present and the object not a scalar)
by first storing zeroes in the whole object before doing the
initialization of each fields explicitly initialized.
Note 1: this patch initialize the *whole* aggregate while the
standard only requires that existing fields are initialized.
Thanks to Linus to notice this.
Note 2: this implicit initialization is not needed if all fields are
explicitly initialized but is done anyway, for the moment.
Note 3: the code simplify nicely when there is a single field that is
initialized, much less so when there is several ones.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'parse.h')
0 files changed, 0 insertions, 0 deletions
