The Git repository of the Libabigail Project
Go to file
Dodji Seketeli a07fce3669 ir: Introduce internal pretty representation for anonymous classes
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>
2020-11-27 13:53:15 +01:00
autoconf-archive Do not ignore valgrind checks returning an error 2017-02-27 10:01:15 +01:00
bash-completion Add --self-compare option in fedabipkgdiff 2017-05-31 16:21:14 +05:30
doc abipkgdiff: Add a new --self-check option 2020-11-23 17:50:05 +01:00
include ir: Introduce internal pretty representation for anonymous classes 2020-11-27 13:53:15 +01:00
m4
scripts Clean up scripts/* 2017-04-14 04:14:12 -04:00
src ir: Introduce internal pretty representation for anonymous classes 2020-11-27 13:53:15 +01:00
tests ir: Introduce internal pretty representation for anonymous classes 2020-11-27 13:53:15 +01:00
tools abipkgdiff: Avoid uncertainty when sorting worker tasks 2020-11-25 13:17:21 +01:00
.clang-format clang-format: set continuation indentation to 2 2020-05-18 10:48:09 +02:00
.gitignore .gitignore: Add libabigail-?.* *.orig files 2019-05-22 14:34:23 +02:00
abigail.m4 abigail.m4: Fix copyright notice 2020-05-29 18:11:10 +02:00
AUTHORS
ChangeLog Update ChangeLog 2020-02-26 12:08:52 +01:00
COMMIT-LOG-GUIDELINES
COMPILING Fix typo in COMPILING. 2020-02-03 13:49:54 +01:00
configure.ac dwarf-reader: support artificially generated translation units 2020-11-24 05:04:06 +01:00
CONTRIBUTING Control symbols exported from libabigail.so 2016-07-27 12:51:02 +02:00
COPYING
COPYING-GPLV3
COPYING-LGPLV2
COPYING-LGPLV3
default.abignore Add default suppression specification for the libvirt project 2018-10-11 10:59:54 +02:00
gen-changelog.py gen-changelog.py: Update the script for python3 2020-02-26 12:06:17 +01:00
install-sh
libabigail.pc.in
ltmain.sh
Makefile.am Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
NEWS Update NEWS file for 1.7 2020-02-26 12:07:29 +01:00
README
release-text-template.txt Update the release text template after 1.0 2017-11-22 15:55:43 +01:00
update-copyright.sh Update copyright year to 2020 2020-02-21 17:05:01 +01:00
VISIBILITY Control symbols exported from libabigail.so 2016-07-27 12:51:02 +02:00

This is the Application Binary Interface Generic Analysis and
Instrumentation Library.

It aims at constructing, manipulating, serializing and de-serializing
ABI-relevant artifacts.

The set of artifacts that we are intersted is made of quantities like
types, variable, fonctions and declarations of a given library or
program.  For a given library or program this set of quantities is
called an ABI corpus.

This library aims at (among other things) providing a way to compare
two ABI Corpora (apparently the plural of corpus is copora, heh,
that's cool), provide detailed information about their differences,
and help build tools to infer interesting conclusions about these
differences.

You are welcome to contribute to this project after reading the files
CONTRIBUTING and COMMIT-LOG-GUIDELINES files in the source tree.

Communicating with the maintainers of this project -- including
sending patches to be include to the source code -- happens via email
at libabigail@sourceware.org.