summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuliano Procida <gprocida@google.com>2022-01-18 09:03:15 +0000
committerDodji Seketeli <dodji@redhat.com>2022-01-18 17:10:03 +0100
commitb251bc611eb6ab7d7983c08243ad467c07697b60 (patch)
tree278f8e7f2af7c0c625eb4ec528412fef00a2af48
parentDWARF reader: use size_t for DWARF expression length cont. (diff)
downloadlibabigail-b251bc611eb6ab7d7983c08243ad467c07697b60.tar.gz
libabigail-b251bc611eb6ab7d7983c08243ad467c07697b60.tar.bz2
libabigail-b251bc611eb6ab7d7983c08243ad467c07697b60.tar.xz
abidiff: include ABI XML versions when reporting a mismatch
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>
-rw-r--r--tools/abidiff.cc26
1 files 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,
1041/// 1041///
1042/// @param file_path1 the first file path to consider. 1042/// @param file_path1 the first file path to consider.
1043/// 1043///
1044/// @param file_path2 the second file path to consider. 1044/// @param version1 the second version to consider.
1045///
1046/// @param file_path1 the first file path to consider.
1047///
1048/// @param version2 the second version to consider.
1045/// 1049///
1046/// @param prog_name the name of the current program. 1050/// @param prog_name the name of the current program.
1047static void 1051static void
1048emit_incompatible_format_version_error_message(const string& file_path1, 1052emit_incompatible_format_version_error_message(const string& file_path1,
1053 const string& version1,
1049 const string& file_path2, 1054 const string& file_path2,
1055 const string& version2,
1050 const string& prog_name) 1056 const string& prog_name)
1051{ 1057{
1052 emit_prefix(prog_name, cerr) 1058 emit_prefix(prog_name, cerr)
1053 << "incompatible format version between the two input files:\n" 1059 << "incompatible format version between the two input files:\n"
1054 << "'" << file_path1 << "'\n" 1060 << "'" << file_path1 << "' (" << version1 << ")\n"
1055 << "and\n" 1061 << "and\n"
1056 << "'" << file_path2 << "'\n" ; 1062 << "'" << file_path2 << "' (" << version2 << ")\n";
1057} 1063}
1058 1064
1059int 1065int
@@ -1354,11 +1360,14 @@ main(int argc, char* argv[])
1354 return abigail::tools_utils::ABIDIFF_OK; 1360 return abigail::tools_utils::ABIDIFF_OK;
1355 } 1361 }
1356 1362
1357 if (c1->get_format_major_version_number() 1363 const auto c1_version = c1->get_format_major_version_number();
1358 != c2->get_format_major_version_number()) 1364 const auto c2_version = c2->get_format_major_version_number();
1365 if (c1_version != c2_version)
1359 { 1366 {
1360 emit_incompatible_format_version_error_message(opts.file1, 1367 emit_incompatible_format_version_error_message(opts.file1,
1368 c1_version,
1361 opts.file2, 1369 opts.file2,
1370 c2_version,
1362 argv[0]); 1371 argv[0]);
1363 return abigail::tools_utils::ABIDIFF_ERROR; 1372 return abigail::tools_utils::ABIDIFF_ERROR;
1364 } 1373 }
@@ -1385,11 +1394,14 @@ main(int argc, char* argv[])
1385 return abigail::tools_utils::ABIDIFF_OK; 1394 return abigail::tools_utils::ABIDIFF_OK;
1386 } 1395 }
1387 1396
1388 if (g1->get_format_major_version_number() 1397 const auto g1_version = g1->get_format_major_version_number();
1389 != g2->get_format_major_version_number()) 1398 const auto g2_version = g2->get_format_major_version_number();
1399 if (g1_version != g2_version)
1390 { 1400 {
1391 emit_incompatible_format_version_error_message(opts.file1, 1401 emit_incompatible_format_version_error_message(opts.file1,
1402 g1_version,
1392 opts.file2, 1403 opts.file2,
1404 g2_version,
1393 argv[0]); 1405 argv[0]);
1394 return abigail::tools_utils::ABIDIFF_ERROR; 1406 return abigail::tools_utils::ABIDIFF_ERROR;
1395 } 1407 }