]> sourceware.org Git - libabigail.git/commit
dwarf-reader: Canonicalize opaque enums and classes
authorDodji Seketeli <dodji@redhat.com>
Mon, 12 Apr 2021 10:48:14 +0000 (12:48 +0200)
committerDodji Seketeli <dodji@redhat.com>
Mon, 12 Apr 2021 13:47:44 +0000 (15:47 +0200)
commita16b922b11665d5405421a50d98f475cbbcbb300
treed0f7f4814cddd97206e415be4fd950ffcfce7275
parentacc4bea0b8fed335657878ee849adbd7b4238597
dwarf-reader: Canonicalize opaque enums and classes

This issue was reported in bug https://sourceware.org/bugzilla/show_bug.cgi?id=27700.

When we construct an opaque type (triggered by the use of
--drop-private-types along with the --headers-dir option on abidw, for
instance) with get_opaque_version_of_type we forget to canonicalize
the resulting type.

Later, at abixml emitting time (for instance)
hash_as_canonical_type_or_constant would rightfully abort because the
type wasn't canonicalized.  We want all types (okay, modulo one
exception) in the system to be canonicalized.

This patch fixes the problem by canonicalizing opaque types.

* src/abg-dwarf-reader.cc (build_ir_node_from_die): Canonicalize
opaque enums and classes.
* tests/data/test-read-dwarf/PR27700/include-dir/priv.h: New test
header file.
* tests/data/test-read-dwarf/PR27700/include-dir/pub.h: Likewise
* tests/data/test-read-dwarf/PR27700/pub-incdir/inc.h: Likewise.
* tests/data/test-read-dwarf/PR27700/test-PR27700.o: New binary
input file.
* tests/data/test-read-dwarf/PR27700/test-PR27700.abi: Reference
abi file of the binary above.
* tests/data/test-read-dwarf/PR27700/test-PR27700.c: Source file
of the binary above.
* tests/data/Makefile.am: Add the test material above to source
distribution.
* tests/test-read-dwarf.cc (InOutSpec::in_public_headers_path):
Add new data member.
(in_out_specs): Adjust to reflect the new data member in the
InOutSpec type.  Add a new test input.
(set_suppressions_from_headers): Define new static function.
(test_task::perform): Use the content of the new
InOutSpec::in_public_headers_path to construct and add
"--headers-dir <headers-dir> --drop-private-types" to the options
of the abidw program run.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-dwarf-reader.cc
tests/data/Makefile.am
tests/data/test-read-dwarf/PR27700/include-dir/priv.h [new file with mode: 0644]
tests/data/test-read-dwarf/PR27700/include-dir/pub.h [new file with mode: 0644]
tests/data/test-read-dwarf/PR27700/pub-incdir/inc.h [new file with mode: 0644]
tests/data/test-read-dwarf/PR27700/test-PR27700.abi [new file with mode: 0644]
tests/data/test-read-dwarf/PR27700/test-PR27700.c [new file with mode: 0644]
tests/data/test-read-dwarf/PR27700/test-PR27700.o [new file with mode: 0644]
tests/test-read-dwarf.cc
This page took 0.031805 seconds and 5 git commands to generate.