]> sourceware.org Git - libabigail.git/commit
Bug PR29443 - Global variables not emitted to abixml in some cases
authorDodji Seketeli <dodji@redhat.com>
Mon, 19 Sep 2022 14:52:26 +0000 (16:52 +0200)
committerDodji Seketeli <dodji@redhat.com>
Tue, 20 Sep 2022 06:55:59 +0000 (08:55 +0200)
commit6de60eb70ef2fdfee87f386410ffc8e67c436018
tree2e98b60928257de7a8e760e97a30c5efe7c0795c
parentad47854627f76c7959ae1a7ae59c9fcda38091c5
Bug PR29443 - Global variables not emitted to abixml in some cases

When a global variable named V has the same name as member variable
that appears in an anonymous scope and if the the abixml writer emits
the member variable V first, it gets confused when comes the time to
emit the global V as it wrongly thinks it's been already emitted.

This is because when emitting the "internal" pretty representation of
the member variable, libabigail fails to consider printing a qualified
name.  So the two 'V' wrongly have names that can't be told apart.

For instance consider the testcase example:

struct A {
  struct {
    int xx; // #0
  };
};

The qualified name of xx, for internal purposes (to name things
internally for the purpose of book keeping) would be:
    'A::__anonymous_struct__::xx'.

Libabigail wrongly names it 'xx', hence the confusion with the global variable.

Fixed thus.

* src/abg-ir.cc (var_decl::get_pretty_representation): Always use
qualified name of vars in an anonymous scope for internal
purposes.
* tests/data/test-annotate/PR29443-missing-xx.o.annotated.abi: New
reference test output.
* tests/test-annotate.cc (in_out_specs): Add the above to the test
harness.
* tests/data/test-read-dwarf/PR29443-missing-xx.cc: New source
code for the test.
* tests/data/test-read-dwarf/PR29443-missing-xx.o: New test input
binary.
* tests/data/test-read-dwarf/PR29443-missing-xx.o.abi: New test
reference output.
* tests/data/Makefile.am: Add the new test material to source
distribution.
* tests/test-read-dwarf.cc (in_out_specs): Add the above to the
test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-ir.cc
tests/data/Makefile.am
tests/data/test-annotate/PR29443-missing-xx.o.annotated.abi [new file with mode: 0644]
tests/data/test-read-dwarf/PR29443-missing-xx.cc [new file with mode: 0644]
tests/data/test-read-dwarf/PR29443-missing-xx.o [new file with mode: 0644]
tests/data/test-read-dwarf/PR29443-missing-xx.o.abi [new file with mode: 0644]
tests/test-annotate.cc
tests/test-read-dwarf.cc
This page took 0.033501 seconds and 5 git commands to generate.