mirror of
git://sourceware.org/git/libabigail.git
synced 2025-03-05 22:27:34 +00:00
ir: Arrays are indirect types for type structure similarity purposes
As described in the comments of types_have_similar_structure: "Two indirect types have similar structure if their underlying types are of the same kind and have the same name. [...] The size of their underlying type does not matter" Yet, the size of array elements (a.k.a the underlying type of an array type) is wrongly considered to matter when assessing the "type structure similarity" relationship for arrays. This patch fixes that. * src/abg-ir.cc (types_have_similar_structure): When examining array types, always treat element types as being underlying types of an indirect type. * tests/data/Makefile.am: Add new test case files. * tests/data/test-abidiff-exit/test-non-leaf-array-report.txt: New test case showing correct --leaf-changes-only reporting. * tests/data/test-abidiff-exit/test-non-leaf-array-v0.c: Likewise. * tests/data/test-abidiff-exit/test-non-leaf-array-v0.o: Likewise. * tests/data/test-abidiff-exit/test-non-leaf-array-v1.c: Likewise. * tests/data/test-abidiff-exit/test-non-leaf-array-v1.o: Likewise. * tests/test-abidiff-exit.cc: Run new test case. Signed-off-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
38effc902b
commit
d068f26701
@ -23608,7 +23608,7 @@ types_have_similar_structure(const type_base* first,
|
||||
|| ty1->get_dimension_count() != ty2->get_dimension_count()
|
||||
|| !types_have_similar_structure(ty1->get_element_type(),
|
||||
ty2->get_element_type(),
|
||||
indirect_type))
|
||||
/*indirect_type=*/true))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -184,6 +184,11 @@ test-abidiff-exit/test-headers-dirs/test-headers-dir-v0.c \
|
||||
test-abidiff-exit/test-headers-dirs/test-headers-dir-v0.o \
|
||||
test-abidiff-exit/test-headers-dirs/test-headers-dir-v1.c \
|
||||
test-abidiff-exit/test-headers-dirs/test-headers-dir-v1.o \
|
||||
test-abidiff-exit/test-non-leaf-array-v0.c \
|
||||
test-abidiff-exit/test-non-leaf-array-v0.o \
|
||||
test-abidiff-exit/test-non-leaf-array-v1.c \
|
||||
test-abidiff-exit/test-non-leaf-array-v1.o \
|
||||
test-abidiff-exit/test-non-leaf-array-report.txt \
|
||||
\
|
||||
test-diff-dwarf/test0-v0.cc \
|
||||
test-diff-dwarf/test0-v0.o \
|
||||
|
11
tests/data/test-abidiff-exit/test-non-leaf-array-report.txt
Normal file
11
tests/data/test-abidiff-exit/test-non-leaf-array-report.txt
Normal file
@ -0,0 +1,11 @@
|
||||
Leaf changes summary: 1 artifact changed
|
||||
Changed leaf types summary: 1 leaf type changed
|
||||
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
|
||||
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable
|
||||
|
||||
'struct buzz at test-non-leaf-array-v0.c:1:1' changed:
|
||||
type size changed from 32 to 64 (in bits)
|
||||
there are data member changes:
|
||||
type 'int' of 'buzz::a' changed:
|
||||
type name changed from 'int' to 'long int'
|
||||
type size changed from 32 to 64 (in bits)
|
12
tests/data/test-abidiff-exit/test-non-leaf-array-v0.c
Normal file
12
tests/data/test-abidiff-exit/test-non-leaf-array-v0.c
Normal file
@ -0,0 +1,12 @@
|
||||
struct buzz {
|
||||
int a;
|
||||
};
|
||||
|
||||
struct flexible {
|
||||
long count;
|
||||
struct buzz lightyear[0];
|
||||
};
|
||||
|
||||
struct flexible var;
|
||||
void fun(struct flexible flex) { (void) flex; }
|
||||
|
BIN
tests/data/test-abidiff-exit/test-non-leaf-array-v0.o
Normal file
BIN
tests/data/test-abidiff-exit/test-non-leaf-array-v0.o
Normal file
Binary file not shown.
12
tests/data/test-abidiff-exit/test-non-leaf-array-v1.c
Normal file
12
tests/data/test-abidiff-exit/test-non-leaf-array-v1.c
Normal file
@ -0,0 +1,12 @@
|
||||
struct buzz {
|
||||
long a;
|
||||
};
|
||||
|
||||
struct flexible {
|
||||
long count;
|
||||
struct buzz lightyear[0];
|
||||
};
|
||||
|
||||
struct flexible var;
|
||||
void fun(struct flexible flex) { (void) flex; }
|
||||
|
BIN
tests/data/test-abidiff-exit/test-non-leaf-array-v1.o
Normal file
BIN
tests/data/test-abidiff-exit/test-non-leaf-array-v1.o
Normal file
Binary file not shown.
@ -337,6 +337,17 @@ InOutSpec in_out_specs[] =
|
||||
"data/test-abidiff-exit/test-headers-dirs/test-headers-dir-report-2.txt",
|
||||
"output/test-abidiff-exit/test-headers-dirs/test-headers-dir-report-2.txt"
|
||||
},
|
||||
{
|
||||
"data/test-abidiff-exit/test-non-leaf-array-v0.o",
|
||||
"data/test-abidiff-exit/test-non-leaf-array-v1.o",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"--leaf-changes-only",
|
||||
abigail::tools_utils::ABIDIFF_ABI_CHANGE,
|
||||
"data/test-abidiff-exit/test-non-leaf-array-report.txt",
|
||||
"output/test-abidiff-exit/test-non-leaf-array-report.txt"
|
||||
},
|
||||
{0, 0, 0 ,0, 0, 0, abigail::tools_utils::ABIDIFF_OK, 0, 0}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user