Merge "header-abi-diff: Fix omission of warning message for extensions."
This commit is contained in:
@@ -126,6 +126,16 @@ static std::set<std::string> LoadIgnoredSymbols(std::string &symbol_list_path) {
|
||||
static const char kWarn[] = "\033[36;1mwarning: \033[0m";
|
||||
static const char kError[] = "\033[31;1merror: \033[0m";
|
||||
|
||||
bool ShouldEmitWarningMessage(abi_util::CompatibilityStatusIR status) {
|
||||
return (!allow_extensions &&
|
||||
(status & abi_util::CompatibilityStatusIR::Extension)) ||
|
||||
(!allow_unreferenced_changes &&
|
||||
(status & abi_util::CompatibilityStatusIR::UnreferencedChanges)) ||
|
||||
(!allow_unreferenced_elf_symbol_changes &&
|
||||
(status & abi_util::CompatibilityStatusIR::ElfIncompatible)) ||
|
||||
(status & abi_util::CompatibilityStatusIR::Incompatible);
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv) {
|
||||
llvm::cl::ParseCommandLineOptions(argc, argv, "header-checker");
|
||||
std::set<std::string> ignored_symbols;
|
||||
@@ -168,15 +178,10 @@ int main(int argc, const char **argv) {
|
||||
unreferenced_change_str += " This MIGHT be an ABI breaking change due to";
|
||||
unreferenced_change_str += " internal typecasts.";
|
||||
}
|
||||
bool suppress_extending_warnings =
|
||||
allow_extensions && (status & abi_util::CompatibilityStatusIR::Extension);
|
||||
|
||||
bool suppress_elf_warnings =
|
||||
allow_unreferenced_elf_symbol_changes &&
|
||||
(status & abi_util::CompatibilityStatusIR::ElfIncompatible);
|
||||
bool should_emit_warning_message = ShouldEmitWarningMessage(status);
|
||||
|
||||
if (!suppress_local_warnings && !suppress_extending_warnings &&
|
||||
!suppress_elf_warnings && status) {
|
||||
if (should_emit_warning_message) {
|
||||
llvm::errs() << "******************************************************\n"
|
||||
<< error_or_warning_str
|
||||
<< "VNDK library: "
|
||||
@@ -189,13 +194,7 @@ int main(int argc, const char **argv) {
|
||||
<< "******************************************************\n";
|
||||
}
|
||||
|
||||
if (!advice_only && ((!allow_extensions &&
|
||||
(status & abi_util::CompatibilityStatusIR::Extension)) ||
|
||||
(!allow_unreferenced_changes &&
|
||||
(status & abi_util::CompatibilityStatusIR::UnreferencedChanges)) ||
|
||||
(!allow_unreferenced_elf_symbol_changes &&
|
||||
(status & abi_util::CompatibilityStatusIR::ElfIncompatible)) ||
|
||||
(status & abi_util::CompatibilityStatusIR::Incompatible))) {
|
||||
if (!advice_only && should_emit_warning_message) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@@ -189,7 +189,8 @@ TEST_MODULES = [
|
||||
'integration/cpp/gold/high_volume_speaker.cpp',
|
||||
'integration/cpp/gold/low_volume_speaker.cpp',
|
||||
],
|
||||
version_script = 'integration/cpp/gold/map_add_function.txt',
|
||||
version_script = \
|
||||
'integration/cpp/gold/map_add_function_elf_symbol.txt',
|
||||
export_include_dirs = ['integration/cpp/gold/include'],
|
||||
cflags = ['-DGOLDEN_ADD_FUNCTION=1', '-DADD_UNEXPORTED_ELF_SYMBOL'],
|
||||
arch = '',
|
||||
|
||||
@@ -159,6 +159,11 @@ class MyTest(unittest.TestCase):
|
||||
self.prepare_and_run_abi_diff_all_archs(
|
||||
"libgolden_cpp", "libgolden_cpp_add_function", 4)
|
||||
|
||||
def test_libgolden_cpp_add_function_allow_extension(self):
|
||||
self.prepare_and_run_abi_diff_all_archs(
|
||||
"libgolden_cpp", "libgolden_cpp_add_function", 0,
|
||||
['-allow-extensions'])
|
||||
|
||||
def test_libgolden_cpp_add_function_and_elf_symbol(self):
|
||||
self.prepare_and_run_abi_diff_all_archs(
|
||||
"libgolden_cpp", "libgolden_cpp_add_function_and_unexported_elf",
|
||||
|
||||
Reference in New Issue
Block a user