[doc,committed] Clarify docs for designated initializers of unions

Message ID 373378e4-8613-8bbe-3f30-cf31cfa6caf4@codesourcery.com
State New
Headers show
Series
  • [doc,committed] Clarify docs for designated initializers of unions
Related show

Commit Message

Sandra Loosemore Nov. 23, 2018, 5:37 a.m.
I've checked in this patch for PR 53608.  It's derived from the text 
suggested in the issue.

-Sandra

Patch

Index: gcc/doc/extend.texi
===================================================================
--- gcc/doc/extend.texi	(revision 266400)
+++ gcc/doc/extend.texi	(working copy)
@@ -2104,7 +2104,7 @@  Another syntax that has the same meaning
 struct point p = @{ y: yvalue, x: xvalue @};
 @end smallexample
 
-Omitted field members are implicitly initialized the same as objects
+Omitted fields are implicitly initialized the same as for objects
 that have static storage duration.
 
 @cindex designators
@@ -2162,11 +2162,13 @@  example, with the @samp{struct point} de
 struct point ptarray[10] = @{ [2].y = yv2, [2].x = xv2, [0].x = xv0 @};
 @end smallexample
 
-@noindent
-If the same field is initialized multiple times, it has the value from
-the last initialization.  If any such overridden initialization has
-side effect, it is unspecified whether the side effect happens or not.
-Currently, GCC discards them and issues a warning.
+If the same field is initialized multiple times, or overlapping
+fields of a union are initialized, the value from the last
+initialization is used.  When a field of a union is itself a structure, 
+the entire structure from the last field initialized is used.  If any previous
+initializer has side effect, it is unspecified whether the side effect
+happens or not.  Currently, GCC discards the side-effecting
+initializer expressions and issues a warning.
 
 @node Case Ranges
 @section Case Ranges