Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 May 2016 14:36:49 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300301 - head/contrib/gcc
Message-ID:  <201605201436.u4KEanoi031012@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Fri May 20 14:36:49 2016
New Revision: 300301
URL: https://svnweb.freebsd.org/changeset/base/300301

Log:
  GCC: Add support for named initializers for anonymous structs/unions.
  
  This is a C11 feature that is starting to get used in places such as Mesa.
  This implementation takes a different approach to upstream and is
  therefore not covered by GPLv3.
  
  Obtained from:	OpenBSD (CVS rev. 1.2)
  MFC after:	3 weeks

Modified:
  head/contrib/gcc/c-typeck.c

Modified: head/contrib/gcc/c-typeck.c
==============================================================================
--- head/contrib/gcc/c-typeck.c	Fri May 20 13:11:07 2016	(r300300)
+++ head/contrib/gcc/c-typeck.c	Fri May 20 14:36:49 2016	(r300301)
@@ -6041,6 +6041,7 @@ set_init_index (tree first, tree last)
 void
 set_init_label (tree fieldname)
 {
+  tree anon = NULL_TREE;
   tree tail;
 
   if (set_designator (0))
@@ -6058,6 +6059,15 @@ set_init_label (tree fieldname)
   for (tail = TYPE_FIELDS (constructor_type); tail;
        tail = TREE_CHAIN (tail))
     {
+      if (DECL_NAME (tail) == NULL_TREE
+	  && (TREE_CODE (TREE_TYPE (tail)) == RECORD_TYPE
+	      || TREE_CODE (TREE_TYPE (tail)) == UNION_TYPE))
+	{
+	  anon = lookup_field (tail, fieldname);
+	  if (anon)
+	    break;
+	}
+
       if (DECL_NAME (tail) == fieldname)
 	break;
     }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605201436.u4KEanoi031012>