From: Giuliano Procida <gprocida@google.com>
To: libabigail@sourceware.org
Cc: dodji@seketeli.org, kernel-team@android.com, gprocida@google.com,
maennich@google.com
Subject: [PATCH] abidiff: include ABI XML versions when reporting a mismatch
Date: Tue, 18 Jan 2022 09:03:15 +0000 [thread overview]
Message-ID: <20220118090315.854147-1-gprocida@google.com> (raw)
In the rare event of an XML version mismatch it would be helpful to
have the versions in the error message, particularly if abidiff is
being run from automation.
* tools/abidiff.cc
(emit_incompatible_format_version_error_message): Add version1
and version2 arguments. Add versions to error message.
(main): Pass emit_incompatible_format_version_error_message
mismatching versions.
Signed-off-by: Giuliano Procida <gprocida@google.com>
---
tools/abidiff.cc | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/tools/abidiff.cc b/tools/abidiff.cc
index 779fa18b..a83d4485 100644
--- a/tools/abidiff.cc
+++ b/tools/abidiff.cc
@@ -1041,19 +1041,25 @@ handle_error(abigail::elf_reader::status status_code,
///
/// @param file_path1 the first file path to consider.
///
-/// @param file_path2 the second file path to consider.
+/// @param version1 the second version to consider.
+///
+/// @param file_path1 the first file path to consider.
+///
+/// @param version2 the second version to consider.
///
/// @param prog_name the name of the current program.
static void
emit_incompatible_format_version_error_message(const string& file_path1,
+ const string& version1,
const string& file_path2,
+ const string& version2,
const string& prog_name)
{
emit_prefix(prog_name, cerr)
<< "incompatible format version between the two input files:\n"
- << "'" << file_path1 << "'\n"
+ << "'" << file_path1 << "' (" << version1 << ")\n"
<< "and\n"
- << "'" << file_path2 << "'\n" ;
+ << "'" << file_path2 << "' (" << version2 << ")\n";
}
int
@@ -1354,11 +1360,14 @@ main(int argc, char* argv[])
return abigail::tools_utils::ABIDIFF_OK;
}
- if (c1->get_format_major_version_number()
- != c2->get_format_major_version_number())
+ const auto c1_version = c1->get_format_major_version_number();
+ const auto c2_version = c2->get_format_major_version_number();
+ if (c1_version != c2_version)
{
emit_incompatible_format_version_error_message(opts.file1,
+ c1_version,
opts.file2,
+ c2_version,
argv[0]);
return abigail::tools_utils::ABIDIFF_ERROR;
}
@@ -1385,11 +1394,14 @@ main(int argc, char* argv[])
return abigail::tools_utils::ABIDIFF_OK;
}
- if (g1->get_format_major_version_number()
- != g2->get_format_major_version_number())
+ const auto g1_version = g1->get_format_major_version_number();
+ const auto g2_version = g2->get_format_major_version_number();
+ if (g1_version != g2_version)
{
emit_incompatible_format_version_error_message(opts.file1,
+ g1_version,
opts.file2,
+ g2_version,
argv[0]);
return abigail::tools_utils::ABIDIFF_ERROR;
}
--
2.34.1.703.g22d0c6ccf7-goog
next reply other threads:[~2022-01-18 9:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-18 9:03 Giuliano Procida [this message]
2022-01-18 16:13 ` Dodji Seketeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220118090315.854147-1-gprocida@google.com \
--to=gprocida@google.com \
--cc=dodji@seketeli.org \
--cc=kernel-team@android.com \
--cc=libabigail@sourceware.org \
--cc=maennich@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).