From patchwork Sun Feb 18 12:17:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 85940 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 87D17386103A for ; Sun, 18 Feb 2024 12:18:11 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D4C513861002 for ; Sun, 18 Feb 2024 12:18:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D4C513861002 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D4C513861002 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708258687; cv=none; b=ncISavbQVRQzlRYZ6MIYDQXVr9gekbmpkN+BNN1XR29WqnvU6PehRFC5NSgy2xNkobDCDyHFpMXUiN8uYn7bNSGs7o+meim+kqCPgpxQMsVrR4EEno2tuI43P0nAnmrSSfEHua8JMny2lRC2tqgGibUfpV9zMFKdG4zBAYxwLKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708258687; c=relaxed/simple; bh=h3y4dGCldoTZlWhgMufrOqy0uzUQcQKHxY5PouhLw6E=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=s+R5xX3N9a4x+JexR7WKRoC9PMMSH0rYONF/mnVhn0zcDCVKI8Y29837NWpMb018oNqkXi3FILq8Juw0e0qYgr/awehz/SakG/UCJCOgcmV1yLooEz2Au5BAoqfGY8Xl0R9fH7HB8HWRRJJ+a4zv5ybYm7KPYGaNHpegG7z276c= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708258684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=aq+U6X72B4Z+0IMhu5XdZFqqNmk3bZP66SSTR/M0hns=; b=Mmv5Qms+DsMY0fRFo49i+upFDRn5bZwnlBNFrBZ9gtgG2Bg2PAlPxLuobBYvJNDF7fNgTK mhm7D3aGj0MAgb7puvDoZUraunbAkA3RwfhBe3x2vP8gEocfMQTStFu03qR2WdO5WLch44 K5rLissHlg6CJfrrkyKE3cX4QeFgLGk= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-yx3JZjBDMdCh_L7Z7LYLXw-1; Sun, 18 Feb 2024 07:18:02 -0500 X-MC-Unique: yx3JZjBDMdCh_L7Z7LYLXw-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-42db934c1f8so38923431cf.3 for ; Sun, 18 Feb 2024 04:18:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708258682; x=1708863482; h=mime-version:user-agent:message-id:date:organization:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aq+U6X72B4Z+0IMhu5XdZFqqNmk3bZP66SSTR/M0hns=; b=F/x1s2kny32HTsP1PDbktZyTVpeHPE6fm2gkbc2Dpu2dWwv7DK+X1PO4z3r/wUGnuT c7nZidB4H/7Ttiikw4Yvj/jXWtUUwD+bNvvb86egs+VTq8Sad9DtHCpKxU/uHKA/xcKk 6S+zDSVxjzQQhgSCGGCQt0lzajCR5j5RQEERsauU5uglPWEPEQRbrFqdoQohRmi6uWsO 3s472+bs+mHQv6iW1+05SsZbnDmN9Z5wxdIC2U1bVvb6bImqE8mkpjK6PkJ75gM4facp Dle3EDPGN17BMD4hRvisKmEA9CgIhpjPMpkhO6mqk+QxKDz6vv2hZi1DssHDnuYoUd88 6Qvw== X-Gm-Message-State: AOJu0YwqrY0cFRbYOJZ7DL83bUQ9GTOgWtDeTHPtdzj0IMOF4pVaTANm oBtkHJNt9/gGmohMtZJaKJyirRDI9Qp2bOpBSCpOZTNtBTkcYWbrynDI13AhIfgHGChElLEKbww o5siTsj34HapBN6s9lQGhaXMquHjvWFlvy9POiZAv3jPUyUwjykeHbgG0CDA+xAxEFQ== X-Received: by 2002:a0c:ca82:0:b0:68f:801:d8d5 with SMTP id a2-20020a0cca82000000b0068f0801d8d5mr11117722qvk.8.1708258681904; Sun, 18 Feb 2024 04:18:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvHFtBziDbMe2hmb8wojrnjfKmHsvJgOP7adH76PNDTuxItEaqzOtjOnTiMxIr4wAvfXeupg== X-Received: by 2002:a0c:ca82:0:b0:68f:801:d8d5 with SMTP id a2-20020a0cca82000000b0068f0801d8d5mr11117710qvk.8.1708258681576; Sun, 18 Feb 2024 04:18:01 -0800 (PST) Received: from localhost (88-120-130-27.subs.proxad.net. [88.120.130.27]) by smtp.gmail.com with ESMTPSA id oj10-20020a056214440a00b0068f4507188bsm1733292qvb.67.2024.02.18.04.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 04:18:01 -0800 (PST) Received: by localhost (Postfix, from userid 1000) id 9DD26C1B9AF8; Sun, 18 Feb 2024 13:17:59 +0100 (CET) From: Dodji Seketeli To: libabigail@sourceware.org Subject: [PATCH, applied to master] ir,{btf,ctf,dwarf}-reader: Rename {subrange_type,array_type_def}::is_infinite. Organization: Red Hat / France X-Operating-System: AlmaLinux 9.3 X-URL: http://www.redhat.com Date: Sun, 18 Feb 2024 13:17:59 +0100 Message-ID: <87plwuuft4.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Hello, Rename subrange_type::is_infinite into subrange_type::is_non_finite for better legibility. * include/abg-ir.h ({array_type_def,subrange_type}::is_non_finite): Rename {array_type_def,subrange_type}::is_infinite into this. * src/abg-btf-reader.cc (reader::build_array_type): Add a missing call to subrange_type::is_non_finite. * src/abg-comp-filter.cc (is_var_1_dim_unknown_size_array_change):Rename subrange_type::is_infinite into subrange_type::is_non_finite. * src/abg-ctf-reader.cc (build_array_ctf_range): Likewise. * src/abg-dwarf-reader.cc (build_subrange_type): Likewise. * src/abg-ir.cc (clone_array, has_flexible_array_data_member) (array_type_def::subrange_type::as_string): Likewise. ({array_type_def,subrange_type}::is_non_finite): Rename {array_type_def,subrange_type}::is_infinite into this. * src/abg-reader.cc (build_subrange_type): Rename subrange_type::is_infinite into subrange_type::is_non_finite. * src/abg-reporter-priv.cc (report_size_and_alignment_changes): Likewise. * src/abg-writer.cc (write_array_size_and_alignment): Likewise. Signed-off-by: Dodji Seketeli Applied to the master branch. --- include/abg-ir.h | 6 +++--- src/abg-btf-reader.cc | 1 + src/abg-comp-filter.cc | 2 +- src/abg-ctf-reader.cc | 6 +++--- src/abg-dwarf-reader.cc | 10 +++++----- src/abg-ir.cc | 16 ++++++++-------- src/abg-reader.cc | 10 +++++----- src/abg-reporter-priv.cc | 8 ++++---- src/abg-writer.cc | 6 +++--- 9 files changed, 33 insertions(+), 32 deletions(-) diff --git a/include/abg-ir.h b/include/abg-ir.h index 964d1397..90f5d4d3 100644 --- a/include/abg-ir.h +++ b/include/abg-ir.h @@ -2624,10 +2624,10 @@ public: get_length() const; bool - is_infinite() const; + is_non_finite() const; void - is_infinite(bool); + is_non_finite(bool); translation_unit::language get_language() const; @@ -2701,7 +2701,7 @@ public: get_dimension_count() const; virtual bool - is_infinite() const; + is_non_finite() const; virtual string get_pretty_representation(bool internal = false, diff --git a/src/abg-btf-reader.cc b/src/abg-btf-reader.cc index 0e949ef5..1252fed1 100644 --- a/src/abg-btf-reader.cc +++ b/src/abg-btf-reader.cc @@ -797,6 +797,7 @@ public: (env(), /*name=*/"", lower_bound, upper_bound, location())); + subrange->is_non_finite(!arr->nelems); add_decl_to_scope(subrange, cur_tu()->get_global_scope()); canonicalize(subrange); array_type_def::subranges_type subranges = {subrange}; diff --git a/src/abg-comp-filter.cc b/src/abg-comp-filter.cc index 82a819d6..63716775 100644 --- a/src/abg-comp-filter.cc +++ b/src/abg-comp-filter.cc @@ -667,7 +667,7 @@ is_var_1_dim_unknown_size_array_change(const var_decl_sptr& var1, // be of unknown size. if (fat->get_subranges().size() != 1 || sat->get_subranges().size() != 1 - || (!fat->is_infinite() && !sat->is_infinite())) + || (!fat->is_non_finite() && !sat->is_non_finite())) return false; // The variables must be equal modulo their type. diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc index 2de11c0f..08570adc 100644 --- a/src/abg-ctf-reader.cc +++ b/src/abg-ctf-reader.cc @@ -1231,7 +1231,7 @@ static array_type_def::subrange_sptr build_array_ctf_range(reader *rdr, ctf_dict_t *dic, ctf_id_t index, uint64_t nelems) { - bool is_infinite = false; + bool is_non_finite = false; corpus_sptr corp = rdr->corpus(); translation_unit_sptr tunit = rdr->cur_transl_unit(); array_type_def::subrange_sptr subrange; @@ -1247,7 +1247,7 @@ build_array_ctf_range(reader *rdr, ctf_dict_t *dic, /* for VLAs number of array elements is 0 */ if (upper_bound.get_unsigned_value() == 0 && nelems == 0) - is_infinite = true; + is_non_finite = true; subrange.reset(new array_type_def::subrange_type(rdr->env(), "", @@ -1259,7 +1259,7 @@ build_array_ctf_range(reader *rdr, ctf_dict_t *dic, if (!subrange) return nullptr; - subrange->is_infinite(is_infinite); + subrange->is_non_finite(is_non_finite); add_decl_to_scope(subrange, tunit->get_global_scope()); canonicalize(subrange); diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index f836fcff..6d64c0c7 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -14370,7 +14370,7 @@ build_subrange_type(reader& rdr, get_default_array_lower_bound(language); array_type_def::subrange_type::bound_value upper_bound; uint64_t count = 0; - bool is_infinite = false; + bool is_non_finite = false; bool non_zero_count_present = false; // The DWARF 4 specifications says, in [5.11 Subrange @@ -14427,13 +14427,13 @@ build_subrange_type(reader& rdr, // No upper_bound nor count was present on the DIE, this means // the array is considered to have an infinite (or rather not // known) size. - is_infinite = true; + is_non_finite = true; } if (UINT64_MAX == upper_bound.get_unsigned_value()) // If the upper_bound size is the max of the integer value // then it most certainly means unknown size. - is_infinite = true; + is_non_finite = true; result.reset (new array_type_def::subrange_type(rdr.env(), @@ -14441,13 +14441,13 @@ build_subrange_type(reader& rdr, lower_bound, upper_bound, location())); - result->is_infinite(is_infinite); + result->is_non_finite(is_non_finite); if (underlying_type) result->set_underlying_type(underlying_type); // Let's ensure the resulting subrange looks metabolically healhty. - ABG_ASSERT(result->is_infinite() + ABG_ASSERT(result->is_non_finite() || (result->get_length() == (uint64_t) (result->get_upper_bound() - result->get_lower_bound() + 1))); diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 9f053aef..162f4c0a 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -7630,7 +7630,7 @@ clone_array(const array_type_def_sptr& array) (*i)->get_underlying_type(), (*i)->get_location(), (*i)->get_language())); - subrange->is_infinite((*i)->is_infinite()); + subrange->is_non_finite((*i)->is_non_finite()); if (scope_decl *scope = (*i)->get_scope()) add_decl_to_scope(subrange, scope); subranges.push_back(subrange); @@ -10870,7 +10870,7 @@ has_flexible_array_data_member(const class_decl& klass) if (array_type_def_sptr array = is_array_type(dms.back()->get_type())) {// The type of the last data member is an array. - if (array->is_infinite()) + if (array->is_non_finite()) // The array has a non-finite size. We are thus looking at a // flexible array data member. Let's return it. return dms.back(); @@ -18825,7 +18825,7 @@ array_type_def::subrange_type::set_lower_bound(int64_t lb) uint64_t array_type_def::subrange_type::get_length() const { - if (is_infinite()) + if (is_non_finite()) return 0; // A subrange can have an upper bound that is lower than its lower @@ -18840,7 +18840,7 @@ array_type_def::subrange_type::get_length() const /// /// @return true iff the length of the subrange type is infinite. bool -array_type_def::subrange_type::is_infinite() const +array_type_def::subrange_type::is_non_finite() const {return priv_->infinite_;} /// Set the infinite-ness status of the subrange type. @@ -18848,7 +18848,7 @@ array_type_def::subrange_type::is_infinite() const /// @param f true iff the length of the subrange type should be set to /// being infinite. void -array_type_def::subrange_type::is_infinite(bool f) +array_type_def::subrange_type::is_non_finite(bool f) {priv_->infinite_ = f;} /// Getter of the language that generated this type. @@ -18873,7 +18873,7 @@ array_type_def::subrange_type::as_string() const o << ir::get_pretty_representation(underlying_type, false) << " "; o << "range "<< get_lower_bound() << " .. " << get_upper_bound(); } - else if (is_infinite()) + else if (is_non_finite()) o << "[]"; else o << "[" << get_length() << "]"; @@ -19388,7 +19388,7 @@ array_type_def::append_subranges(const std::vector& subs) /// if the array has no sub-range at all, also meaning that the size /// of the array is infinite. bool -array_type_def::is_infinite() const +array_type_def::is_non_finite() const { if (priv_->subranges_.empty()) return true; @@ -19397,7 +19397,7 @@ array_type_def::is_infinite() const priv_->subranges_.begin(); i != priv_->subranges_.end(); ++i) - if ((*i)->is_infinite()) + if ((*i)->is_non_finite()) return true; return false; diff --git a/src/abg-reader.cc b/src/abg-reader.cc index 91f6fcd5..096aa862 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -4405,11 +4405,11 @@ build_subrange_type(reader& rdr, uint64_t length = 0; string length_str; - bool is_infinite = false; + bool is_non_finite = false; if (xml_char_sptr s = XML_NODE_GET_ATTRIBUTE(node, "length")) { if (string(CHAR_STR(s)) == "infinite" || string(CHAR_STR(s)) == "unknown") - is_infinite = true; + is_non_finite = true; else length = strtoull(CHAR_STR(s), NULL, 0); } @@ -4423,7 +4423,7 @@ build_subrange_type(reader& rdr, if (!string(CHAR_STR(s)).empty()) upper_bound = strtoll(CHAR_STR(s), NULL, 0); bounds_present = true; - ABG_ASSERT(is_infinite + ABG_ASSERT(is_non_finite || (length == (uint64_t) upper_bound - lower_bound + 1)); } @@ -4446,7 +4446,7 @@ build_subrange_type(reader& rdr, // IR would reflect that, so let's stay compatible with that. array_type_def::subrange_type::bound_value max_bound; array_type_def::subrange_type::bound_value min_bound; - if (!is_infinite) + if (!is_non_finite) if (length > 0) // By default, if no 'lower-bound/upper-bound' attributes are // set, we assume that the lower bound is 0 and the upper bound @@ -4466,7 +4466,7 @@ build_subrange_type(reader& rdr, name, min_bound, max_bound, underlying_type, loc)); maybe_set_artificial_location(rdr, node, p); - p->is_infinite(is_infinite); + p->is_non_finite(is_non_finite); if (rdr.push_and_key_type_decl(p, node, add_to_current_scope)) rdr.map_xml_node_to_decl(node, p); diff --git a/src/abg-reporter-priv.cc b/src/abg-reporter-priv.cc index c8122af3..581c6f72 100644 --- a/src/abg-reporter-priv.cc +++ b/src/abg-reporter-priv.cc @@ -837,12 +837,12 @@ report_size_and_alignment_changes(type_or_decl_base_sptr first, // We are looking at size or alignment changes between two // arrays ... out << indent << "array type size changed from "; - if (first_array->is_infinite()) + if (first_array->is_non_finite()) out << "\'unknown\'"; else emit_num_value(first_array->get_size_in_bits(), *ctxt, out); out << " to "; - if (second_array->is_infinite()) + if (second_array->is_non_finite()) out << "\'unknown\'"; else emit_num_value(second_array->get_size_in_bits(), *ctxt, out); @@ -871,14 +871,14 @@ report_size_and_alignment_changes(type_or_decl_base_sptr first, << i - first_array->get_subranges().begin() + 1 << " changed length from "; - if ((*i)->is_infinite()) + if ((*i)->is_non_finite()) out << "\'unknown\'"; else out << (*i)->get_length(); out << " to "; - if ((*j)->is_infinite()) + if ((*j)->is_non_finite()) out << "\'unknown\'"; else out << (*j)->get_length(); diff --git a/src/abg-writer.cc b/src/abg-writer.cc index 24616364..46b5e67f 100644 --- a/src/abg-writer.cc +++ b/src/abg-writer.cc @@ -1511,7 +1511,7 @@ write_size_and_alignment(const shared_ptr decl, ostream& o, static void write_array_size_and_alignment(const shared_ptr decl, ostream& o) { - if (decl->is_infinite()) + if (decl->is_non_finite()) o << " size-in-bits='" << "unknown" << "'"; else { size_t size_in_bits = decl->get_size_in_bits(); @@ -3015,14 +3015,14 @@ write_array_subrange_type(const array_type_def::subrange_sptr& decl, o << " name='" << decl->get_name() << "'"; o << " length='"; - if (decl->is_infinite()) + if (decl->is_non_finite()) o << "unknown"; else o << decl->get_length(); o << "'"; - ABG_ASSERT(decl->is_infinite() + ABG_ASSERT(decl->is_non_finite() || decl->get_length() == 0 || (decl->get_length() == (uint64_t) (decl->get_upper_bound()