From patchwork Mon Dec 14 23:08:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Matthias_M=C3=A4nnich?= X-Patchwork-Id: 41383 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 537EB385800E; Mon, 14 Dec 2020 23:09:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 537EB385800E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1607987357; bh=gPjOxo87F0f+Hxr+q/szZvL9BhlSh8QOHHTdMUzk72I=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=v+uJT7xbiml92sF+U6k9MOMEtFSz6hYvwWU3YfXqkNtMqTQX7OHsukpy7mnXJGFcZ 1TpnDR5qXtGQeK8o0wjfQW39hMgI1iNO/z/8oHaDgcGF0o5931dalVl0/wzXptQlcW z31aWABcfP98d4H7n77lvjr1hsoE8e0Zds14kqE8= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by sourceware.org (Postfix) with ESMTPS id 5CD7B3858D29 for ; Mon, 14 Dec 2020 23:09:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5CD7B3858D29 Received: by mail-qt1-x849.google.com with SMTP id l17so12879494qtj.18 for ; Mon, 14 Dec 2020 15:09:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=gPjOxo87F0f+Hxr+q/szZvL9BhlSh8QOHHTdMUzk72I=; b=AIi9jqekhQOw0G8bldYIPFAyT0BYN6erinmWdwqDlAn0YfwYTYyhFzY9/r9xmrJBIH QCxy4e26KHbGmrzQxw5emqARVNLMNSubVCVY1b84ZvT2/YQ4c68erIk98S1lXwikkXjG k73b/MrQSWd2nvR4YeIql/ihkCXBakEUoBl0EBmaMPSOEbkI0rvHBqkzN17clOXG+BdG mrz8rdvwOU9UXoC6VbAUNNWUFBrPN32SnHDn8EdBIEOH9+FKr5aj4Ut5eI84qaddq7De t576sT/WkOQfUh4WByQcQeDdyNIKQnC93iYyFWeTX+Rz9HyRzBAerjT0AZU43pmKBb1c oq+w== X-Gm-Message-State: AOAM530pMchNhsWctWDsDNJOKUx+/y0zX6omGaMN/64LMaQ/EB82NXS8 RS0wldcPP1GLLUrFblVHPAZT6Bc4OYUMant5z5/MsWAii0agM31LuYq5cWcDprruG2BPrWDsCP0 o7HpgPJd3MZUx3ObWc/Zf+Mh1fMiHMtiPEyoiIGBEQSAH5cbDBetlFj/XDRrJeiy9nZ8V8xc= X-Google-Smtp-Source: ABdhPJzI2nc/5D9BBLaa3RVJjv0iB5MUMhC4VYDQszD9NsOXhBem8JCI1XQnko97YMAO6Omy5gd4RK/7BwxwCg== X-Received: from lux.lon.corp.google.com ([2a00:79e0:d:210:7220:84ff:fe09:a3aa]) (user=maennich job=sendgmr) by 2002:a05:6214:768:: with SMTP id f8mr34283716qvz.1.1607987352869; Mon, 14 Dec 2020 15:09:12 -0800 (PST) Date: Mon, 14 Dec 2020 23:08:52 +0000 In-Reply-To: <20201214230855.1574934-1-maennich@google.com> Message-Id: <20201214230855.1574934-3-maennich@google.com> Mime-Version: 1.0 References: <20201214230855.1574934-1-maennich@google.com> X-Mailer: git-send-email 2.29.2.684.gfbc64c5ab5-goog Subject: [PATCH 2/6] Remove usages from abg_compat To: libabigail@sourceware.org X-Spam-Status: No, score=-22.2 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL 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-Patchwork-Original-From: Matthias Maennich via Libabigail From: =?utf-8?q?Matthias_M=C3=A4nnich?= Reply-To: Matthias Maennich Cc: maennich@google.com, kernel-team@android.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" std::hash is now provided through the language standard, hence remove the compatibility code for and adjust all users accordingly. * include/abg-cxx-compat.h: Drop compatibility layer for . * include/abg-interned-str.h: migrate abg_compat use to std. * include/abg-ir.h: Likewise. * src/abg-hash.cc: Likewise. * src/abg-ir.cc: Likewise. Signed-off-by: Matthias Maennich --- include/abg-cxx-compat.h | 4 -- include/abg-interned-str.h | 3 +- include/abg-ir.h | 3 +- src/abg-hash.cc | 85 +++++++++++++++++++------------------- src/abg-ir.cc | 19 +++++---- 5 files changed, 57 insertions(+), 57 deletions(-) diff --git a/include/abg-cxx-compat.h b/include/abg-cxx-compat.h index 1d5dab48be75..f3c343dfd481 100644 --- a/include/abg-cxx-compat.h +++ b/include/abg-cxx-compat.h @@ -8,16 +8,12 @@ #ifndef __ABG_CXX_COMPAT_H #define __ABG_CXX_COMPAT_H -#include #include #include #include namespace abg_compat { -// -using std::hash; - // using std::shared_ptr; using std::weak_ptr; diff --git a/include/abg-interned-str.h b/include/abg-interned-str.h index 6967704f1ff4..dc1adf1fb290 100644 --- a/include/abg-interned-str.h +++ b/include/abg-interned-str.h @@ -16,6 +16,7 @@ #ifndef __ABG_INTERNED_STR_H__ #define __ABG_INTERNED_STR_H__ +#include #include #include #include "abg-cxx-compat.h" @@ -211,7 +212,7 @@ struct hash_interned_string size_t operator()(const interned_string& s) const { - abg_compat::hash hash_size_t; + std::hash hash_size_t; return hash_size_t(reinterpret_cast(s.raw())); } }; // end struct hash_interned_string diff --git a/include/abg-ir.h b/include/abg-ir.h index 11af6b00647d..561d20960ed4 100644 --- a/include/abg-ir.h +++ b/include/abg-ir.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "abg-cxx-compat.h" #include "abg-fwd.h" @@ -362,7 +363,7 @@ struct type_or_decl_hash operator()(const type_or_decl_base *artifact) const { string repr = get_pretty_representation(artifact); - abg_compat::hash do_hash; + std::hash do_hash; return do_hash(repr); } diff --git a/src/abg-hash.cc b/src/abg-hash.cc index 7addb0161fe6..7b54c177379a 100644 --- a/src/abg-hash.cc +++ b/src/abg-hash.cc @@ -5,6 +5,7 @@ /// @file +#include #include "abg-cxx-compat.h" #include "abg-internal.h" // @@ -94,8 +95,8 @@ using namespace abigail::ir; size_t type_base::hash::operator()(const type_base& t) const { - abg_compat::hash size_t_hash; - abg_compat::hash str_hash; + std::hash size_t_hash; + std::hash str_hash; size_t v = str_hash(typeid(t).name()); v = hashing::combine_hashes(v, size_t_hash(t.get_size_in_bits())); @@ -127,7 +128,7 @@ struct decl_base::hash size_t operator()(const decl_base& d) const { - abg_compat::hash str_hash; + std::hash str_hash; size_t v = str_hash(typeid(d).name()); if (!d.get_linkage_name().empty()) @@ -150,7 +151,7 @@ struct type_decl::hash { decl_base::hash decl_hash; type_base::hash type_hash; - abg_compat::hash str_hash; + std::hash str_hash; size_t v = str_hash(typeid(t).name()); v = hashing::combine_hashes(v, decl_hash(t)); @@ -168,7 +169,7 @@ struct type_decl::hash size_t scope_decl::hash::operator()(const scope_decl& d) const { - abg_compat::hash hash_string; + std::hash hash_string; size_t v = hash_string(typeid(d).name()); for (scope_decl::declarations::const_iterator i = d.get_member_decls().begin(); @@ -195,7 +196,7 @@ struct scope_type_decl::hash { decl_base::hash decl_hash; type_base::hash type_hash; - abg_compat::hash str_hash; + std::hash str_hash; size_t v = str_hash(typeid(t).name()); v = hashing::combine_hashes(v, decl_hash(t)); @@ -212,7 +213,7 @@ struct qualified_type_def::hash { type_base::hash type_hash; decl_base::hash decl_hash; - abg_compat::hash str_hash; + std::hash str_hash; size_t v = str_hash(typeid(t).name()); v = hashing::combine_hashes(v, type_hash(t)); @@ -227,7 +228,7 @@ struct pointer_type_def::hash size_t operator()(const pointer_type_def& t) const { - abg_compat::hash str_hash; + std::hash str_hash; type_base::hash type_base_hash; decl_base::hash decl_hash; type_base::shared_ptr_hash hash_type_ptr; @@ -245,7 +246,7 @@ struct reference_type_def::hash size_t operator()(const reference_type_def& t) { - abg_compat::hash hash_str; + std::hash hash_str; type_base::hash hash_type_base; decl_base::hash hash_decl; type_base::shared_ptr_hash hash_type_ptr; @@ -266,7 +267,7 @@ struct array_type_def::subrange_type::hash size_t operator()(const array_type_def::subrange_type& s) const { - abg_compat::hash hash_size_t; + std::hash hash_size_t; size_t v = hash_size_t(hash_size_t(s.get_lower_bound())); v = hashing::combine_hashes(v, hash_size_t(s.get_upper_bound())); return v; @@ -278,7 +279,7 @@ struct array_type_def::hash size_t operator()(const array_type_def& t) { - abg_compat::hash hash_str; + std::hash hash_str; type_base::hash hash_type_base; decl_base::hash hash_decl; type_base::shared_ptr_hash hash_type_ptr; @@ -305,10 +306,10 @@ struct enum_type_decl::hash size_t operator()(const enum_type_decl& t) const { - abg_compat::hash str_hash; + std::hash str_hash; decl_base::hash decl_hash; type_base::shared_ptr_hash type_ptr_hash; - abg_compat::hash size_t_hash; + std::hash size_t_hash; size_t v = str_hash(typeid(t).name()); v = hashing::combine_hashes(v, decl_hash(t)); @@ -330,7 +331,7 @@ struct typedef_decl::hash size_t operator()(const typedef_decl& t) const { - abg_compat::hash str_hash; + std::hash str_hash; type_base::hash hash_type; decl_base::hash decl_hash; type_base::shared_ptr_hash type_ptr_hash; @@ -356,10 +357,10 @@ struct typedef_decl::hash size_t var_decl::hash::operator()(const var_decl& t) const { - abg_compat::hash hash_string; + std::hash hash_string; decl_base::hash hash_decl; type_base::shared_ptr_hash hash_type_ptr; - abg_compat::hash hash_size_t; + std::hash hash_size_t; size_t v = hash_string(typeid(t).name()); v = hashing::combine_hashes(v, hash_decl(t)); @@ -395,10 +396,10 @@ var_decl::hash::operator()(const var_decl* t) const size_t function_decl::hash::operator()(const function_decl& t) const { - abg_compat::hash hash_int; - abg_compat::hash hash_size_t; - abg_compat::hash hash_bool; - abg_compat::hash hash_string; + std::hash hash_int; + std::hash hash_size_t; + std::hash hash_bool; + std::hash hash_string; decl_base::hash hash_decl_base; type_base::shared_ptr_hash hash_type_ptr; @@ -440,8 +441,8 @@ function_decl::parameter::hash::operator() (const function_decl::parameter& p) const { type_base::shared_ptr_hash hash_type_ptr; - abg_compat::hash hash_bool; - abg_compat::hash hash_unsigned; + std::hash hash_bool; + std::hash hash_unsigned; size_t v = hash_type_ptr(p.get_type()); v = hashing::combine_hashes(v, hash_unsigned(p.get_index())); v = hashing::combine_hashes(v, hash_bool(p.get_variadic_marker())); @@ -464,7 +465,7 @@ struct method_type::hash size_t operator()(const method_type& t) const { - abg_compat::hash hash_string; + std::hash hash_string; type_base::shared_ptr_hash hash_type_ptr; function_decl::parameter::hash hash_parameter; @@ -500,7 +501,7 @@ struct method_type::hash size_t function_type::hash::operator()(const function_type& t) const { - abg_compat::hash hash_string; + std::hash hash_string; type_base::shared_ptr_hash hash_type_ptr; function_decl::parameter::hash hash_parameter; @@ -544,7 +545,7 @@ function_type::hash::operator()(const function_type_sptr t) const size_t member_base::hash::operator()(const member_base& m) const { - abg_compat::hash hash_int; + std::hash hash_int; return hash_int(m.get_access_specifier()); } @@ -553,9 +554,9 @@ class_decl::base_spec::hash::operator()(const base_spec& t) const { member_base::hash hash_member; type_base::shared_ptr_hash hash_type_ptr; - abg_compat::hash hash_size; - abg_compat::hash hash_bool; - abg_compat::hash hash_string; + std::hash hash_size; + std::hash hash_bool; + std::hash hash_string; size_t v = hash_string(typeid(t).name()); v = hashing::combine_hashes(v, hash_member(t)); @@ -569,10 +570,10 @@ size_t member_function_template::hash::operator() (const member_function_template& t) const { - abg_compat::hash hash_bool; + std::hash hash_bool; function_tdecl::hash hash_function_tdecl; member_base::hash hash_member; - abg_compat::hash hash_string; + std::hash hash_string; size_t v = hash_member(t); string n = t.get_qualified_name(); @@ -589,7 +590,7 @@ member_class_template::hash::operator() { member_base::hash hash_member; class_tdecl::hash hash_class_tdecl; - abg_compat::hash hash_string; + std::hash hash_string; size_t v = hash_member(t); string n = t.get_qualified_name(); @@ -627,7 +628,7 @@ class_or_union::hash::operator()(const class_or_union& t) const ABG_ASSERT(!t.get_is_declaration_only()); - abg_compat::hash hash_string; + std::hash hash_string; scope_type_decl::hash hash_scope_type; var_decl::hash hash_data_member; member_function_template::hash hash_member_fn_tmpl; @@ -706,7 +707,7 @@ class_decl::hash::operator()(const class_decl& t) const ABG_ASSERT(!t.get_is_declaration_only()); - abg_compat::hash hash_string; + std::hash hash_string; class_decl::base_spec::hash hash_base; class_or_union::hash hash_class_or_union; @@ -755,8 +756,8 @@ struct template_parameter::hash t.set_hashing_has_started(true); - abg_compat::hash hash_unsigned; - abg_compat::hash hash_string; + std::hash hash_unsigned; + std::hash hash_string; template_decl::hash hash_template_decl; size_t v = hash_string(typeid(t).name()); @@ -786,7 +787,7 @@ struct template_parameter::shared_ptr_hash size_t template_decl::hash::operator()(const template_decl& t) const { - abg_compat::hash hash_string; + std::hash hash_string; template_parameter::shared_ptr_hash hash_template_parameter; size_t v = hash_string(typeid(t).name()); @@ -807,7 +808,7 @@ struct type_tparameter::hash size_t operator()(const type_tparameter& t) const { - abg_compat::hash hash_string; + std::hash hash_string; template_parameter::hash hash_template_parameter; type_decl::hash hash_type; @@ -828,7 +829,7 @@ size_t non_type_tparameter::hash::operator()(const non_type_tparameter& t) const { template_parameter::hash hash_template_parameter; - abg_compat::hash hash_string; + std::hash hash_string; type_base::shared_ptr_hash hash_type; size_t v = hash_string(typeid(t).name()); @@ -853,7 +854,7 @@ struct template_tparameter::hash size_t operator()(const template_tparameter& t) const { - abg_compat::hash hash_string; + std::hash hash_string; type_tparameter::hash hash_template_type_parm; template_decl::hash hash_template_decl; @@ -891,7 +892,7 @@ operator()(const template_parameter* t) const size_t type_composition::hash::operator()(const type_composition& t) const { - abg_compat::hash hash_string; + std::hash hash_string; type_base::dynamic_hash hash_type; size_t v = hash_string(typeid(t).name()); @@ -912,7 +913,7 @@ size_t function_tdecl::hash:: operator()(const function_tdecl& t) const { - abg_compat::hash hash_string; + std::hash hash_string; decl_base::hash hash_decl_base; template_decl::hash hash_template_decl; function_decl::hash hash_function_decl; @@ -941,7 +942,7 @@ size_t class_tdecl::hash:: operator()(const class_tdecl& t) const { - abg_compat::hash hash_string; + std::hash hash_string; decl_base::hash hash_decl_base; template_decl::hash hash_template_decl; class_decl::hash hash_class_decl; diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 7b060a005bd4..aa91dd3eb3b6 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -10,12 +10,13 @@ /// Definitions for the Internal Representation artifacts of libabigail. #include -#include -#include #include +#include #include -#include #include +#include +#include +#include #include "abg-cxx-compat.h" #include "abg-internal.h" @@ -23276,7 +23277,7 @@ hash_type_or_decl(const type_or_decl_base *tod) ABG_ASSERT(v->get_type()); size_t h = hash_type_or_decl(v->get_type()); string repr = v->get_pretty_representation(); - abg_compat::hash hash_string; + std::hash hash_string; h = hashing::combine_hashes(h, hash_string(repr)); result = h; } @@ -23285,7 +23286,7 @@ hash_type_or_decl(const type_or_decl_base *tod) ABG_ASSERT(f->get_type()); size_t h = hash_type_or_decl(f->get_type()); string repr = f->get_pretty_representation(); - abg_compat::hash hash_string; + std::hash hash_string; h = hashing::combine_hashes(h, hash_string(repr)); result = h; } @@ -23293,8 +23294,8 @@ hash_type_or_decl(const type_or_decl_base *tod) { type_base_sptr parm_type = p->get_type(); ABG_ASSERT(parm_type); - abg_compat::hash hash_bool; - abg_compat::hash hash_unsigned; + std::hash hash_bool; + std::hash hash_unsigned; size_t h = hash_type_or_decl(parm_type); h = hashing::combine_hashes(h, hash_unsigned(p->get_index())); h = hashing::combine_hashes(h, hash_bool(p->get_variadic_marker())); @@ -23303,8 +23304,8 @@ hash_type_or_decl(const type_or_decl_base *tod) else if (class_decl::base_spec *bs = is_class_base_spec(d)) { member_base::hash hash_member; - abg_compat::hash hash_size; - abg_compat::hash hash_bool; + std::hash hash_size; + std::hash hash_bool; type_base_sptr type = bs->get_base_class(); size_t h = hash_type_or_decl(type); h = hashing::combine_hashes(h, hash_member(*bs));