public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] abidiff: include ABI XML versions when reporting a mismatch
@ 2022-01-18  9:03 Giuliano Procida
  2022-01-18 16:13 ` Dodji Seketeli
  0 siblings, 1 reply; 2+ messages in thread
From: Giuliano Procida @ 2022-01-18  9:03 UTC (permalink / raw)
  To: libabigail; +Cc: dodji, kernel-team, gprocida, maennich

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] abidiff: include ABI XML versions when reporting a mismatch
  2022-01-18  9:03 [PATCH] abidiff: include ABI XML versions when reporting a mismatch Giuliano Procida
@ 2022-01-18 16:13 ` Dodji Seketeli
  0 siblings, 0 replies; 2+ messages in thread
From: Dodji Seketeli @ 2022-01-18 16:13 UTC (permalink / raw)
  To: Giuliano Procida; +Cc: libabigail, kernel-team, maennich

Giuliano Procida <gprocida@google.com> a écrit:

> 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>

Applied to master branch, thanks!

[...]

Cheers,

-- 
		Dodji

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-18 16:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18  9:03 [PATCH] abidiff: include ABI XML versions when reporting a mismatch Giuliano Procida
2022-01-18 16:13 ` Dodji Seketeli

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).