From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by sourceware.org (Postfix) with ESMTPS id D9A7B3857C53 for ; Tue, 7 Jul 2020 08:32:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D9A7B3857C53 Received: by mail-io1-xd43.google.com with SMTP id v8so42181916iox.2 for ; Tue, 07 Jul 2020 01:32:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=CG4xybb9mxBI3uRCieM6r3nPbevNuEuWHjUk4Ay6jnU=; b=E4Tn/C3LWCPyo04UV271y7HhLFkVsXIa3ZYu9e/8dI4UXeu74Es3fxnRQmQiTcIzzh ajs150sDinNnOjb24zAktZqQ1F6nQBorpndPDIZNTKi3g7mmnVygMK8v5zEcK88Dq8jz W9Twe9H8RSNjqKehPQD8aOfGYiCETa2AuT3QTL1ExUyaSpJbKjXaDCwAKIdy0k0bgC4+ 9dG/m7CXzlTWlKBfEefZBs1qPtldiqzmBAR7+74Z7BZO2F9LeHV/+3L5YEsGP+C2zXqk ZjnspzGLN0M1IVINq6YoIou8xyDpDEDN2w+VnMylHLD7r4GdV2GEkSu+KYG1QIiPWf2w CLYw== X-Gm-Message-State: AOAM532z/xQa3PsgbKz8OS/YksxrQGda2GTedB3Kh35CDZwVvANT7pq0 uF9yrpYE+DCL1X7tJJbh3EGhVK9IgtBk7GimjFcGjQ== X-Google-Smtp-Source: ABdhPJzLq/Q7jmkd7hIy5HSIZ+xc6QFmpCIWKs4tHnqUdvjMU/TA9BF2uRlSOk6QbAHom7TX9SW+cu/BY2/zvxbAlao= X-Received: by 2002:a02:7419:: with SMTP id o25mr4256856jac.46.1594110728090; Tue, 07 Jul 2020 01:32:08 -0700 (PDT) MIME-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> <20200610115940.26035-11-gprocida@google.com> <87imf0swvq.fsf@seketeli.org> In-Reply-To: <87imf0swvq.fsf@seketeli.org> From: Giuliano Procida Date: Tue, 7 Jul 2020 09:31:31 +0100 Message-ID: Subject: Re: [PATCH 10/11] Add declaration-only enums to XML reader/writer. To: Dodji Seketeli Cc: libabigail@sourceware.org, kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-29.5 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_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-List-Received-Date: Tue, 07 Jul 2020 08:32:11 -0000 Hi there. On Mon, 6 Jul 2020 at 12:31, Dodji Seketeli wrote: > > Giuliano Procida a =C3=A9crit: > > > Serialisation seems OK. > > > > Deserialisation quite likely needs declaration/definition resolution > > as there is logic for this for class types. > > I have amended this patch to make it work in the context of the changes > I have done on the earlier patches of the series. Namely, the > decl-only-ness property can now show up on any declaration, not just on > classes, unions and enums. I have also added a ChangeLog in the commit > log. > > I had to update a test reference output to reflect the new format. > > The amended patch below is also stacked up in the dodji/incomp-enums > branch, browsable at > https://sourceware.org/git/?p=3Dlibabigail.git;a=3Dshortlog;h=3Drefs/head= s/dodji/incomp-enums. > > Cheers, > > From 1469056ef52e5c2f44b276b5f058496a3416a716 Mon Sep 17 00:00:00 2001 > From: Giuliano Procida > Date: Wed, 10 Jun 2020 12:59:39 +0100 > Subject: [PATCH 3/4] Add declaration-only enums to XML reader/writer. > > * src/abg-reader.cc (build_enum_type_decl): Detect a > declaration-only enum and flag it as such. > (build_type_decl): Support reading the "is-declaration" attribute= . > (build_class_decl): Adjust. > * src/abg-writer.cc (write_is_declaration_only): Renamed > write_class_or_union_is_declaration_only into this. > (write_enum_is_declaration_only): Remove. > (write_type_decl, write_enum_type_decl) > (write_class_decl_opening_tag, write_union_decl_opening_tag): Use > write_is_declaration_only. > * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Adjust. > > Signed-off-by: Giuliano Procida > Signed-off-by: Dodji Seketeli > --- > src/abg-reader.cc | 13 ++++++-- > src/abg-writer.cc | 22 +++++++------- > tests/data/test-read-dwarf/PR22122-libftdc.so.abi | 36 +++++++++++------= ------ > 3 files changed, 39 insertions(+), 32 deletions(-) > > diff --git a/src/abg-reader.cc b/src/abg-reader.cc > index eb74659..6e37f7c 100644 > --- a/src/abg-reader.cc > +++ b/src/abg-reader.cc > @@ -3457,6 +3457,9 @@ build_type_decl(read_context& ctxt, > if (xml_char_sptr s =3D XML_NODE_GET_ATTRIBUTE(node, "alignment-in-bit= s")) > alignment_in_bits =3D atoi(CHAR_STR(s)); > > + bool is_decl_only =3D false; > + read_is_declaration_only(node, is_decl_only); > + > location loc; > read_location(ctxt, node, loc); > > @@ -3479,6 +3482,7 @@ build_type_decl(read_context& ctxt, > type_decl_sptr decl(new type_decl(env, name, size_in_bits, > alignment_in_bits, loc)); > decl->set_is_anonymous(is_anonymous); > + decl->set_is_declaration_only(is_decl_only); > if (ctxt.push_and_key_type_decl(decl, id, add_to_current_scope)) > { > ctxt.map_xml_node_to_decl(node, decl); > @@ -4161,6 +4165,9 @@ build_enum_type_decl(read_context& ctxt, > location loc; > read_location(ctxt, node, loc); > > + bool is_decl_only =3D false; > + read_is_declaration_only(node, is_decl_only); > + > bool is_anonymous =3D false; > read_is_anonymous(node, is_anonymous); > > @@ -4221,6 +4228,7 @@ build_enum_type_decl(read_context& ctxt, > enums, linkage_name)); > t->set_is_anonymous(is_anonymous); > t->set_is_artificial(is_artificial); > + t->set_is_declaration_only(is_decl_only); // TODO: more to do here! I think this TODO was related to resolution and is dead. (Note to self: write better TODO text.) > if (ctxt.push_and_key_type_decl(t, id, add_to_current_scope)) > { > ctxt.map_xml_node_to_decl(node, t); > @@ -4488,8 +4496,7 @@ build_class_decl(read_context& ctxt, > > if (!def_id.empty()) > { > - class_decl_sptr d =3D > - dynamic_pointer_cast(ctxt.get_type_decl(def_id)); > + decl_base_sptr d =3D is_decl(ctxt.get_type_decl(def_id)); > if (d && d->get_is_declaration_only()) > { > is_def_of_decl =3D true; > @@ -4507,7 +4514,7 @@ build_class_decl(read_context& ctxt, > // previous_declaration. > // > // Let's link them. > - decl->set_earlier_declaration(previous_declaration); > + decl->set_earlier_declaration(is_decl(previous_declaration)); > for (vector::const_iterator i =3D types_ptr->begin= (); > i !=3D types_ptr->end(); > ++i) > diff --git a/src/abg-writer.cc b/src/abg-writer.cc > index ce0bae2..bf44c76 100644 > --- a/src/abg-writer.cc > +++ b/src/abg-writer.cc > @@ -876,8 +876,7 @@ static void write_elf_symbol_binding(elf_symbol::bind= ing, ostream&); > static bool write_elf_symbol_aliases(const elf_symbol&, ostream&); > static bool write_elf_symbol_reference(const elf_symbol&, ostream&); > static bool write_elf_symbol_reference(const elf_symbol_sptr, ostream&); > -static void write_class_or_union_is_declaration_only(const class_or_unio= n_sptr&, > - ostream&); > +static void write_is_declaration_only(const decl_base_sptr&, ostream&); > static void write_is_struct(const class_decl_sptr&, ostream&); > static void write_is_anonymous(const decl_base_sptr&, ostream&); > static void write_naming_typedef(const class_decl_sptr&, write_context&)= ; > @@ -1777,18 +1776,16 @@ write_cdtor_const_static(bool is_ctor, > o << " const=3D'yes'"; > } > > -/// Serialize the attribute "is-declaration-only", if the class or > -/// union has its 'is_declaration_only property set. > +/// Serialize the attribute "is-declaration-only", if the > +/// decl_base_sptr has its 'is_declaration_only property set. > /// > -/// @param t the pointer to instance of @ref class_or_union to > -/// consider. > +/// @param t the pointer to instance of @ref decl_base to consider. > /// > /// @param o the output stream to serialize to. > static void > -write_class_or_union_is_declaration_only(const class_or_union_sptr& t, > - ostream& o) > +write_is_declaration_only(const decl_base_sptr& d, ostream& o) > { > - if (t->get_is_declaration_only()) > + if (d->get_is_declaration_only()) > o << " is-declaration-only=3D'yes'"; > } > > @@ -2459,6 +2456,8 @@ write_type_decl(const type_decl_sptr& d, write_cont= ext& ctxt, unsigned indent) > > write_size_and_alignment(d, o); > > + write_is_declaration_only(d, o); > + > write_location(d, ctxt); > > o << " id=3D'" << ctxt.get_id_for_type(d) << "'" << "/>"; > @@ -2938,6 +2937,7 @@ write_enum_type_decl(const enum_type_decl_sptr& dec= l, > o << " linkage-name=3D'" << decl->get_linkage_name() << "'"; > > write_location(decl, ctxt); > + write_is_declaration_only(decl, o); > > string i =3D id; > if (i.empty()) > @@ -3475,7 +3475,7 @@ write_class_decl_opening_tag(const class_decl_sptr&= decl, > > write_location(decl, ctxt); > > - write_class_or_union_is_declaration_only(decl, o); > + write_is_declaration_only(decl, o); > > if (decl->get_earlier_declaration()) > { > @@ -3549,7 +3549,7 @@ write_union_decl_opening_tag(const union_decl_sptr&= decl, > > write_location(decl, ctxt); > > - write_class_or_union_is_declaration_only(decl, o); > + write_is_declaration_only(decl, o); > > string i =3D id; > if (i.empty()) > diff --git a/tests/data/test-read-dwarf/PR22122-libftdc.so.abi b/tests/da= ta/test-read-dwarf/PR22122-libftdc.so.abi > index 28df268..7ea5341 100644 > --- a/tests/data/test-read-dwarf/PR22122-libftdc.so.abi > +++ b/tests/data/test-read-dwarf/PR22122-libftdc.so.abi > @@ -270,7 +270,7 @@ > > > > - > + > > > > @@ -500,7 +500,7 @@ > > > > - > + > > > > @@ -969,7 +969,7 @@ > > > > - > + > > > > @@ -1140,7 +1140,7 @@ > > > > - > + > > > > @@ -3878,7 +3878,7 @@ > > > > - > + > > > > @@ -4401,7 +4401,7 @@ > > > > - > + > > > > @@ -5356,7 +5356,7 @@ > > > > - > + > > > > @@ -5409,7 +5409,7 @@ > > > > - > + > > > > @@ -5427,7 +5427,7 @@ > > > > - > + > > > > @@ -7103,14 +7103,14 @@ > > > > - > + > > > > > > > - > + > > > > @@ -7272,7 +7272,7 @@ > > > > - > + > > > > @@ -7456,7 +7456,7 @@ > > > > - > + > > > > @@ -7905,7 +7905,7 @@ > > > > - > + > > > > @@ -7986,7 +7986,7 @@ > > > > - > + > > > > @@ -8680,7 +8680,7 @@ > > > > - > + > > > > @@ -8809,7 +8809,7 @@ > > > > - > + > > > > @@ -8864,7 +8864,7 @@ > > > > - > + > > > > -- > 1.8.3.1 > > > -- > Dodji Regards, Giuliano.