public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] abg-ir.cc: Remove always-true check.
@ 2020-03-19  9:02 Giuliano Procida
  2020-03-19 12:54 ` Matthias Maennich
  0 siblings, 1 reply; 5+ messages in thread
From: Giuliano Procida @ 2020-03-19  9:02 UTC (permalink / raw)
  To: libabigail; +Cc: dodji, kernel-team, gprocida

There is an instance of a if-statement testing the same variable as
its containing if-statement. The inner test always evaluates to true,
if it is reached.

	* src/abg-ir.cc (types_have_similar_structure): Remove
        identical nested conditional.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-ir.cc | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 13023295..83602b8a 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -22669,11 +22669,10 @@ types_have_similar_structure(const type_base* first, const type_base* second)
 
       if (!was_indirect_type)
 	{
-	  if (!was_indirect_type)
-	    if ((ty1->get_size_in_bits() != ty2->get_size_in_bits())
-		|| (ty1->get_non_static_data_members().size()
-		    != ty2->get_non_static_data_members().size()))
-	      return false;
+          if ((ty1->get_size_in_bits() != ty2->get_size_in_bits())
+              || (ty1->get_non_static_data_members().size()
+                  != ty2->get_non_static_data_members().size()))
+            return false;
 
 	  for (class_or_union::data_members::const_iterator
 		 i = ty1->get_non_static_data_members().begin(),
-- 
2.25.1.481.gfbce0eb801-goog


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

* Re: [PATCH] abg-ir.cc: Remove always-true check.
  2020-03-19  9:02 [PATCH] abg-ir.cc: Remove always-true check Giuliano Procida
@ 2020-03-19 12:54 ` Matthias Maennich
  2020-03-19 14:18   ` Giuliano Procida
  0 siblings, 1 reply; 5+ messages in thread
From: Matthias Maennich @ 2020-03-19 12:54 UTC (permalink / raw)
  To: Giuliano Procida; +Cc: libabigail, dodji, kernel-team

On Thu, Mar 19, 2020 at 09:02:05AM +0000, Android Kernel Team wrote:
>There is an instance of a if-statement testing the same variable as
>its containing if-statement. The inner test always evaluates to true,
>if it is reached.
>
>	* src/abg-ir.cc (types_have_similar_structure): Remove
>        identical nested conditional.
>
>Signed-off-by: Giuliano Procida <gprocida@google.com>
>---
> src/abg-ir.cc | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
>diff --git a/src/abg-ir.cc b/src/abg-ir.cc
>index 13023295..83602b8a 100644
>--- a/src/abg-ir.cc
>+++ b/src/abg-ir.cc
>@@ -22669,11 +22669,10 @@ types_have_similar_structure(const type_base* first, const type_base* second)
>
>       if (!was_indirect_type)
> 	{
>-	  if (!was_indirect_type)
>-	    if ((ty1->get_size_in_bits() != ty2->get_size_in_bits())
>-		|| (ty1->get_non_static_data_members().size()
>-		    != ty2->get_non_static_data_members().size()))
>-	      return false;
>+          if ((ty1->get_size_in_bits() != ty2->get_size_in_bits())
>+              || (ty1->get_non_static_data_members().size()
>+                  != ty2->get_non_static_data_members().size()))
>+            return false;

I think the tabs got lost and hence formatting needs to be fixed.
But I generally agree with the patch.

Reviewed-by: Matthias Maennich <maennich@google.com>

Cheers,
Matthias


>
> 	  for (class_or_union::data_members::const_iterator
> 		 i = ty1->get_non_static_data_members().begin(),
>-- 
>2.25.1.481.gfbce0eb801-goog
>
>

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

* Re: [PATCH] abg-ir.cc: Remove always-true check.
  2020-03-19 12:54 ` Matthias Maennich
@ 2020-03-19 14:18   ` Giuliano Procida
  2020-03-19 14:31     ` [PATCH v2] " Giuliano Procida
  0 siblings, 1 reply; 5+ messages in thread
From: Giuliano Procida @ 2020-03-19 14:18 UTC (permalink / raw)
  To: Matthias Maennich; +Cc: libabigail, Dodji Seketeli, kernel-team

Hi.

