libabigail/tests/data/test-abidiff/test-PR27985-v1.c
Dodji Seketeli 190350a35f Bug 27985 - abidiff: bad array types in report
Reporting the change in array type exhibits a glitch in the type name.
As the bug report says:

	The resulting abidiff output contains:

	                type of 'int numbers[2]' changed:
			 type name changed from 'void[2]' to 'void[3]'
			 array type size changed from 64 to 96
			 array type subrange 1 changed length from 2 to 3

	instead of

	                type of 'int numbers[2]' changed:
			 type name changed from 'int[2]' to 'int[3]'
			 array type size changed from 64 to 96
			 array type subrange 1 changed length from 2 to 3

The problem comes from array_type_def::get_qualified_name() where we
fail to generate a "new" qualified name once the type of the array is
canonicalized.

Fixed thus.

	* src/abg-ir.cc (array_type_def::get_qualified_name): Use the
	cache for temporary qualified names when the type is not yet
	canonicalized.  That way, the cache for (non-temporary) qualified
	names is used only for canonicalized types.
	* tests/data/test-abidiff/test-PR27985-report.txt: Reference
	output for the new test.
	* tests/data/test-abidiff/test-PR27985-v{0,1}.c: Source code for
	the new test binary inputs.
	* tests/data/test-abidiff/test-PR27985-v{0,1}.o: New test binary inputs.
	* tests/data/test-abidiff/test-PR27985-v{0,1}.o.abi: New test
	abixml input.
	* tests/data/Makefile.am: Add the new test materials above to
	source distribution.
	* tests/test-abidiff.cc (specs): Add the tests above to the harness.
	* tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt:
	Adjust.
	* tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt:
	Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-09-03 11:08:01 +02:00

12 lines
113 B
C

struct leaf
{
int numbers[3];
};
struct node
{
struct leaf* ptr;
};
void foo(struct node *n) { (void) n; }