Commit 1c16f7fc by Iain Buclaw

d: Add always_inline to the internal attribute table.

This attribute is not directly accessible from user code, rather it is
indirectly added from the @forceinline attribute.  Even so, a handler
should be present for it to prevent false positive warnings.

Said warnings are not something that could happen currently, but will
become a problem from fixing PR90136 later.

gcc/d/ChangeLog:

	* d-attribs.cc (d_langhook_common_attribute_table): Add always_inline.
	(handle_always_inline_attribute): New function.
parent 63b2923d
2020-03-31 Iain Buclaw <ibuclaw@gdcproject.org> 2020-03-31 Iain Buclaw <ibuclaw@gdcproject.org>
* d-attribs.cc (d_langhook_common_attribute_table): Add always_inline.
(handle_always_inline_attribute): New function.
2020-03-31 Iain Buclaw <ibuclaw@gdcproject.org>
PR d/94424 PR d/94424
* d-codegen.cc (build_alignment_field): Remove. * d-codegen.cc (build_alignment_field): Remove.
(build_struct_literal): Don't insert alignment padding. (build_struct_literal): Don't insert alignment padding.
......
...@@ -52,6 +52,7 @@ static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *); ...@@ -52,6 +52,7 @@ static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
static tree handle_transaction_pure_attribute (tree *, tree, tree, int, bool *); static tree handle_transaction_pure_attribute (tree *, tree, tree, int, bool *);
static tree handle_returns_twice_attribute (tree *, tree, tree, int, bool *); static tree handle_returns_twice_attribute (tree *, tree, tree, int, bool *);
static tree handle_fnspec_attribute (tree *, tree, tree, int, bool *); static tree handle_fnspec_attribute (tree *, tree, tree, int, bool *);
static tree handle_always_inline_attribute (tree *, tree, tree, int, bool *);
/* D attribute handlers for user defined attributes. */ /* D attribute handlers for user defined attributes. */
static tree d_handle_noinline_attribute (tree *, tree, tree, int, bool *); static tree d_handle_noinline_attribute (tree *, tree, tree, int, bool *);
...@@ -137,6 +138,8 @@ const attribute_spec d_langhook_common_attribute_table[] = ...@@ -137,6 +138,8 @@ const attribute_spec d_langhook_common_attribute_table[] =
handle_type_generic_attribute, NULL), handle_type_generic_attribute, NULL),
ATTR_SPEC ("fn spec", 1, 1, false, true, true, false, ATTR_SPEC ("fn spec", 1, 1, false, true, true, false,
handle_fnspec_attribute, NULL), handle_fnspec_attribute, NULL),
ATTR_SPEC ("always_inline", 0, 0, true, false, false, false,
handle_always_inline_attribute, NULL),
ATTR_SPEC (NULL, 0, 0, false, false, false, false, NULL, NULL), ATTR_SPEC (NULL, 0, 0, false, false, false, false, NULL, NULL),
}; };
...@@ -565,6 +568,19 @@ handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name), ...@@ -565,6 +568,19 @@ handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name),
return NULL_TREE; return NULL_TREE;
} }
/* Handle a "always_inline" attribute; arguments as in
struct attribute_spec.handler. */
static tree
handle_always_inline_attribute (tree *node, tree ARG_UNUSED (name),
tree ARG_UNUSED (args), int ARG_UNUSED (flags),
bool *no_add_attrs ATTRIBUTE_UNUSED)
{
gcc_assert (TREE_CODE (*node) == FUNCTION_DECL);
return NULL_TREE;
}
/* Language specific attribute handlers. */ /* Language specific attribute handlers. */
/* Handle a "noinline" attribute. */ /* Handle a "noinline" attribute. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment