This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Rewrite check_global_declarations() generically
- From: Jason Merrill <jason at redhat dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>, Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 29 Apr 2015 15:33:02 -0400
- Subject: Re: [patch] Rewrite check_global_declarations() generically
- Authentication-results: sourceware.org; auth=none
- References: <55402D60 dot 7020103 at redhat dot com>
On 04/28/2015 09:01 PM, Aldy Hernandez wrote:
The approach looks good to me.
- analyze_functions ();
+ analyze_functions (true);
In the C++ front end at least we comment anonymous boolean arguments, i.e.
analyze_functions (/*first_time*/true);
Let's do that here, too. Similarly for the calls to referred_to_p (false).
+ /* ?? Why are we looking at TREE_USED? Shouldn't the call to
+ referred_to_p above be enough? Apparently not, because the
+ `__unused__' attribute is not being considered for
+ referred_to_p. */
Seems like you answered your question. :)
+ /* Global ctors and dtors are called by the runtime. */
+ && (TREE_CODE (decl) != FUNCTION_DECL
+ || (!DECL_STATIC_CONSTRUCTOR (decl)
+ && !DECL_STATIC_DESTRUCTOR (decl)))
Maybe check snode->needed_p instead?
Jason