From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay12.mail.gandi.net (relay12.mail.gandi.net [217.70.178.232]) by sourceware.org (Postfix) with ESMTPS id B88853858D29 for ; Mon, 15 Mar 2021 12:06:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B88853858D29 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dodji@seketeli.org Received: from localhost (unknown [88.120.130.27]) (Authenticated sender: dodji@seketeli.org) by relay12.mail.gandi.net (Postfix) with ESMTPSA id EEFDD200007; Mon, 15 Mar 2021 12:06:48 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 3B91758000E; Mon, 15 Mar 2021 13:06:48 +0100 (CET) From: Dodji Seketeli To: Matthias Maennich Cc: libabigail@sourceware.org, gprocida@google.com, kernel-team@android.com Subject: Re: [PATCH 08/20] corpus: make get_unreferenced_(function|variable)_symbols use the new symtab Organization: Me, myself and I References: <20200619214305.562-1-maennich@google.com> <20210127125853.886677-1-maennich@google.com> <20210127125853.886677-9-maennich@google.com> X-Operating-System: Fedora 34 X-URL: http://www.seketeli.net/~dodji Date: Mon, 15 Mar 2021 13:06:48 +0100 In-Reply-To: <20210127125853.886677-9-maennich@google.com> (Matthias Maennich's message of "Wed, 27 Jan 2021 12:58:41 +0000") Message-ID: <878s6ozkmf.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 12:06:52 -0000 Hello, Matthias Maennich a =C3=A9crit: [...] > diff --git a/src/abg-corpus.cc b/src/abg-corpus.cc > index 75f897eb72a8..f9f51a360707 100644 > --- a/src/abg-corpus.cc > +++ b/src/abg-corpus.cc [...] > +/// Return a list of symbols that are not referenced by any function of > +/// corpus::get_functions(). > +/// > +/// Note that this function considers the list of function symbols to ke= ep, > +/// that is provided by corpus::get_sym_ids_of_fns_to_keep(). If a given > +/// unreferenced function symbol is not in the list of functions to keep= , then > +/// that symbol is dropped and will not be part of the resulting table of > +/// unreferenced symbol that is built. Please use the @return tag in this comment. > +const elf_symbols& > +corpus::priv::get_unreferenced_function_symbols() const > +{ [...] > +/// Return a list of symbols that are not referenced by any variable of > +/// corpus::get_variables(). > +/// > +/// Note that this function considers the list of variable symbols to ke= ep, > +/// that is provided by corpus::get_sym_ids_of_vars_to_keep(). If a given > +/// unreferenced variable symbol is not in the list of variable to keep,= then > +/// that symbol is dropped and will not be part of the resulting table of > +/// unreferenced symbol that is built. Likewise. > +const elf_symbols& > +corpus::priv::get_unreferenced_variable_symbols() const > +{ [...] > /// Getter of the set of pretty representation of types that are > /// reachable from public interfaces (global functions and variables). > /// > @@ -1310,12 +1290,7 @@ corpus::sort_variables() > /// function exported by the current corpus. > const elf_symbols& > corpus::get_unreferenced_function_symbols() const > -{ > - if (priv_->unrefed_fun_symbols.empty() > - && priv_->unrefed_var_symbols.empty()) > - priv_->build_unreferenced_symbols_tables(); > - return priv_->unrefed_fun_symbols; > -} > +{ return priv_->get_unreferenced_function_symbols(); } Please remove leading/trailing spaces after/before the curly brackets. >=20=20 > /// Getter of the set of variable symbols that are not referenced by > /// any variable exported by the current corpus. > @@ -1328,12 +1303,7 @@ corpus::get_unreferenced_function_symbols() const > /// variable exported by the current corpus. > const elf_symbols& > corpus::get_unreferenced_variable_symbols() const > -{ > - if (priv_->unrefed_fun_symbols.empty() > - && priv_->unrefed_var_symbols.empty()) > - priv_->build_unreferenced_symbols_tables(); > - return priv_->unrefed_var_symbols; > -} > +{ return priv_->get_unreferenced_variable_symbols(); } [...] > Make the corresponding members an implementation detail of corpus::priv. > They get computed based on the new symtab whenever they are accessed > first with an atomic instantiation. That simplifies the implementation > and homogenizes the access to functions and variables. Sorting does not > need to be done as the symtab already gives a guarantee for that. > > * src/abg-corpus-priv.h (corpus::priv::unrefed_var_symbols): make > private, mutable and optional. > (corpus::unrefed_fun_symbols): Likewise. > (corpus::priv::get_unreferenced_function_symbols): New method d= eclaration. > (corpus::priv::get_unreferenced_variable_symbols): Likewise. > * src/abg-corpus.cc > (corpus::priv::build_unreferenced_symbols_tables): Delete metho= d. > (corpus::priv::get_unreferenced_function_symbols): New method i= mplementation. > (corpus::priv::get_unreferenced_variable_symbols): Likewise. > (corpus::get_unreferenced_function_symbols): Proxy call to corp= us::priv. > (corpus::get_unreferenced_variable_symbols): Likewise. > > Reviewed-by: Giuliano Procida > Signed-off-by: Matthias Maennich OK to apply to master with the above changes once the previous patches have been applied. Thanks! [...] cheers, --=20 Dodji