The Git repository of the Libabigail Project
Go to file
Dodji Seketeli b12ba51e62 Support suppressing data member insertion before a flexible array member
Consider this code example:

    $ cat test-v0.c
     1	struct foo
     2	{
     3	  int member0;
     4	  char pad[]; /* <-- flexible array member.  */
     5	};
     6
     7	void
     8	foo(struct foo * p __attribute__((unused)))
     9	{
    10	}
    $

Consider this new version of the code where a data member has been
added right before the flexible array member:

    $ cat -n test-v1.c
     1	struct foo
     2	{
     3	  int member0;
     4	  char member1; /*<-- added member.  */
     5	  char pad[]; /* <-- flexible array member.  */
     6	};
     7
     8	void
     9	foo(struct foo * p __attribute__((unused)))
    10	{
    11	}
    $

Here is what abidiff reports about the change:

    $ abidiff test-v0.o test-v1.o || echo "returned value: $?"
    Functions changes summary: 0 Removed, 1 Changed, 0 Added function
    Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

    1 function with some indirect sub-type change:

      [C] 'function void foo(foo*)' at test-v0.c:8:1 has some indirect sub-type changes:
	parameter 1 of type 'foo*' has sub-type changes:
	  in pointed to type 'struct foo' at test-v1.c:1:1:
	    type size changed from 32 to 64 (in bits)
	    1 data member insertion:
	      'char member1', at offset 32 (in bits) at test-v1.c:4:1
	    1 data member change:
	      'char pad[]' offset changed from 32 to 40 (in bits) (by +8 bits)

    returned value: 4
    $

This patch allows users to suppress this change report using a new
property value to the "has_data_member_inserted_at" property of the
[suppress_type] directive.  The resulting suppression specification
reads:

    $ cat -n foo.suppr
	 1	[suppress_type]
	 2	 type_kind = struct
         3       name = foo
	 4	 has_data_member_inserted_at = offset_of_flexible_array_data_member
	 5	 has_size_change = yes
    $

With this suppression specification the previous command now gives:

    $ abidiff --suppr foo.suppr test-v0.o test-v1.o && echo "returned value: $?"
    Functions changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added function
    Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

    returned value: 0
    $

The patch adds new test cases and updates the documentation to add a
mention to the new offset_of_flexible_array_data_member named
boundary.

	* doc/manuals/libabigail-concepts.rst: Add documentation for the
	new "offset_of_flexible_array_data_member" named boundary.
	* include/abg-fwd.h (has_flexible_array_data_member): Declare new
	function.
	* src/abg-ir.cc (has_flexible_array_data_member): Define it.
	* include/abg-suppression.h
	(type_suppression::insertion_range::named_boundary_sptr): Define
	new typedef.
	(type_suppression::insertion_range::create_named_boundary): Declare
	new static function member function.
	(is_named_boundary): Declare new function.
	(class type_suppression::insertion_range::named_boundary): Declare
	new type.
	* src/abg-suppression.cc
	(struct type_suppression::insertion_range::named_boundary::priv):
	Define new private type.
	(OFFSET_OF_FLEXIBLE_ARRAY_DATA_MEMBER_STRING): Define new static
	constant string getter function.
	(type_suppression::insertion_range::create_named_boundary): Define
	new static member function.
	(is_named_boundary): Define new function.
	(read_type_suppression): Parse the new
	"offset_of_flexible_array_data_member" named boundary.
	(type_suppression::insertion_range::eval_boundary): Evaluate the
	new "offset_of_flexible_array_data_member" named boundary.
	* tests/data/test-abidiff-exit/test-fam1-report-[1-5].txt: New
	reference test output.
	* tests/data/test-abidiff-exit/test-fam2-report-1.txt: Likewise.
	* tests/data/test-abidiff-exit/test-fam1-suppr-[1-4].abignore: New test
	suppression specification.
	* tests/data/test-abidiff-exit/test-fam{1,2}-v{0,1}.o: New test input
	binaries.
	* tests/data/test-abidiff-exit/test-fam{1,2}-v{0,1}.c: Source code of
	the test input binaries.
	* tests/data/Makefile.am: Add the new test material to the source
	distribution.
	* tests/test-abidiff-exit.cc (in_out_specs): Add the new test
	input to this harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2023-10-18 11:08:58 +02:00
