doc: mention handling of {0} in -Wmissing-field-initializers (PR 71250)

Submitted by Alexander Monakov on April 19, 2017, 1:12 p.m.

Details

Message ID alpine.LNX.2.20.13.1704191559450.26181@monopod.intra.ispras.ru
State New
Headers show

Commit Message

Alexander Monakov April 19, 2017, 1:12 p.m.
Hi,

PR 71250 asks to explicitly document that -Wmissing-field-initializers warning
was enhanced some time ago to suppress warnings on uses of the universal zero
initializer { 0 } in C language.  The documentation already calls out that the
warning is silenced in C++ for '{ }', the patch adds the corresponding C example
just before that.

Sanity-checked with 'make info html', ok to apply?

Alexander

	PR other/71250
	* doc/invoke.texi (-Wmissing-field-initializers): Mention that warning
	is suppressed for '{ 0 }' in C.

Comments

Jeff Law April 19, 2017, 2:51 p.m.
On 04/19/2017 07:12 AM, Alexander Monakov wrote:
> Hi,
> 
> PR 71250 asks to explicitly document that -Wmissing-field-initializers warning
> was enhanced some time ago to suppress warnings on uses of the universal zero
> initializer { 0 } in C language.  The documentation already calls out that the
> warning is silenced in C++ for '{ }', the patch adds the corresponding C example
> just before that.
> 
> Sanity-checked with 'make info html', ok to apply?
> 
> Alexander
> 
> 	PR other/71250
> 	* doc/invoke.texi (-Wmissing-field-initializers): Mention that warning
> 	is suppressed for '{ 0 }' in C.
OK.
jeff

Patch hide | download patch | download mbox

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 8d3821e..726d4c1 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -6220,7 +6220,15 @@  struct s @{ int f, g, h; @};
 struct s x = @{ .f = 3, .g = 4 @};
 @end smallexample

-In C++ this option does not warn either about the empty @{ @}
+In C this option does not warn about the universal zero initializer
+@samp{@{ 0 @}}:
+
+@smallexample
+struct s @{ int f, g, h; @};
+struct s x = @{ 0 @};
+@end smallexample
+
+Likewise, in C++ this option does not warn about the empty @{ @}
 initializer, for example:

 @smallexample