mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-16 23:14:36 +00:00
a07fce3669
There are two views for internal pretty representation of anonymous classes. 1/ When we look at the anonymous class itself, we use its 'flat representation' i.e: 'class {int blah; char bleh;}' 2/ When we look at a pointer or a reference to the anonymous class we use its generic anonymous internal name, i.e: '__anonymous_struct__*' As a general rule, libabigail always use the keyword 'class' to prefix the name of classes for internal purposes, independent from the fact that the type is a struct or a class. That is a pre-requisite to be able to canonicalize classes and structs together. In other words, if a class and a struct are structurally equal, they are going to be considered equivalent by the canonicalization process. Currently however, in the view 1/ of the pretty representation of anonymous classes, a struct and a class will have different representations. For instance, and empty anonymous struct would be represented as 'struct {}', whereas an empty anonymous class would be represented as 'class {}'. This prevents these two be considered equivalent by the canonicalization process. This leads to spurious change reports later down the road. In the view 2/ we have a similar but different problem: the qualified names of the anonymous classes are not taken into account when representing pointer or references to said anonymous classes. Only their unqualified generic anonymous internal names are taken into account in the representation. This leads to pointers/references to anonymous classes being wrongly considered equivalent even when they belong to different namespaces. This patch corrects the issues related to both views 1/ and 2/. It should make libabigail correctly consider some anonymous classes as equivalent (view 1) and correctly consider pointers/references to anonymous classes as different when they belong to different namespaces (view 2). A number of reference tests are adjusted accordingly. * include/abg-fwd.h (get_class_or_union_flat_representation): Introduce an "internal" parameter. * src/abg-ir.cc (get_class_or_union_flat_representation): Introduce an "internal" parameter. In the flat representation of a class for internal purposes, always use the prefix "class" even if this is a struct. (get_type_name): To build an internal name for a reference or pointer to an anonymous type, consider the namespace name of said type. (equals): In the overload for decl_base, take the namespace name of anonymous decls into account when comparing them. ({var_decl, union_decl}::get_pretty_representation): Adjust calls to get_class_or_union_flat_representation to pass a proper "internal" argument. * src/abg-default-reporter.cc (default_reporter::report): Adjust the call to get_class_or_union_flat_representation to pass an "internal" argument set to 'false'. * tests/data/test-annotate/libtest23.so.abi: Adjust. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
---|---|---|
.. | ||
abg-comp-filter.h | ||
abg-comparison.h | ||
abg-config.h | ||
abg-corpus.h | ||
abg-cxx-compat.h | ||
abg-diff-utils.h | ||
abg-dwarf-reader.h | ||
abg-fwd.h | ||
abg-hash.h | ||
abg-ini.h | ||
abg-interned-str.h | ||
abg-ir.h | ||
abg-libxml-utils.h | ||
abg-libzip-utils.h | ||
abg-reader.h | ||
abg-regex.h | ||
abg-reporter.h | ||
abg-sptr-utils.h | ||
abg-suppression.h | ||
abg-tools-utils.h | ||
abg-traverse.h | ||
abg-version.h.in | ||
abg-viz-common.h | ||
abg-viz-dot.h | ||
abg-viz-svg.h | ||
abg-workers.h | ||
abg-writer.h | ||
Makefile.am |