]> sourceware.org Git - libabigail.git/commit
Better Handle naming typedefs on anonymous enums
authorDodji Seketeli <dodji@redhat.com>
Thu, 14 Jul 2022 12:48:48 +0000 (14:48 +0200)
committerDodji Seketeli <dodji@redhat.com>
Thu, 14 Jul 2022 14:15:23 +0000 (16:15 +0200)
commit2b8b8bc5a8868d3ab9eae487fa64b4d4374e5297
tree4d00360153cf56caf7d841718ee21226100044e7
parent0b87414ce16e805fd8a54b17ce92fa606987f031
Better Handle naming typedefs on anonymous enums

While debugging a self comparison error, I realized that some types
where comparing different during IR type canonicalization for no good
reason.  Looking deeper, I realized it's due to an anonymous enum
comparing different to the same anonymous enum defined elsewhere.
Both anonymous enums have naming typedefs.  The discrepancy is due to
the fact that one of these enums didn't have its naming typedef
applied, by the DWARF reader. This is because the DWARF reader
"re-uses" typedef types whenever it can, and thus re-uses naming
typedefs too.  Thinking deeply about this, I think naming typedefs
should not be re-used, otherwise, some anonymous types would lack
their naming typedefs.  Oops.

So the patch avoids typedefs to be re-used altogether.  There doesn't
seem to be any performance hit.

With that fixed, another problem came up: Some typedefs of type foo
are compared to said type foo and the comparison yields "false",
wrongly.  This is in the context of a type 'foo' used by type 'bar'
defined in a translation unit, and the same type 'bar' uses a typedef
of 'foo' in another translation unit.  Both types 'bar' should compare
equal, but don't, today.  This is true especially for function types.
The patch strips typedefs off of the types of function parameters when
comparing function types.  To make things consistent, typedefs are
stripped off of function parameters when function types (and decls)
are pretty printed for internal purposes, especially for type
canonicalization.

* src/abg-dwarf-reader.cc (build_typedef_type): Do not re-use
typedefs.
* src/abg-ir.cc (get_function_type_name, get_method_type_name)
(function_decl::get_pretty_representation_of_declarator): Strip
typedefs when the function name is computed for internal purposes.
(equals):  In the overload for function_decl::parameter, strip
typedefs when comparing parameter types.
* tests/data/test-annotate/libtest23.so.abi: Adjust.
* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-diff-dwarf/test2-report.txt: Likewise.
* tests/data/test-diff-filter/test3-report.txt: Likewise.
* tests/data/test-diff-pkg/PR24690/PR24690-report-0.txt: Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.
* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
Likewise.
* tests/data/test-read-dwarf/libtest23.so.abi: Likewise.
* tests/data/test-read-dwarf/test-libaaudio.so.abi: Likewise.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Likewise.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
31 files changed:
src/abg-dwarf-reader.cc
src/abg-ir.cc
tests/data/test-annotate/libtest23.so.abi
tests/data/test-annotate/test14-pr18893.so.abi
tests/data/test-annotate/test15-pr18892.so.abi
tests/data/test-annotate/test17-pr19027.so.abi
tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi
tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi
tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi
tests/data/test-annotate/test21-pr19092.so.abi
tests/data/test-diff-dwarf/test2-report.txt
tests/data/test-diff-filter/test3-report.txt
tests/data/test-diff-pkg/PR24690/PR24690-report-0.txt
tests/data/test-read-dwarf/PR22122-libftdc.so.abi
tests/data/test-read-dwarf/PR25007-sdhci.ko.abi
tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi
tests/data/test-read-dwarf/libtest23.so.abi
tests/data/test-read-dwarf/test-libaaudio.so.abi
tests/data/test-read-dwarf/test-libandroid.so.abi
tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi
tests/data/test-read-dwarf/test12-pr18844.so.abi
tests/data/test-read-dwarf/test14-pr18893.so.abi
tests/data/test-read-dwarf/test15-pr18892.so.abi
tests/data/test-read-dwarf/test16-pr18904.so.abi
tests/data/test-read-dwarf/test17-pr19027.so.abi
tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi
tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi
tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi
tests/data/test-read-dwarf/test21-pr19092.so.abi
tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi
tests/data/test-read-dwarf/test9-pr18818-clang.so.abi
This page took 0.041632 seconds and 5 git commands to generate.