mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-19 15:33:56 +00:00
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
This commit is contained in:
parent
da257dda10
commit
b7505e07e5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300301
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user