From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123178 invoked by alias); 5 Oct 2015 13:14:45 -0000 Mailing-List: contact libabigail-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: libabigail-owner@sourceware.org Received: (qmail 123149 invoked by uid 89); 5 Oct 2015 13:14:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.98.7 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.redhat.com To: libabigail@sourceware.org From: Ondrej Oprala Subject: [PATCH] Do not imply private access for members of a struct read from ABIXML Message-ID: <561277C1.4040605@redhat.com> Date: Thu, 01 Jan 2015 00:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080702050306080604010900" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-SW-Source: 2015-q4/txt/msg00016.txt.bz2 This is a multi-part message in MIME format. --------------080702050306080604010900 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 18 Cheers, Ondrej --------------080702050306080604010900 Content-Type: text/x-patch; name="0001-Do-not-imply-private-access-when-building-a-struct-f.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Do-not-imply-private-access-when-building-a-struct-f.pa"; filename*1="tch" Content-length: 2588 >From 81b028641a870f828be9df62cb6dd1faef9bec87 Mon Sep 17 00:00:00 2001 From: Ondrej Oprala Date: Mon, 5 Oct 2015 15:01:04 +0200 Subject: [PATCH] Do not imply private access when building a struct from ABIXML. * src/abg-reader.cc (read_context): Abort if we run into an unsupported access specifier. (build_class_decl) Default to public access for the children of a struct. Signed-off-by: Ondrej Oprala --- src/abg-reader.cc | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index 0eec58f..284c1f5 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -1727,7 +1727,9 @@ read_access(xmlNodePtr node, access_specifier& access) else if (a == "public") access = public_access; else - access = private_access; + /// If there is an access specifier of an unsupported value, + /// we should not assume anything and abort. + abort(); return true; } @@ -3435,7 +3437,10 @@ build_class_decl(read_context& ctxt, if (xmlStrEqual(n->name, BAD_CAST("base-class"))) { - access_specifier access = private_access; + access_specifier access = + is_struct + ? public_access + : private_access; read_access(n, access); string type_id; @@ -3462,7 +3467,10 @@ build_class_decl(read_context& ctxt, } else if (xmlStrEqual(n->name, BAD_CAST("member-type"))) { - access_specifier access = private_access; + access_specifier access = + is_struct + ? public_access + : private_access; read_access(n, access); ctxt.map_xml_node_to_decl(n, decl); @@ -3493,7 +3501,10 @@ build_class_decl(read_context& ctxt, { ctxt.map_xml_node_to_decl(n, decl); - access_specifier access = private_access; + access_specifier access = + is_struct + ? public_access + : private_access; read_access(n, access); bool is_laid_out = false; @@ -3523,7 +3534,10 @@ build_class_decl(read_context& ctxt, { ctxt.map_xml_node_to_decl(n, decl); - access_specifier access = private_access; + access_specifier access = + is_struct + ? public_access + : private_access; read_access(n, access); bool is_virtual = false; @@ -3568,7 +3582,10 @@ build_class_decl(read_context& ctxt, { ctxt.map_xml_node_to_decl(n, decl); - access_specifier access = private_access; + access_specifier access = + is_struct + ? public_access + : private_access; read_access(n, access); bool is_static = false; -- 2.4.3 --------------080702050306080604010900--