From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78384 invoked by alias); 29 Apr 2015 19:33:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 78375 invoked by uid 89); 29 Apr 2015 19:33:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 29 Apr 2015 19:33:09 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3TJX8SE026816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 29 Apr 2015 15:33:08 -0400 Received: from [10.10.116.47] ([10.10.116.47]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3TJX6Ac017709; Wed, 29 Apr 2015 15:33:07 -0400 Message-ID: <554131EE.1020000@redhat.com> Date: Wed, 29 Apr 2015 20:30:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Aldy Hernandez , Richard Biener CC: gcc-patches Subject: Re: [patch] Rewrite check_global_declarations() generically References: <55402D60.7020103@redhat.com> In-Reply-To: <55402D60.7020103@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2015-04/txt/msg01926.txt.bz2 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