From: Iain Buclaw Date: Tue, 31 Mar 2020 21:07:29 +0000 (+0200) Subject: d: Add always_inline to the internal attribute table. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1c16f7fc903c1c1c912faf7889b69d83429b7b2e;p=gcc.git 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. --- diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 9a3fbfa7c56..20817e38fc6 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,8 @@ +2020-03-31 Iain Buclaw + + * d-attribs.cc (d_langhook_common_attribute_table): Add always_inline. + (handle_always_inline_attribute): New function. + 2020-03-31 Iain Buclaw PR d/94424 diff --git a/gcc/d/d-attribs.cc b/gcc/d/d-attribs.cc index c3b80ed5b9d..bba6f516ea3 100644 --- a/gcc/d/d-attribs.cc +++ b/gcc/d/d-attribs.cc @@ -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. */