On Sun, Oct 14, 2012 at 8:00 PM, Peter Maydell <peter.mayd...@linaro.org> wrote: > Disable clang's initializer-overrides warnings, as QEMU makes significant > use of the pattern of initializing an array with a range-based default > entry like > [0 ... 0x1ff] = { GPIO_NONE, 0 } > followed by specific entries which override that default, and clang > would otherwise warn "initializer overrides prior initialization of > this subobject" when it encountered the specific entry. > > Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> > --- > This is basically a judgement that our coding style is legitimate > and the compiler is being overly alarmist. I don't think we would > benefit from trying to silence the warnings and I can't think of > a clean way of doing so... > > NB that gcc will happily ignore -Wno-wombat warnings that it doesn't > happen to recognize. (For compilers that don't accept-and-ignore the flag > configure will identify this and not use it.) > > Blue Swirl previously submitted a patch which enabled this flag > (among others): > http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg04203.html
In my version, Clang flags were separate from GCC flags. I think it would be better to run different tests for each compiler in the future, that lets GCC avoid Clang flag -ffoobar which does not have desirable effect to GCC and vice versa. I'd also like to handle flags for sparse checker the same way. > > I haven't found the other two flags in that patch to be required. > > configure | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/configure b/configure > index 353d788..f78cfc5 100755 > --- a/configure > +++ b/configure > @@ -1187,6 +1187,7 @@ gcc_flags="-Wold-style-declaration > -Wold-style-definition -Wtype-limits" > gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers > $gcc_flags" > gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" > gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags" > +gcc_flags="-Wno-initializer-overrides $gcc_flags" > # Note that we do not add -Werror to gcc_flags here, because that would > # enable it for all configure tests. If a configure test failed due > # to -Werror this would just silently disable some features, > -- > 1.7.11.4 >