From 8be19f1718bf0a2ebd1d92063e4b1f0ee613768b Mon Sep 17 00:00:00 2001 From: Jayant Chowdhary Date: Thu, 29 Mar 2018 15:18:23 -0700 Subject: [PATCH] Fix false compatibility return status on extension. Also, don't diff unreferenced anonymous records. Bug: 64267858 Bug: 72697345 Test: Extend libjpeg by adding an exported function, also add an unused struct; Without this change: build shows an 'error' message, but does not fail. With this change in prebuilts : build shows 'error' message and fails. Test: tests/test.py passes. Change-Id: Ief7ed90715a9c1a25736c10449833650c73d3db3 --- .../header-checker/header-abi-diff/src/abi_diff.cpp | 8 ++++++-- .../header-abi-diff/src/header_abi_diff.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/vndk/tools/header-checker/header-abi-diff/src/abi_diff.cpp b/vndk/tools/header-checker/header-abi-diff/src/abi_diff.cpp index 51656acbe..936d905c0 100644 --- a/vndk/tools/header-checker/header-abi-diff/src/abi_diff.cpp +++ b/vndk/tools/header-checker/header-abi-diff/src/abi_diff.cpp @@ -105,11 +105,15 @@ HeaderAbiDiff::ExtractUserDefinedTypes( continue; } const abi_util::TypeIR *type = *(odr_list.begin()); + const abi_util::RecordTypeIR *record_type = nullptr; switch (type->GetKind()) { case abi_util::RecordTypeKind: + record_type = static_cast(type); + if (record_type->IsAnonymous()) { + continue; + } record_types.emplace( - static_cast(type)->GetUniqueId(), - static_cast(type)); + record_type->GetUniqueId(), record_type); break; case abi_util::EnumTypeKind: enum_types.emplace( diff --git a/vndk/tools/header-checker/header-abi-diff/src/header_abi_diff.cpp b/vndk/tools/header-checker/header-abi-diff/src/header_abi_diff.cpp index 0ba01b1d9..91382e956 100644 --- a/vndk/tools/header-checker/header-abi-diff/src/header_abi_diff.cpp +++ b/vndk/tools/header-checker/header-abi-diff/src/header_abi_diff.cpp @@ -183,15 +183,15 @@ int main(int argc, const char **argv) { << "******************************************************\n"; } - if ((allow_extensions && + if (!advice_only && ((!allow_extensions && (status & abi_util::CompatibilityStatusIR::Extension)) || - (allow_unreferenced_changes && + (!allow_unreferenced_changes && (status & abi_util::CompatibilityStatusIR::UnreferencedChanges)) || - (allow_unreferenced_elf_symbol_changes && + (!allow_unreferenced_elf_symbol_changes && (status & abi_util::CompatibilityStatusIR::ElfIncompatible)) || - advice_only) { - return abi_util::CompatibilityStatusIR::Compatible; + (status & abi_util::CompatibilityStatusIR::Incompatible))) { + return status; } - return status; + return abi_util::CompatibilityStatusIR::Compatible; }