mirror of
git://sourceware.org/git/libabigail.git
synced 2025-02-22 16:56:57 +00:00
The Git repository of the Libabigail Project
Whenever there is a change in unreachable type, corpus_diff::has_incompatible_changes always reports that the corresponding diff node carries an incompatible change. It does this even if the change is known to be compatible. To be able to say if a diff node for a unreachable type carries a compatible (not incompatible) change, corpus_diff::has_incompatible_changes must look at the change category of that diff node, instead of saying that any change to an unreachable type is incompatible. While looking at this, I noted that corpus_diff::priv::apply_filters_and_compute_diff_stats doesn't categorize the diffs in corpus_diff::priv::changed_unreachable_types_, so it's not possible to look at the categories of the changes held by that data member to see if they are incompatible or not. This patch thus categorizes the diff nodes held by corpus_diff::priv::changed_unreachable_types_ and makes corpus_diff::has_incompatible_changes look at those diff nodes to detect if they are incompatible. Let's see the result of this patch. Consider the change in the input test source code from included in this patch, from test-enumerator-changes1-v0.c to test-enumerator-changes1-v1.c: $ diff -u test-enumerator-changes1-v0.c test-enumerator-changes1-v1.c --- test-enumerator-changes1-v0.c 2023-10-04 11:25:30.722989530 +0200 +++ test-enumerator-changes1-v1.c 2023-10-04 11:25:30.722989530 +0200 @@ -1,13 +1,14 @@ /* * * Compile this with: - * gcc -g -c -fno-eliminate-unused-debug-types test-enumerator-changes1-v0.c + * gcc -g -c -fno-eliminate-unused-debug-types test-enumerator-changes1-v1.c */ enum foo { E1_O, - E1_1 + E1_1, + E1_2 }; void $ The enumerator E1_2 has been added to the 'foo' enum. Now, let's see what abidiff prior to this patch would say about the change between the two result binaries test-enumerator-changes1-v0.o and test-enumerator-changes1-v1.o: $ abidiff --non-reachable-types --harmless test-enumerator-changes1-v0.o test-enumerator-changes1-v1.o || echo "return value: $?" Functions changes summary: 0 Removed, 0 Changed, 0 Added function Variables changes summary: 0 Removed, 0 Changed, 0 Added variable Unreachable types summary: 0 removed, 1 changed, 0 added type 1 changed type unreachable from any public interface: [C] 'enum foo' changed: type size hasn't changed 1 enumerator insertion: 'foo::E1_2' value '2' return value: 12 $ See the return value of 12, that is actually the bits abigail::tools_utils::ABIDIFF_ABI_CHANGE (of value 4) and abigail::tools_utils::ABIDIFF_ABI_INCOMPATIBLE_CHANGE (of value 8) being set. Normally, only the bit abigail::tools_utils::ABIDIFF_ABI_CHANGE (of value 4) should be set. Now, let's look at what abidiff says with this patch: $ abidiff --non-reachable-types --harmless test-enumerator-changes1-v0.o test-enumerator-changes1-v1.o || echo "return value: $?" Functions changes summary: 0 Removed, 0 Changed, 0 Added function Variables changes summary: 0 Removed, 0 Changed, 0 Added variable Unreachable types summary: 0 removed, 1 changed, 0 added type 1 changed type unreachable from any public interface: [C] 'enum foo' changed: type size hasn't changed 1 enumerator insertion: 'foo::E1_2' value '2' return value: 4 $ Now the return value is 4, which is the bit abigail::tools_utils::ABIDIFF_ABI_CHANGE being set, as we would expect because that change is known to be not incompatible. * Src/abg-comparison-priv.h (corpus_diff::priv::changed_unreachable_types): Declare ... * src/abg-comparison.cc (corpus_diff::priv::changed_unreachable_types): ... new function. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Walk the nodes returned by corpus_diff:priv::changed_unreachable_types and apply the filters (including categorization filters) to them. Also make the loop similarly applying filters to the nodes returned by corpus_diff::priv::changed_unreachable_types_sorted be a ranged-based one, for the sake of consistency. (corpus_diff::has_incompatible_changes): Now that diff nodes returned by corpus_diff::priv::changed_unreachable_types are categorized, look at their change categories to see if they are incompatible or not. * tests/data/test-abidiff-exit/test-enumerator-changes1-report-1.txt: New test output reference. * tests/data/test-abidiff-exit/test-enumerator-changes1-v{0,1}.o: New test input binaries. * tests/data/test-abidiff-exit/test-enumerator-changes1-v{0,1}.c: New source code for the new test input binaries. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-abidiff-exit.cc (in_out_specs): Add the new test input binaries to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
---|---|---|
.github | ||
autoconf-archive | ||
bash-completion | ||
doc | ||
docker | ||
include | ||
m4 | ||
relicensing-scripts | ||
scripts | ||
src | ||
tests | ||
tools | ||
.clang-format | ||
.gitignore | ||
.mailmap | ||
abigail.m4 | ||
ABIXML-FORMAT-VERSIONS | ||
AUTHORS | ||
ChangeLog | ||
COMMIT-LOG-GUIDELINES | ||
COMPILING | ||
configure.ac | ||
CONTRIBUTING | ||
default.abignore | ||
gen-changelog.py | ||
install-sh | ||
libabigail.pc.in | ||
license-change-2020.txt | ||
LICENSE.txt | ||
ltmain.sh | ||
Makefile.am | ||
NEWS | ||
README | ||
README-DOCKER.md | ||
release-text-template.txt | ||
update-copyright.sh | ||
VISIBILITY |
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, functions 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.