From patchwork Wed Jan 1 00:00:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksei Vetrov via Libabigail X-Patchwork-Id: 38983 X-Patchwork-Original-From: libabigail@sourceware.org (Giuliano Procida via libabigail) From: Aleksei Vetrov via Libabigail Date: Wed, 01 Jan 2020 00:00:00 -0000 Subject: [PATCH v3] Don't ignore options when diffing translation units (.bi files). Message-ID: <20200203120439.232845-1-gprocida@google.com> There was an inconsistency in the way the diff context was used for different file types. This change eliminates this and so .bi files now have all the command line options applied to their diffs. * tests/data/Makefile.am: Add test case files. * tests/data/test-abidiff-exit/test-loc-*: New test cases. * tests/test-abidiff-exit.cc: Add new test cases. * tools/abidiff.cc: Use populated ctxt for translation unit diff. Signed-off-by: Giuliano Procida --- tests/data/Makefile.am | 4 ++++ tests/data/test-abidiff-exit/test-loc-v0.bi | 13 +++++++++++++ tests/data/test-abidiff-exit/test-loc-v1.bi | 13 +++++++++++++ .../test-loc-with-locs-report.txt | 12 ++++++++++++ .../test-loc-without-locs-report.txt | 12 ++++++++++++ tests/test-abidiff-exit.cc | 18 ++++++++++++++++++ tools/abidiff.cc | 3 +-- 7 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 tests/data/test-abidiff-exit/test-loc-v0.bi create mode 100644 tests/data/test-abidiff-exit/test-loc-v1.bi create mode 100644 tests/data/test-abidiff-exit/test-loc-with-locs-report.txt create mode 100644 tests/data/test-abidiff-exit/test-loc-without-locs-report.txt diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 1ae9d31a..1f574d2e 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -103,6 +103,10 @@ test-abidiff-exit/test2-filtered-removed-fns-v1.c \ test-abidiff-exit/test2-filtered-removed-fns-v0.o \ test-abidiff-exit/test2-filtered-removed-fns-v1.o \ test-abidiff-exit/test2-filtered-removed-fns.abignore \ +test-abidiff-exit/test-loc-v0.bi \ +test-abidiff-exit/test-loc-v1.bi \ +test-abidiff-exit/test-loc-with-locs-report.txt \ +test-abidiff-exit/test-loc-without-locs-report.txt \ \ test-diff-dwarf/test0-v0.cc \ test-diff-dwarf/test0-v0.o \ diff --git a/tests/data/test-abidiff-exit/test-loc-v0.bi b/tests/data/test-abidiff-exit/test-loc-v0.bi new file mode 100644 index 00000000..da3a7c64 --- /dev/null +++ b/tests/data/test-abidiff-exit/test-loc-v0.bi @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/tests/data/test-abidiff-exit/test-loc-v1.bi b/tests/data/test-abidiff-exit/test-loc-v1.bi new file mode 100644 index 00000000..43ac6ecd --- /dev/null +++ b/tests/data/test-abidiff-exit/test-loc-v1.bi @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/tests/data/test-abidiff-exit/test-loc-with-locs-report.txt b/tests/data/test-abidiff-exit/test-loc-with-locs-report.txt new file mode 100644 index 00000000..d62e405e --- /dev/null +++ b/tests/data/test-abidiff-exit/test-loc-with-locs-report.txt @@ -0,0 +1,12 @@ +Functions changes summary: 0 Removed, 1 Changed, 0 Added function +Variables changes summary: 0 Removed, 0 Changed, 0 Added variable + +1 function with some indirect sub-type change: + + [C]'function void x(unsigned char)' at test-loc-v1.c:1:1 has some indirect sub-type changes: + parameter 1 of type 'unsigned char' changed: + type name changed from 'unsigned char' to 'signed char' + type size hasn't changed + + + diff --git a/tests/data/test-abidiff-exit/test-loc-without-locs-report.txt b/tests/data/test-abidiff-exit/test-loc-without-locs-report.txt new file mode 100644 index 00000000..5a72047e --- /dev/null +++ b/tests/data/test-abidiff-exit/test-loc-without-locs-report.txt @@ -0,0 +1,12 @@ +Functions changes summary: 0 Removed, 1 Changed, 0 Added function +Variables changes summary: 0 Removed, 0 Changed, 0 Added variable + +1 function with some indirect sub-type change: + + [C]'function void x(unsigned char)' has some indirect sub-type changes: + parameter 1 of type 'unsigned char' changed: + type name changed from 'unsigned char' to 'signed char' + type size hasn't changed + + + diff --git a/tests/test-abidiff-exit.cc b/tests/test-abidiff-exit.cc index e6df5933..4cef727e 100644 --- a/tests/test-abidiff-exit.cc +++ b/tests/test-abidiff-exit.cc @@ -93,6 +93,24 @@ InOutSpec in_out_specs[] = "data/test-abidiff-exit/test2-filtered-removed-fns-report1.txt", "output/test-abidiff-exit/test2-filtered-removed-fns-report1.txt" }, + { + "data/test-abidiff-exit/test-loc-v0.bi", + "data/test-abidiff-exit/test-loc-v1.bi", + "", + "", + abigail::tools_utils::ABIDIFF_ABI_CHANGE, + "data/test-abidiff-exit/test-loc-with-locs-report.txt", + "output/test-abidiff-exit/test-loc-with-locs-report.txt" + }, + { + "data/test-abidiff-exit/test-loc-v0.bi", + "data/test-abidiff-exit/test-loc-v1.bi", + "", + "--no-show-locs", + abigail::tools_utils::ABIDIFF_ABI_CHANGE, + "data/test-abidiff-exit/test-loc-without-locs-report.txt", + "output/test-abidiff-exit/test-loc-without-locs-report.txt" + }, {0, 0, 0 ,0, abigail::tools_utils::ABIDIFF_OK, 0, 0} }; diff --git a/tools/abidiff.cc b/tools/abidiff.cc index 1d02f65e..32f793e8 100644 --- a/tools/abidiff.cc +++ b/tools/abidiff.cc @@ -1243,8 +1243,7 @@ main(int argc, char* argv[]) if (t1) { - diff_context_sptr diff_ctxt(new diff_context); - translation_unit_diff_sptr diff = compute_diff(t1, t2, diff_ctxt); + translation_unit_diff_sptr diff = compute_diff(t1, t2, ctxt); if (diff->has_changes()) diff->report(cout); }