public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] Do not imply private access for members of a struct read from ABIXML
  2015-01-01  0:00 [PATCH] Do not imply private access for members of a struct read from ABIXML Ondrej Oprala
@ 2015-01-01  0:00 ` Dodji Seketeli
  0 siblings, 0 replies; 2+ messages in thread
From: Dodji Seketeli @ 2015-01-01  0:00 UTC (permalink / raw)
  To: Ondrej Oprala; +Cc: libabigail

Hey,

Ondrej Oprala <ooprala@redhat.com> a écrit:

> 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>

This is OK to commit to master, if it passes make distcheck.

Thanks!

-- 
		Dodji

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Do not imply private access for members of a struct read from ABIXML
@ 2015-01-01  0:00 Ondrej Oprala
  2015-01-01  0:00 ` Dodji Seketeli
  0 siblings, 1 reply; 2+ messages in thread
From: Ondrej Oprala @ 2015-01-01  0:00 UTC (permalink / raw)
  To: libabigail

[-- 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-05 15:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-01  0:00 [PATCH] Do not imply private access for members of a struct read from ABIXML Ondrej Oprala
2015-01-01  0:00 ` Dodji Seketeli

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).