aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-lex.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-10-03 11:56:29 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-10-03 11:56:29 -0400
commitbedf03a298f87b43f02eaee57542fbd10228ec08 (patch)
treeb89298bfa67ef964fcefa62e3d8b27bfd7807c1d /gcc/c-family/c-lex.c
parent749c0e1d8b2c8dbc54af3365af506b3e1986e754 (diff)
Implement P0840, language support for empty objects.
The [[no_unique_address]] attribute on a non-static data member enables the equivalent of the empty base optimization. gcc/cp/ * tree.c (handle_no_unique_addr_attribute): New. (cxx_attribute_table): Add [[no_unique_address]]. * class.c (field_poverlapping_p): New. (layout_class_type): Check it. Adjust DECL_SIZE of potentially overlapping fields. (layout_empty_base_or_field): Rename from layout_empty_base, handle FIELD_DECL as well. (build_base_field, record_subobject_offsets): Adjust. c-family/ * c-lex.c (c_common_has_attribute): Add no_unique_address. From-SVN: r264813
Diffstat (limited to 'gcc/c-family/c-lex.c')
-rw-r--r--gcc/c-family/c-lex.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c
index ac58335cf3a..78a132484fc 100644
--- a/gcc/c-family/c-lex.c
+++ b/gcc/c-family/c-lex.c
@@ -356,6 +356,8 @@ c_common_has_attribute (cpp_reader *pfile)
|| is_attribute_p ("nodiscard", attr_name)
|| is_attribute_p ("fallthrough", attr_name))
result = 201603;
+ else if (is_attribute_p ("no_unique_address", attr_name))
+ result = 20180312;
if (result)
attr_name = NULL_TREE;
}