diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-09-30 19:46:06 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-09-30 19:46:06 +0000 |
commit | f1f157ae356ebcb4948ab910aad5711ca70c6aaa (patch) | |
tree | e7f9e9ef9055bb20c3907865efd402c942dc4871 /gcc/doc | |
parent | 16ed7fb2c8a7fd227f037804800768994453f6b5 (diff) | |
download | gcc-f1f157ae356ebcb4948ab910aad5711ca70c6aaa.tar.gz |
PR c/24010
* c.opt (Woverride-init): New.
* c-opts.c (c_common_post_options): Default warn_override_init to
extra_warnings.
* c-typeck.c (add_pending_init, output_init_element): Warn for
overriding initializers without side effects.
* doc/invoke.texi (-Woverride-init): Document.
(-Wextra): Update.
testsuite:
* gcc.dg/Woverride-init-1.c, gcc.dg/Woverride-init-2.c,
gcc.dg/Woverride-init-3.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117334 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index d5a3b6bac6b..6d7bc1e1eec 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2876,6 +2876,12 @@ This warning can be independently controlled by @option{-Wmissing-field-initializers}. @item +An initialized field without side effects is overridden when using +designated initializers (@pxref{Designated Inits, , Designated +Initializers}). This warning can be independently controlled by +@option{-Woverride-init}. + +@item A function parameter is declared without a type specifier in K&R-style functions: @@ -3302,6 +3308,18 @@ attribute. @opindex Wno-overflow Do not warn about compile-time overflow in constant expressions. +@item -Woverride-init +@opindex Woverride-init +@opindex W +@opindex Wextra +Warn if an initialized field without side effects is overridden when +using designated initializers (@pxref{Designated Inits, , Designated +Initializers}). + +This warning is included in @option{-Wextra}. To get other +@option{-Wextra} warnings without this one, use @samp{-Wextra +-Wno-override-init}. + @item -Wpacked @opindex Wpacked Warn if a structure is given the packed attribute, but the packed |