mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-15 22:44:41 +00:00
Fix detection of local changes in base classes
It appears we were flagging too many base class changes as local. That was preventing some change category propagation through base class diff nodes. This patch fixes that. * abg-ir.cc (equals): In the overload of class_decl::base_spec, if the underlying class carries changes, then do not flag these changes as local for the class_decl::base_spec. * tests/data/test-diff-dwarf/test27-local-base-diff-v{0,1}.o: New test input binaries. * tests/data/test-diff-dwarf/test27-local-base-diff-v{0,1}.cc: Source code for the test input binaries above. * tests/data/test-diff-dwarf/test27-local-base-diff-report.txt: New test input. * tests/data/Makefile.am: Add the test inputs above to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
41d0ad035f
commit
318b31db5d
@ -8804,18 +8804,14 @@ equals(const class_decl::base_spec& l,
|
||||
const class_decl::base_spec& r,
|
||||
change_kind* k)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
if (!l.member_base::operator==(r)
|
||||
|| (*l.get_base_class() != *r.get_base_class()))
|
||||
if (!l.member_base::operator==(r))
|
||||
{
|
||||
result =false;
|
||||
if (k)
|
||||
*k |= LOCAL_CHANGE_KIND;
|
||||
else
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
|
||||
return (*l.get_base_class() == *r.get_base_class());
|
||||
}
|
||||
|
||||
/// Comparison operator for @ref class_decl::base_spec.
|
||||
|
@ -207,6 +207,11 @@ test-diff-dwarf/libtest26-added-parms-before-variadic-v1.so \
|
||||
test-diff-dwarf/test26-added-parms-before-variadic-report.txt \
|
||||
test-diff-dwarf/test26-added-parms-before-variadic-v0.c \
|
||||
test-diff-dwarf/test26-added-parms-before-variadic-v1.c \
|
||||
test-diff-dwarf/test27-local-base-diff-v0.o \
|
||||
test-diff-dwarf/test27-local-base-diff-v1.o \
|
||||
test-diff-dwarf/test27-local-base-diff-v0.cc \
|
||||
test-diff-dwarf/test27-local-base-diff-v1.cc \
|
||||
test-diff-dwarf/test27-local-base-diff-report.txt \
|
||||
\
|
||||
test-read-dwarf/test0 \
|
||||
test-read-dwarf/test0.abi \
|
||||
|
24
tests/data/test-diff-dwarf/test27-local-base-diff-report.txt
Normal file
24
tests/data/test-diff-dwarf/test27-local-base-diff-report.txt
Normal file
@ -0,0 +1,24 @@
|
||||
Functions changes summary: 0 Removed, 2 Changed, 0 Added functions
|
||||
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
|
||||
|
||||
2 functions with some indirect sub-type change:
|
||||
|
||||
[C]'function void bar(base&)' has some indirect sub-type changes:
|
||||
parameter 1 of type 'base&' has sub-type changes:
|
||||
in referenced type 'struct base':
|
||||
type size changed from 32 to 64 bits
|
||||
1 data member insertion:
|
||||
'char base::m1', at offset 32 (in bits)
|
||||
|
||||
[C]'function void foo(S*)' has some indirect sub-type changes:
|
||||
parameter 1 of type 'S*' has sub-type changes:
|
||||
in pointed to type 'struct S':
|
||||
type size changed from 64 to 96 bits
|
||||
1 base class change:
|
||||
'struct base' changed:
|
||||
details were reported earlier
|
||||
|
||||
1 data member change:
|
||||
'int S::m0' offset changed from 32 to 64 (in bits)
|
||||
|
||||
|
20
tests/data/test-diff-dwarf/test27-local-base-diff-v0.cc
Normal file
20
tests/data/test-diff-dwarf/test27-local-base-diff-v0.cc
Normal file
@ -0,0 +1,20 @@
|
||||
// Compile with:
|
||||
// g++ -g -Wall -c test27-local-base-diff-v0.cc
|
||||
struct base
|
||||
{
|
||||
int m0;
|
||||
};
|
||||
|
||||
struct S : public base
|
||||
{
|
||||
int m0;
|
||||
};
|
||||
|
||||
void
|
||||
bar(base&)
|
||||
{}
|
||||
|
||||
void
|
||||
foo(S*)
|
||||
{
|
||||
}
|
BIN
tests/data/test-diff-dwarf/test27-local-base-diff-v0.o
Normal file
BIN
tests/data/test-diff-dwarf/test27-local-base-diff-v0.o
Normal file
Binary file not shown.
21
tests/data/test-diff-dwarf/test27-local-base-diff-v1.cc
Normal file
21
tests/data/test-diff-dwarf/test27-local-base-diff-v1.cc
Normal file
@ -0,0 +1,21 @@
|
||||
// Compile with:
|
||||
// g++ -g -Wall -c test27-local-base-diff-v1.cc
|
||||
struct base
|
||||
{
|
||||
int m0;
|
||||
char m1;
|
||||
};
|
||||
|
||||
struct S : public base
|
||||
{
|
||||
int m0;
|
||||
};
|
||||
|
||||
void
|
||||
bar(base&)
|
||||
{}
|
||||
|
||||
void
|
||||
foo(S*)
|
||||
{
|
||||
}
|
BIN
tests/data/test-diff-dwarf/test27-local-base-diff-v1.o
Normal file
BIN
tests/data/test-diff-dwarf/test27-local-base-diff-v1.o
Normal file
Binary file not shown.
@ -224,6 +224,12 @@ InOutSpec in_out_specs[] =
|
||||
"data/test-diff-dwarf/test26-added-parms-before-variadic-report.txt",
|
||||
"output/test-diff-dwarf/test26-added-parms-before-variadic-report.txt"
|
||||
},
|
||||
{
|
||||
"data/test-diff-dwarf/test27-local-base-diff-v0.o",
|
||||
"data/test-diff-dwarf/test27-local-base-diff-v1.o",
|
||||
"data/test-diff-dwarf/test27-local-base-diff-report.txt",
|
||||
"output/test-diff-dwarf/test27-local-base-diff-report.txt"
|
||||
},
|
||||
// This should be the last entry
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user