On Thu, 19 Mar 2020 at 12:54, Matthias Maennich <maennich@google.com> wrote:
>
> On Thu, Mar 19, 2020 at 09:02:05AM +0000, Android Kernel Team wrote:
> >There is an instance of a if-statement testing the same variable as
> >its containing if-statement. The inner test always evaluates to true,
> >if it is reached.
> >
> >       * src/abg-ir.cc (types_have_similar_structure): Remove
> >        identical nested conditional.
> >
> >Signed-off-by: Giuliano Procida <gprocida@google.com>
> >---
> > src/abg-ir.cc | 9 ++++-----
> > 1 file changed, 4 insertions(+), 5 deletions(-)
> >
> >diff --git a/src/abg-ir.cc b/src/abg-ir.cc
> >index 13023295..83602b8a 100644
> >--- a/src/abg-ir.cc
> >+++ b/src/abg-ir.cc
> >@@ -22669,11 +22669,10 @@ types_have_similar_structure(const type_base* first, const type_base* second)
> >
> >       if (!was_indirect_type)
> >       {
> >-        if (!was_indirect_type)
> >-          if ((ty1->get_size_in_bits() != ty2->get_size_in_bits())
> >-              || (ty1->get_non_static_data_members().size()
> >-                  != ty2->get_non_static_data_members().size()))
> >-            return false;
> >+          if ((ty1->get_size_in_bits() != ty2->get_size_in_bits())
> >+              || (ty1->get_non_static_data_members().size()
> >+                  != ty2->get_non_static_data_members().size()))
> >+            return false;
>
> I think the tabs got lost and hence formatting needs to be fixed.
> But I generally agree with the patch.

*sigh*
v2 on the way.

> Reviewed-by: Matthias Maennich <maennich@google.com>
>
> Cheers,
> Matthias
>
>
> >
> >         for (class_or_union::data_members::const_iterator
> >                i = ty1->get_non_static_data_members().begin(),
> >--
> >2.25.1.481.gfbce0eb801-goog
> >
> >

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

* [PATCH v2] abg-ir.cc: Remove always-true check.
  2020-03-19 14:18   ` Giuliano Procida
@ 2020-03-19 14:31     ` Giuliano Procida
  2020-03-20 23:39       ` Dodji Seketeli
  0 siblings, 1 reply; 5+ messages in thread
From: Giuliano Procida @ 2020-03-19 14:31 UTC (permalink / raw)
  To: libabigail; +Cc: dodji, kernel-team, gprocida, Matthias Maennich

There is an instance of a if-statement testing the same variable as
its containing if-statement. The inner test always evaluates to true,
if it is reached.

	* src/abg-ir.cc (types_have_similar_structure): Remove
	identical nested conditional.
	(reference_type_def::reference_type_def): Tabify.

Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-ir.cc | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 13023295..e84114cc 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -13573,10 +13573,10 @@ reference_type_def::reference_type_def(const type_base_sptr	pointed_to,
       decl_base_sptr pto = dynamic_pointer_cast<decl_base>(pointed_to);
       string name;
       if (pto)
-        {
-          set_visibility(pto->get_visibility());
-          name = string(pto->get_name()) + "&";
-        }
+	{
+	  set_visibility(pto->get_visibility());
+	  name = string(pto->get_name()) + "&";
+	}
       else
 	name = string(get_type_name(is_function_type(pointed_to),
 				    /*qualified_name=*/true)) + "&";
@@ -22669,11 +22669,10 @@ types_have_similar_structure(const type_base* first, const type_base* second)
 
       if (!was_indirect_type)
 	{
-	  if (!was_indirect_type)
-	    if ((ty1->get_size_in_bits() != ty2->get_size_in_bits())
-		|| (ty1->get_non_static_data_members().size()
-		    != ty2->get_non_static_data_members().size()))
-	      return false;
+	  if ((ty1->get_size_in_bits() != ty2->get_size_in_bits())
+	      || (ty1->get_non_static_data_members().size()
+		  != ty2->get_non_static_data_members().size()))
+	    return false;
 
 	  for (class_or_union::data_members::const_iterator
 		 i = ty1->get_non_static_data_members().begin(),
-- 
2.25.1.481.gfbce0eb801-goog


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

* Re: [PATCH v2] abg-ir.cc: Remove always-true check.
  2020-03-19 14:31     ` [PATCH v2] " Giuliano Procida
@ 2020-03-20 23:39       ` Dodji Seketeli
  0 siblings, 0 replies; 5+ messages in thread
From: Dodji Seketeli @ 2020-03-20 23:39 UTC (permalink / raw)
  To: Giuliano Procida; +Cc: libabigail, kernel-team, Matthias Maennich

Giuliano Procida <gprocida@google.com> a écrit:

> There is an instance of a if-statement testing the same variable as
> its containing if-statement. The inner test always evaluates to true,
> if it is reached.
>
> 	* src/abg-ir.cc (types_have_similar_structure): Remove
> 	identical nested conditional.
> 	(reference_type_def::reference_type_def): Tabify.

Applied to master.

Thanks.

-- 
		Dodji

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

end of thread, other threads:[~2020-03-20 23:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19  9:02 [PATCH] abg-ir.cc: Remove always-true check Giuliano Procida
2020-03-19 12:54 ` Matthias Maennich
2020-03-19 14:18   ` Giuliano Procida
2020-03-19 14:31     ` [PATCH v2] " Giuliano Procida
2020-03-20 23:39       ` 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).