abg-ir.cc: Remove always-true check.
Commit Message
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(-)
Comments
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
>
>
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
> >
> >
@@ -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(),