libabigail/doc
Dodji Seketeli 3e0eeb9f98 suppression: Fix has_data_member_inserted_between = {offset_of(), offset_of()}
This should fix bug https://sourceware.org/bugzilla/show_bug.cgi?id=28073

There is at least a case where the evaluation of the suppression
specification rule incarnated by the property
has_data_member_inserted_between doesn't work.  This is in the context
of the following suppression specification:

    [suppress_type]
     name = struct_foo
     has_data_member_inserted_between = {offset_of(dm1), offset_of(dm2)}

The evaluation of the rule incarnated by
has_data_member_inserted_between fails in the context of a type change
where the data member "dm1" is removed from the type struct_foo.  In
that case, the evaluation of the suppression should ALWAYS yield to
the suppression specification NOT suppressing the change.  But in some
cases the change is suppressed nonetheless.

This patch fixes that.

The idea of the patch is that if the class has a removed data member
or if its size shrinks then no type change on that class can be
suppressed.  This is because those two kinds of change are
incompatible ABI (or at least API) changes.  So they should be
reported.

The patch also fixes the evaluation of the boundaries of the insertion
range expressed as an "offset_after" expression.

	* doc/manuals/libabigail-concepts.rst: Update the documentation to
	reflect that has_data_member* properties will never suppress any
	type change if the change carries a data member suppression or a
	type size reduction.
	* include/abg-fwd.h (get_last_data_member)
	(get_next_data_member_offset): Declare new functions.
	* include/abg-suppression.h
	(insertion_range::boundary_value_is_end): Declare new static
	member function.
	(type_supression::insertion_range::eval_boundary): Make this
	static function take an uint64_t rather than ssize_t.
	(type_suppression::insertion_range::integer_boundary::{integer_boundary,
	as_integer, operator int}): Make these member functions and
	operator take or return uint64_t rather than int.
	* src/abg-ir.cc (get_last_data_member)
	(get_next_data_member_offset): Define new functions.
	* src/abg-suppression.cc
	(type_suppression::suppresses_diff): Rework logic to better handle
	"has_data_member_inserted_*" properties in the context of class
	diffs.  If the diff object carries data member removal or size
	reduction, the diff object is not suppressed by the current type
	suppression.  Also, the property "has_data_member_inserted_at =
	end", is now represented by an insertion range where the beginning
	and the end of the range are both the max possible value of
	insertion range boundaries; the code is made to recognize that.
	(type_suppression::insertion_range::eval_boundary): Make this
	static function take an uint64_t rather than ssize_t.  If the
	boundary is expressed as a "offset_after" expression, make sure
	the offset of the next data member is considered if it's present.
	(type_suppression::insertion_range::integer_boundary::{integer_boundary,
	as_integer, operator int}): Make these take or return uint64_t
	rather than int.
	(type_suppression::insertion_range::boundary_value_is_end): Define
	new member function.
	(type_suppression::insertion_range::integer_boundary::priv::value_):
	Turn the type of this into uint64_t, from int.
	(type_suppression::insertion_range::integer_boundary::priv::priv):
	The parameter of this is now uint64_t, from int.
	* tests/data/test-diff-suppr/PR28073/PR28073-bitfield-removed.c:
	New test source code.
	* tests/data/test-diff-suppr/PR28073/PR28073-bitfield-removed.o:
	New test binary.
	* tests/data/test-diff-suppr/PR28073/PR28073-bitfield-removed.o.abi:
	New test input.
	* tests/data/test-diff-suppr/PR28073/PR28073-output-{1,2}.txt: New
	test reference output.
	* tests/data/test-diff-suppr/PR28073/PR28073.after.o: New test
	binary.
	* tests/data/test-diff-suppr/PR28073/PR28073.after.o.abi: New test
	input.
	* tests/data/test-diff-suppr/PR28073/PR28073.before.o: New test
	binary.
	* tests/data/test-diff-suppr/PR28073/PR28073.before.o.abi: New
	test input.
	* tests/data/test-diff-suppr/PR28073/PR28073.c: New test source
	code.
	* tests/data/test-diff-suppr/PR28073/bitfield.suppr: New test
	input.
	* tests/data/Makefile.am: Add the new test material to source
	distribution.
	* tests/test-diff-suppr.cc: Add the new test input to this test
	harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-12-06 14:39:32 +01:00
..
api Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
manuals suppression: Fix has_data_member_inserted_between = {offset_of(), offset_of()} 2021-12-06 14:39:32 +01:00
vizualization Initial DOT work. 2013-07-23 23:13:55 +02:00
website Update licensing information on the web page after 2.0 2021-10-18 17:08:14 +02:00
Makefile.am Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
suppr-doc.txt Update the suppr-doc.txt file for variable suppressions 2014-11-01 12:21:59 +01:00