header-checker: Code cleanup

Test: None (No functionality changes)
Change-Id: I18078a5465d4d93bacc8ba381d3ca727ea423ef7
This commit is contained in:
Logan Chien
2018-01-09 18:17:08 +08:00
parent ba6d87d125
commit f7b388328b
3 changed files with 12 additions and 13 deletions

View File

@@ -123,6 +123,9 @@ static std::set<std::string> LoadIgnoredSymbols(std::string &symbol_list_path) {
return ignored_symbols; return ignored_symbols;
} }
static const char kWarn[] = "\033[36;1mwarning: \033[0m";
static const char kError[] = "\033[31;1merror: \033[0m";
int main(int argc, const char **argv) { int main(int argc, const char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv, "header-checker"); llvm::cl::ParseCommandLineOptions(argc, argv, "header-checker");
std::set<std::string> ignored_symbols; std::set<std::string> ignored_symbols;
@@ -137,15 +140,16 @@ int main(int argc, const char **argv) {
std::string status_str = ""; std::string status_str = "";
std::string unreferenced_change_str = ""; std::string unreferenced_change_str = "";
std::string error_or_warning_str = "\033[36;1mwarning: \033[0m"; std::string error_or_warning_str = kWarn;
switch (status) { switch (status) {
case abi_util::CompatibilityStatusIR::Incompatible: case abi_util::CompatibilityStatusIR::Incompatible:
error_or_warning_str = "\033[31;1merror: \033[0m"; error_or_warning_str = kError;
status_str = "INCOMPATIBLE CHANGES"; status_str = "INCOMPATIBLE CHANGES";
break; break;
case abi_util::CompatibilityStatusIR::ElfIncompatible: case abi_util::CompatibilityStatusIR::ElfIncompatible:
if (elf_unreferenced_symbol_errors) { if (elf_unreferenced_symbol_errors) {
error_or_warning_str = "\033[31;1merror: \033[0m"; error_or_warning_str = kError;
} }
status_str = "ELF Symbols not referenced by exported headers removed"; status_str = "ELF Symbols not referenced by exported headers removed";
break; break;

View File

@@ -9,14 +9,9 @@ import_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
import_path = os.path.abspath(os.path.join(import_path, 'utils')) import_path = os.path.abspath(os.path.join(import_path, 'utils'))
sys.path.insert(1, import_path) sys.path.insert(1, import_path)
from utils import read_output_content from utils import (
from utils import run_header_abi_dumper AOSP_DIR, SOURCE_ABI_DUMP_EXT, TARGET_ARCHS, read_output_content,
from utils import run_abi_diff run_abi_diff, run_header_abi_dumper)
from utils import SOURCE_ABI_DUMP_EXT
from utils import TARGET_ARCHS
from utils import get_build_var
from utils import make_library
from utils import AOSP_DIR
from module import Module from module import Module
from gen_all import make_and_copy_reference_dumps from gen_all import make_and_copy_reference_dumps
from gen_all import DEFAULT_CFLAGS from gen_all import DEFAULT_CFLAGS

View File

@@ -36,8 +36,8 @@ def main():
# Parse command line options. # Parse command line options.
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--version', help='VNDK version') parser.add_argument('--version', help='VNDK version')
parser.add_argument('-ref-dump-dir', help='directory to copy reference abi \ parser.add_argument('-ref-dump-dir',
dumps into') help='directory to copy reference abi dumps into')
args = parser.parse_args() args = parser.parse_args()
num_processed = 0 num_processed = 0
soong_dir = os.path.join(AOSP_DIR, 'out', 'soong', '.intermediates') soong_dir = os.path.join(AOSP_DIR, 'out', 'soong', '.intermediates')