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.
This commit is contained in:
Iain Buclaw 2020-03-31 23:07:29 +02:00
parent 63b2923dc6
commit 1c16f7fc90
2 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,8 @@
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

View File

@ -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_returns_twice_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. */
static tree d_handle_noinline_attribute (tree *, tree, tree, int, bool *);
@ -137,6 +138,8 @@ const attribute_spec d_langhook_common_attribute_table[] =
handle_type_generic_attribute, NULL),
ATTR_SPEC ("fn spec", 1, 1, false, true, true, false,
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),
};
@ -565,6 +568,19 @@ handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name),
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. */
/* Handle a "noinline" attribute. */