diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-03-31 23:07:29 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-03-31 23:08:23 +0200 |
commit | 1c16f7fc903c1c1c912faf7889b69d83429b7b2e (patch) | |
tree | 0c89e976db9499401904b1282b7bf351845e9f44 /gcc/d | |
parent | 63b2923dc6f57e74d964a9cf14f4ba595ab14ed9 (diff) | |
download | gcc-1c16f7fc903c1c1c912faf7889b69d83429b7b2e.zip gcc-1c16f7fc903c1c1c912faf7889b69d83429b7b2e.tar.gz gcc-1c16f7fc903c1c1c912faf7889b69d83429b7b2e.tar.bz2 |
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.
Diffstat (limited to 'gcc/d')
-rw-r--r-- | gcc/d/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/d/d-attribs.cc | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 9a3fbfa..20817e3 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,5 +1,10 @@ 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 * d-codegen.cc (build_alignment_field): Remove. (build_struct_literal): Don't insert alignment padding. diff --git a/gcc/d/d-attribs.cc b/gcc/d/d-attribs.cc index c3b80ed..bba6f51 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. */ |