This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] attribute copy, leaf, weakref and -Wmisisng-attributes (PR 88546)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Martin Sebor <msebor at gmail dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Marek Polacek <polacek at redhat dot com>, Jason Merrill <jason at redhat dot com>, Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 21 Dec 2018 11:05:09 +0100
- Subject: Re: [PATCH] attribute copy, leaf, weakref and -Wmisisng-attributes (PR 88546)
- References: <6ff6565b-51d8-8620-f345-a0082747297b@gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
I think the main question is whether we should accept leaf attribute
on weakrefs, despite them being marked as !TREE_PUBLIC.
I know we haven't allowed that until now, but weakrefs are weirdo things
which have both static and external effects, static for that they are a
local alias and external for being actually aliases to (usually) external
functions. If we add a weakref for some function declared as leaf,
it is unnecessarily pessimizing when we don't allow the leaf attribute on
the weakref.
Your patch looks reasonable to me to revert to previous state, but if we
decide to change the above, it would need to change.
On Thu, Dec 20, 2018 at 08:45:03PM -0700, Martin Sebor wrote:
> --- gcc/c-family/c-attribs.c (revision 267282)
> +++ gcc/c-family/c-attribs.c (working copy)
> @@ -2455,6 +2455,12 @@ handle_copy_attribute (tree *node, tree name, tree
> || is_attribute_p ("weakref", atname))
> continue;
>
> + /* Aattribute leaf only applies to extern functions.
> + Avoid copying it to static ones. */
s/Aatribute/Attribute/
Jakub