Bug 24731 - Wrongly reporting union members order change
authorDodji Seketeli <dodji@redhat.com>
Wed, 26 Jun 2019 08:43:22 +0000 (10:43 +0200)
committerDodji Seketeli <dodji@redhat.com>
Wed, 26 Jun 2019 09:09:43 +0000 (11:09 +0200)
commita11a0068ea333a5149aeed6bd92cb2c6b9523afa
treeeddd2fe003e3bfe69767250275e71a62c90b5e4e
parentbf100fcb4169d6b66e6727932c2c3323c549744a
Bug 24731 - Wrongly reporting union members order change

When union data members are re-ordered, abidiff reports the
re-ordering as if it was a meaningful ABI change.

This patch teaches Libabigail to categorize that benign type layout
change as a HARMLESS_UNION_CHANGE_CATEGORY kind of change and ignore it.

* include/abg-comp-filter.h (union_diff_has_harmless_changes):
Declare new function and ...
* src/abg-comp-filter.cc (union_diff_has_harmless_changes):
... define it here.
(categorize_harmless_diff_node): Use the new
union_diff_has_harmless_changes here.
* include/abg-comparison.h (HARMLESS_UNION_CHANGE_CATEGORY): Add a
new enumerator to diff_category enum.  Adjust the value of the
other enumerators.
* src/abg-comparison.cc (get_default_harmless_categories_bitmap):
Add the new HARMLESS_UNION_CHANGE_CATEGORY in here.
(operator<<(ostream& o, diff_category c)): Support the new
HARMLESS_UNION_CHANGE_CATEGORY.
* tests/data/test-diff-filter/test-PR24731-report-0.txt: Likewise.
* tests/data/test-diff-filter/test-PR24731-report-1.txt: Likewise.
* tests/data/test-diff-filter/test-PR24731-v0.c: Likewise.
* tests/data/test-diff-filter/test-PR24731-v0.o: Likewise.
* tests/data/test-diff-filter/test-PR24731-v1.c: Likewise.
* tests/data/test-diff-filter/test-PR24731-v1.o: Likewise.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-diff-filter.cc (in_out_spec): Add the new test input
to this test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
12 files changed:
include/abg-comp-filter.h
include/abg-comparison.h
src/abg-comp-filter.cc
src/abg-comparison.cc
tests/data/Makefile.am
tests/data/test-diff-filter/test-PR24731-report-0.txt [new file with mode: 0644]
tests/data/test-diff-filter/test-PR24731-report-1.txt [new file with mode: 0644]
tests/data/test-diff-filter/test-PR24731-v0.c [new file with mode: 0644]
tests/data/test-diff-filter/test-PR24731-v0.o [new file with mode: 0644]
tests/data/test-diff-filter/test-PR24731-v1.c [new file with mode: 0644]
tests/data/test-diff-filter/test-PR24731-v1.o [new file with mode: 0644]
tests/test-diff-filter.cc