1
0
mirror of git://sourceware.org/git/libabigail.git synced 2025-01-02 23:42:05 +00:00

Lexicographically sort union data members in change reports

Until now, when reporting about struct or union changes, data members
were sorted by using their offset; the data member with the smallest
offset coming first.

But then in unions, all data member have the same offset.  In that
case, the patch sort them lexicographically, by taking their name into
account.

	* src/abg-comparison.cc (data_member_comp::operator()): Data
	members with the same offset are sorted lexicographically, by
	taking their name into account.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt:
	Adjust.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
	Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2016-11-23 14:55:59 +01:00
parent a44a4c1068
commit 630c334705
3 changed files with 43 additions and 31 deletions

View File

@ -5543,7 +5543,19 @@ struct data_member_comp
assert(first_dm);
assert(second_dm);
return get_data_member_offset(first_dm) < get_data_member_offset(second_dm);
size_t first_offset = get_data_member_offset(first_dm);
size_t second_offset = get_data_member_offset(second_dm);
// The data member at the smallest offset comes first.
if (first_offset != second_offset)
return first_offset < second_offset;
string first_dm_name = first_dm->get_name();
string second_dm_name = second_dm->get_name();
// But in case the two data members are at the same offset, then
// sort them lexicographically.
return first_dm_name < second_dm_name;
}
};//end struct data_member_comp

View File

@ -1323,34 +1323,34 @@ Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referen
type name changed from 'VarDesc::__anonymous_union__::__anonymous_struct__' to 'varDescFlags::__anonymous_struct__'
7 data member deletions:
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::alloc_disp', at offset 0 (in bits)
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::has_length', at offset 0 (in bits)
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::is_noncont_dst', at offset 0 (in bits)
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::is_noncont_src', at offset 0 (in bits)
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::alloc_disp', at offset 0 (in bits)
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::is_stack_buf', at offset 0 (in bits)
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::is_static', at offset 0 (in bits)
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::sink_addr', at offset 0 (in bits)
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::has_length', at offset 0 (in bits)
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::is_stack_buf', at offset 0 (in bits)
13 data member insertions:
'uint32_t varDescFlags::__anonymous_struct__::always_copy', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::is_pointer', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::alloc_disp', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::pin', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::has_length', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::is_static', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::is_stack_buf', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::targetptr', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::is_noncont_dst', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::sink_addr', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::is_static_dstn', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::always_copy', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::always_delete', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::has_length', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::is_noncont_dst', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::is_pointer', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::is_stack_buf', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::is_static', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::is_static_dstn', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::pin', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::preallocated', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::sink_addr', at offset 0 (in bits)
'uint32_t varDescFlags::__anonymous_struct__::targetptr', at offset 0 (in bits)
no data member change (1 filtered);
no data member change (1 filtered);

View File

@ -1323,34 +1323,34 @@ Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referen
type name changed from 'VarDesc::__anonymous_union__::__anonymous_struct__' to 'varDescFlags::__anonymous_struct__'
7 data member deletions:
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::alloc_disp', at offset 0 (in bits) at offload_common.h:246:1
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::has_length', at offset 0 (in bits) at offload_common.h:240:1
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::is_noncont_dst', at offset 0 (in bits) at offload_common.h:250:1
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::is_noncont_src', at offset 0 (in bits) at offload_common.h:248:1
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::alloc_disp', at offset 0 (in bits) at offload_common.h:246:1
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::is_stack_buf', at offset 0 (in bits) at offload_common.h:242:1
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::is_static', at offset 0 (in bits) at offload_common.h:236:1
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::sink_addr', at offset 0 (in bits) at offload_common.h:244:1
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::has_length', at offset 0 (in bits) at offload_common.h:240:1
'uint32_t VarDesc::__anonymous_union__::__anonymous_struct__::is_stack_buf', at offset 0 (in bits) at offload_common.h:242:1
13 data member insertions:
'uint32_t varDescFlags::__anonymous_struct__::always_copy', at offset 0 (in bits) at offload_common.h:244:1
'uint32_t varDescFlags::__anonymous_struct__::is_pointer', at offset 0 (in bits) at offload_common.h:232:1
'uint32_t varDescFlags::__anonymous_struct__::alloc_disp', at offset 0 (in bits) at offload_common.h:237:1
'uint32_t varDescFlags::__anonymous_struct__::pin', at offset 0 (in bits) at offload_common.h:248:1
'uint32_t varDescFlags::__anonymous_struct__::has_length', at offset 0 (in bits) at offload_common.h:224:1
'uint32_t varDescFlags::__anonymous_struct__::is_static', at offset 0 (in bits) at offload_common.h:220:1
'uint32_t varDescFlags::__anonymous_struct__::is_stack_buf', at offset 0 (in bits) at offload_common.h:226:1
'uint32_t varDescFlags::__anonymous_struct__::targetptr', at offset 0 (in bits) at offload_common.h:228:1
'uint32_t varDescFlags::__anonymous_struct__::is_noncont_dst', at offset 0 (in bits) at offload_common.h:241:1
'uint32_t varDescFlags::__anonymous_struct__::sink_addr', at offset 0 (in bits) at offload_common.h:235:1
'uint32_t varDescFlags::__anonymous_struct__::is_static_dstn', at offset 0 (in bits) at offload_common.h:222:1
'uint32_t varDescFlags::__anonymous_struct__::always_copy', at offset 0 (in bits) at offload_common.h:244:1
'uint32_t varDescFlags::__anonymous_struct__::always_delete', at offset 0 (in bits) at offload_common.h:246:1
'uint32_t varDescFlags::__anonymous_struct__::has_length', at offset 0 (in bits) at offload_common.h:224:1
'uint32_t varDescFlags::__anonymous_struct__::is_noncont_dst', at offset 0 (in bits) at offload_common.h:241:1
'uint32_t varDescFlags::__anonymous_struct__::is_pointer', at offset 0 (in bits) at offload_common.h:232:1
'uint32_t varDescFlags::__anonymous_struct__::is_stack_buf', at offset 0 (in bits) at offload_common.h:226:1
'uint32_t varDescFlags::__anonymous_struct__::is_static', at offset 0 (in bits) at offload_common.h:220:1
'uint32_t varDescFlags::__anonymous_struct__::is_static_dstn', at offset 0 (in bits) at offload_common.h:222:1
'uint32_t varDescFlags::__anonymous_struct__::pin', at offset 0 (in bits) at offload_common.h:248:1
'uint32_t varDescFlags::__anonymous_struct__::preallocated', at offset 0 (in bits) at offload_common.h:230:1
'uint32_t varDescFlags::__anonymous_struct__::sink_addr', at offset 0 (in bits) at offload_common.h:235:1
'uint32_t varDescFlags::__anonymous_struct__::targetptr', at offset 0 (in bits) at offload_common.h:228:1
no data member change (1 filtered);
no data member change (1 filtered);