.github Adding missing newline to build-container workflow 2022-05-17 09:46:16 +02:00
autoconf-archive Replace individual license references with SPDX Identifiers 2020-12-02 11:44:13 +01:00
bash-completion Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
doc Support suppressing data member insertion before a flexible array member 2023-10-18 11:08:58 +02:00
docker Add github actions to support workflows 2022-05-17 00:13:40 +02:00
include Support suppressing data member insertion before a flexible array member 2023-10-18 11:08:58 +02:00
m4 Delete ltsugar.m4 and pkg.m4 files from m4/ 2015-01-06 09:54:45 +01:00
relicensing-scripts Bug 27512 - Remove broken zip-archive support 2021-03-19 10:52:57 +01:00
scripts Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
src Support suppressing data member insertion before a flexible array member 2023-10-18 11:08:58 +02:00
tests Support suppressing data member insertion before a flexible array member 2023-10-18 11:08:58 +02:00
tools abipkgdiff: Avoid comparing binaries that are outside of the package 2023-09-07 15:23:38 +02:00
.clang-format Tweak clang-format configuration 2021-10-19 12:59:18 +02:00
.gitignore .gitignore: Add libabigail-?.* *.orig files 2019-05-22 14:34:23 +02:00
.mailmap Add '.mailmap' 2021-12-17 20:12:20 +01:00
abigail.m4 Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
ABIXML-FORMAT-VERSIONS Bug 28450 - Fix cloned member function handling in DWARF 2021-11-12 18:31:28 +01:00
AUTHORS Initial AUTHORS and README 2013-02-28 13:25:20 +01:00
ChangeLog Update ChangeLog for 2.3 release 2023-04-27 11:53:10 +02:00
COMMIT-LOG-GUIDELINES Update the COMMIT-LOG-GUIDELINES file 2016-05-22 23:20:12 +02:00
COMPILING Improve some grammar 2022-02-25 11:24:20 +01:00
configure.ac configure,test-diff-pkg.cc: Handle symlinks presence in dist tarball 2023-09-20 13:07:30 +02:00
CONTRIBUTING Improve some grammar 2022-02-25 11:24:20 +01:00
default.abignore Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
gen-changelog.py Replace individual license references with SPDX Identifiers 2020-12-02 11:44:13 +01:00
install-sh Replace individual license references with SPDX Identifiers 2020-12-02 11:44:13 +01:00
libabigail.pc.in Make libxml2 a private dependency wrt pkconfig 2013-08-22 17:41:29 +02:00
license-change-2020.txt Add a license-change-2020.txt file 2020-12-02 11:50:22 +01:00
LICENSE.txt Add the LICENSE.txt file 2020-12-02 11:49:33 +01:00
ltmain.sh Replace individual license references with SPDX Identifiers 2020-12-02 11:44:13 +01:00
Makefile.am Use xz as the default tarball compression format 2022-11-18 13:06:09 +01:00
NEWS NEWS: Update for 2.3 release 2023-04-27 11:55:38 +02:00
README Improve some grammar 2022-02-25 11:24:20 +01:00
README-DOCKER.md Add github actions to support workflows 2022-05-17 00:13:40 +02:00
release-text-template.txt release-text-template.txt: Modernize a little bit. 2023-05-10 16:29:55 +02:00
update-copyright.sh Update copyright year for 2023 2023-01-01 18:19:30 +01:00
VISIBILITY Improve some grammar 2022-02-25 11:24:20 +01: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, 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.