public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Ondrej Oprala <ooprala@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH] Do not imply private access for members of a struct read from ABIXML
Date: Thu, 01 Jan 2015 00:00:00 -0000	[thread overview]
Message-ID: <561277C1.4040605@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 18 bytes --]

Cheers,
   Ondrej

[-- Attachment #2: 0001-Do-not-imply-private-access-when-building-a-struct-f.patch --]
[-- Type: text/x-patch, Size: 2587 bytes --]

From 81b028641a870f828be9df62cb6dd1faef9bec87 Mon Sep 17 00:00:00 2001
From: Ondrej Oprala <ooprala@redhat.com>
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 <ooprala@redhat.com>
---
 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


             reply	other threads:[~2015-10-05 13:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-01  0:00 Ondrej Oprala [this message]
2015-01-01  0:00 ` Dodji Seketeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561277C1.4040605@redhat.com \
    --to=ooprala@redhat.com \
    --cc=libabigail@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).