* [PATCH] get_canonical_type_for: restore environment better
@ 2020-06-17 16:17 Giuliano Procida
2020-06-24 5:40 ` Dodji Seketeli
0 siblings, 1 reply; 2+ messages in thread
From: Giuliano Procida @ 2020-06-17 16:17 UTC (permalink / raw)
To: libabigail; +Cc: dodji, kernel-team, gprocida
The method type_base::get_canonical_type_for contains some logic which
temporarily changes a couple of control flags in the type's
environment. It then restores these, but not consistently.
This patch ensures the flags are restored unconditionally.
* src/abg-ir.cc (get_canonical_type_for): Ensure the
do_on_the_fly_canonicalization and
decl_only_class_equals_definition flags are restored
unconditionally.
Signed-off-by: Giuliano Procida <gprocida@google.com>
---
src/abg-ir.cc | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 5e2506a2..f3801d56 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -11912,26 +11912,19 @@ type_base::get_canonical_type_for(type_base_sptr t)
// Compare types by considering that decl-only classes don't
// equal their definition.
env->decl_only_class_equals_definition(false);
- if (types_defined_same_linux_kernel_corpus_public(**it, *t))
- {
- result = *it;
- break;
- }
- if (*it == t)
+ bool equal = types_defined_same_linux_kernel_corpus_public(**it, *t)
+ || *it == t;
+ // Restore the state of the on-the-fly-canonicalization and
+ // the decl-only-class-being-equal-to-a-matching-definition
+ // flags.
+ env->do_on_the_fly_canonicalization(false);
+ env->decl_only_class_equals_definition
+ (saved_decl_only_class_equals_definition);
+ if (equal)
{
- // Restore the state of the on-the-fly-canonicalization
- // and the
- // decl-only-class-being-equal-to-a-matching-definition
- // flags, as we are getting out of the loop.
- env->do_on_the_fly_canonicalization(false);
- env->decl_only_class_equals_definition
- (saved_decl_only_class_equals_definition);
result = *it;
break;
}
- env->do_on_the_fly_canonicalization(false);
- env->decl_only_class_equals_definition
- (saved_decl_only_class_equals_definition);
}
if (!result)
{
--
2.27.0.290.gba653c62da-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] get_canonical_type_for: restore environment better
2020-06-17 16:17 [PATCH] get_canonical_type_for: restore environment better Giuliano Procida
@ 2020-06-24 5:40 ` Dodji Seketeli
0 siblings, 0 replies; 2+ messages in thread
From: Dodji Seketeli @ 2020-06-24 5:40 UTC (permalink / raw)
To: Giuliano Procida; +Cc: libabigail, kernel-team
Giuliano Procida <gprocida@google.com> a écrit:
> The method type_base::get_canonical_type_for contains some logic which
> temporarily changes a couple of control flags in the type's
> environment. It then restores these, but not consistently.
>
> This patch ensures the flags are restored unconditionally.
>
> * src/abg-ir.cc (get_canonical_type_for): Ensure the
> do_on_the_fly_canonicalization and
> decl_only_class_equals_definition flags are restored
> unconditionally.
>
> Signed-off-by: Giuliano Procida <gprocida@google.com>
Applied to master, thanks!
Cheers,
--
Dodji
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-24 5:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 16:17 [PATCH] get_canonical_type_for: restore environment better Giuliano Procida
2020-06-24 5:40 ` 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).