ignore whole-range overlapping initializer
commitce83abe23b09d2d929f882dc487da8b0b5420766
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Wed, 22 Feb 2017 15:30:06 +0000 (22 16:30 +0100)
committerChristopher Li <sparse@chrisli.org>
Fri, 3 Mar 2017 16:45:38 +0000 (4 00:45 +0800)
tree97eed15c90e9c2dd25b8df948bcd793302857ddb
parent7788da8bcf48254e62f46e4060f6fcbc23ba6c0f
ignore whole-range overlapping initializer

When an array is initialized, it may be convenient to first
initialize all entries with some default value via the
'[a ... b]' notation and then override some of these entries
with a non-default value. Unfortunately, this, of course,
is not compatible with the default warning flag '-Woverride-init'.

Fix this by introducing an exception to the usual detection
of overlapping initializers which, only for what concerns this
warning, ignore an '[a ... b]' entry if:
- it is the first one
- it covers the whole range of the array.

If needed, the previous ehaviour can be restored by using a new
warning flag, disabled by default: '-Woverride-init-whole-range'.

Suggested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
expand.c
lib.c
lib.h
validation/field-override.c