mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-18 07:54:36 +00:00
Make abidw --abidiff not show definitely harmless changes
When comparing the ABI of the input ELF binary with that same ABI saved to abixml and read back again, there can be some minor and harmless changes that are seen, because libabigail makes some approximations for performance reasons. For instance, if there are two types that are equivalent, but have different names (because of typedefs) then libabigail will consider that they are the same type, and might save them (to abixml) and read them back (from abixml) in different order. That can lead to subtle changes that are reported (and filtered out) by the command "abidw --abixml". This patch arranges for abidw --abixml to avoid emitting a report saying that a filtered out change was detected, as those cases are considered OK. The patch also fixes a little issue where abidw would abort because the user forgot to provide the binary to analyze, on the command line. * tools/abidw.cc (set_diff_context): New function. (main): Use that new function. Do not show any output for --abidiff if only compatible changes were detected. Also, do not abort if no input binary was giving. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
042063c56e
commit
6d4472066b
@ -174,14 +174,31 @@ parse_command_line(int argc, char* argv[], options& opts)
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Initialize the context use for driving ABI comparison.
|
||||
///
|
||||
/// @param ctxt the context to initialize.
|
||||
static void
|
||||
set_diff_context(diff_context_sptr& ctxt)
|
||||
{
|
||||
ctxt->default_output_stream(&cerr);
|
||||
ctxt->error_output_stream(&cerr);
|
||||
// Filter out changes that are not meaningful from an ABI
|
||||
// standpoint, from the diff output.
|
||||
ctxt->switch_categories_off
|
||||
(abigail::comparison::ACCESS_CHANGE_CATEGORY
|
||||
| abigail::comparison::COMPATIBLE_TYPE_CHANGE_CATEGORY
|
||||
| abigail::comparison::HARMLESS_DECL_NAME_CHANGE_CATEGORY);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
options opts;
|
||||
|
||||
if (!parse_command_line(argc, argv, opts))
|
||||
if (!parse_command_line(argc, argv, opts)
|
||||
|| opts.in_file_path.empty())
|
||||
{
|
||||
display_usage(argv[0], cout);
|
||||
display_usage(argv[0], cerr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -297,10 +314,9 @@ main(int argc, char* argv[])
|
||||
return 1;
|
||||
}
|
||||
diff_context_sptr ctxt(new diff_context);
|
||||
ctxt->default_output_stream(&cerr);
|
||||
ctxt->error_output_stream(&cerr);
|
||||
set_diff_context(ctxt);
|
||||
corpus_diff_sptr diff = compute_diff(corp, corp2, ctxt);
|
||||
bool has_error = diff->has_changes();
|
||||
bool has_error = diff->has_incompatible_changes();
|
||||
if (has_error)
|
||||
{
|
||||
diff->report(cerr);
|
||||
|
Loading…
Reference in New Issue
Block a user