libabigail/tools/abilint.cc

472 lines
13 KiB
C++
Raw Normal View History

// -*- Mode: C++ -*-
//
Update copyright notice for all source files Happy New Year 2018, I guess :-) * update-copyright.sh: New sed-based script to update the year in the copyright notice. * include/abg-comp-filter.h: Updated the year in the copyright notice. * include/abg-comparison.h: Likewise. * include/abg-config.h: Likewise. * include/abg-corpus.h: Likewise. * include/abg-diff-utils.h: Likewise. * include/abg-dwarf-reader.h: Likewise. * include/abg-fwd.h: Likewise. * include/abg-hash.h: Likewise. * include/abg-ini.h: Likewise. * include/abg-interned-str.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-libxml-utils.h: Likewise. * include/abg-libzip-utils.h: Likewise. * include/abg-reader.h: Likewise. * include/abg-reporter.h: Likewise. * include/abg-sptr-utils.h: Likewise. * include/abg-suppression.h: Likewise. * include/abg-tools-utils.h: Likewise. * include/abg-traverse.h: Likewise. * include/abg-viz-common.h: Likewise. * include/abg-viz-dot.h: Likewise. * include/abg-viz-svg.h: Likewise. * include/abg-workers.h: Likewise. * include/abg-writer.h: Likewise. * src/abg-comp-filter.cc: Likewise. * src/abg-comparison-priv.h: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-config.cc: Likewise. * src/abg-corpus-priv.h: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-default-reporter.cc: Likewise. * src/abg-diff-utils.cc: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-hash.cc: Likewise. * src/abg-ini.cc: Likewise. * src/abg-internal.h: Likewise. * src/abg-ir-priv.h: Likewise. * src/abg-ir.cc: Likewise. * src/abg-leaf-reporter.cc: Likewise. * src/abg-libxml-utils.cc: Likewise. * src/abg-libzip-utils.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-reporter-priv.cc: Likewise. * src/abg-reporter-priv.h: Likewise. * src/abg-sptr-utils.cc: Likewise. * src/abg-suppression-priv.h: Likewise. * src/abg-suppression.cc: Likewise. * src/abg-tools-utils.cc: Likewise. * src/abg-traverse.cc: Likewise. * src/abg-viz-common.cc: Likewise. * src/abg-viz-dot.cc: Likewise. * src/abg-viz-svg.cc: Likewise. * src/abg-workers.cc: Likewise. * src/abg-writer.cc: Likewise. * tests/print-diff-tree.cc: Likewise. * tests/test-abicompat.cc: Likewise. * tests/test-abidiff-exit.cc: Likewise. * tests/test-abidiff.cc: Likewise. * tests/test-alt-dwarf-file.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-diff2.cc: Likewise. * tests/test-ir-walker.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-types-stability.cc: Likewise. * tests/test-utils.cc: Likewise. * tests/test-utils.h: Likewise. * tests/test-write-read-archive.cc: Likewise. * tools/abiar.cc: Likewise. * tools/abicompat.cc: Likewise. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abipkgdiff.cc: Likewise. * tools/abisym.cc: Likewise. * tools/binilint.cc: Likewise. * tools/kmidiff.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-01-08 16:54:56 +00:00
// Copyright (C) 2013-2018 Red Hat, Inc.
//
// This file is part of the GNU Application Binary Interface Generic
// Analysis and Instrumentation Library (libabigail). This library is
// free software; you can redistribute it and/or modify it under the
// terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 3, or (at your option) any
// later version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this program; see the file COPYING-LGPLV3. If
// not, see <http://www.gnu.org/licenses/>.
//
// Author: Dodji Seketeli
/// @file
///
/// This is a program aimed at checking that a binary instrumentation
/// (bi) file is well formed and valid enough. It acts by loading an
/// input bi file and saving it back to a temporary file. It then
/// runs a diff on the two files and expects the result of the diff to
/// be empty.
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
#include <fstream>
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
#include <vector>
Add --version option to several libabigail tools This patch changed the revision number of the libabigail library to make it reflect the fact that we are not in "release candidate" mode, before the first 1.0 release. So the revision number is now "rc0". The configuration manager has been updated to support version numbers that are strings, so that it can supports things like "rc0". Then, several libabigail tools have been modified to support the --version option to display their version number. * configure.ac: Set the version revision to "rc0". * doc/manuals/abicompat.rst: Adjust manual for new --version option. * doc/manuals/abidiff.rst: Likewise. * doc/manuals/abidw.rst: Likewise. * doc/manuals/abilint.rst: Likewise. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-config.h (config::{m_format_minor, m_format_major}): Make these be strings. (config::{get,set}_format_minor_version_number): Make these return strings. (config::{get,set}_format_major_version_number): Make these return or take strings. (abigail_get_library_version): Make this take strings. * src/abg-config.cc (config::config): Adjust. (config::{get,set}_format_major_version_number): Make these return or take strings. (config::{get,set}_format_minor_version_number): Make these return strings. (abigail_get_library_version): Make this take strings. * include/abg-version.h.in: Make the version variables be strings. * src/abg-writer.cc (write_translation_unit): The version numbers are now strings so adjust. * tools/{abicompat,abidiff,abidw,abilint,abipkgdiff,abisym}.cc (options::display_version): New data member. (options::options): Initialize it. (display_usage): Add documentation for new --version option. (parse_command_line): Parse new --version option. (main): Support --version. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-11-16 10:39:15 +00:00
#include "abg-config.h"
#include "abg-tools-utils.h"
#include "abg-ir.h"
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
#include "abg-corpus.h"
Prepare serialization API for multiple backends * include/abg-reader.h: New file with abigail::xml_reader APIs. * include/abg-writer.h: New file with abigail::xml_writer APIs. * include/Makefile.am: Add the new files above to the source distribution. * src/abg-reader.cc: Update top-file comments. (namespace xml_reader): Rename namespace reader into this. (read_to_translation_unit, read_corpus_from_archive): New static functions. (read_translation_unit_from_file) (read_translation_unit_from_file, read_corpus_from_file): New entry points. (struct array_deleter): New functor. (translation_unit::read): Remove this. * src/abg-writer.cc: Update top file comments. (namespace xml_writer): Rename namespace writer into this. (struct archive_write_ctxt): New internal type. (create_archive_write_context, write_translation_unit_to_archive) (write_translation_unit, write_corpus_to_archive): New low level static functions overloads. (write_corpus_to_archive, write_translation_unit): Public higher level overloads. (translation_unit::write): Remove. (dump): Update for new xml_writer namespace. * include/abg-ir.h (translation_unit::{read, write}): Remove these serialization methods. * include/abg-corpus.h (corpus_sptr): New convenience typedef. (corpus::{read, write}): Remove these methods. * src/abg-corpus.cc (corpus::{read, write}) (corpus::impl::{serialized_tus, archive}): Remove these members. (corpus::impl::{get_archive, close_archive, write_tu_to_archive, read_to_translation_unit}): Remove these methods. * tests/test-bidiff.cc (main): Update for usage of the new xml_reader API. * tests/test-read-write.cc (main): Likewise. Update for the usage of the new xml_writer API, too. * tests/test-walker.cc (main): Update for the usage of the new xml_reader API. * tests/test-write-read-archive.cc (main): Likewise. And for the xml_writer API, too. * tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise. * tools/bidiff.cc (main): Likewise, for xml_reader APIs. * tools/bilint.cc (main): Likewise, for xml_writer APIs, too. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
#include "abg-reader.h"
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
#include "abg-dwarf-reader.h"
Prepare serialization API for multiple backends * include/abg-reader.h: New file with abigail::xml_reader APIs. * include/abg-writer.h: New file with abigail::xml_writer APIs. * include/Makefile.am: Add the new files above to the source distribution. * src/abg-reader.cc: Update top-file comments. (namespace xml_reader): Rename namespace reader into this. (read_to_translation_unit, read_corpus_from_archive): New static functions. (read_translation_unit_from_file) (read_translation_unit_from_file, read_corpus_from_file): New entry points. (struct array_deleter): New functor. (translation_unit::read): Remove this. * src/abg-writer.cc: Update top file comments. (namespace xml_writer): Rename namespace writer into this. (struct archive_write_ctxt): New internal type. (create_archive_write_context, write_translation_unit_to_archive) (write_translation_unit, write_corpus_to_archive): New low level static functions overloads. (write_corpus_to_archive, write_translation_unit): Public higher level overloads. (translation_unit::write): Remove. (dump): Update for new xml_writer namespace. * include/abg-ir.h (translation_unit::{read, write}): Remove these serialization methods. * include/abg-corpus.h (corpus_sptr): New convenience typedef. (corpus::{read, write}): Remove these methods. * src/abg-corpus.cc (corpus::{read, write}) (corpus::impl::{serialized_tus, archive}): Remove these members. (corpus::impl::{get_archive, close_archive, write_tu_to_archive, read_to_translation_unit}): Remove these methods. * tests/test-bidiff.cc (main): Update for usage of the new xml_reader API. * tests/test-read-write.cc (main): Likewise. Update for the usage of the new xml_writer API, too. * tests/test-walker.cc (main): Update for the usage of the new xml_reader API. * tests/test-write-read-archive.cc (main): Likewise. And for the xml_writer API, too. * tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise. * tools/bidiff.cc (main): Likewise, for xml_reader APIs. * tools/bilint.cc (main): Likewise, for xml_writer APIs, too. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
#include "abg-writer.h"
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
#include "abg-suppression.h"
using std::string;
using std::cerr;
using std::cin;
using std::cout;
using std::ostream;
using std::ofstream;
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
using std::vector;
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
using abigail::tools_utils::emit_prefix;
Expose a new libabigail::tools_utils namespace The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 10:34:03 +00:00
using abigail::tools_utils::check_file;
using abigail::tools_utils::file_type;
using abigail::tools_utils::guess_file_type;
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
using abigail::suppr::suppression_sptr;
using abigail::suppr::suppressions_type;
using abigail::suppr::read_suppressions;
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
using abigail::corpus;
using abigail::corpus_sptr;
Prepare serialization API for multiple backends * include/abg-reader.h: New file with abigail::xml_reader APIs. * include/abg-writer.h: New file with abigail::xml_writer APIs. * include/Makefile.am: Add the new files above to the source distribution. * src/abg-reader.cc: Update top-file comments. (namespace xml_reader): Rename namespace reader into this. (read_to_translation_unit, read_corpus_from_archive): New static functions. (read_translation_unit_from_file) (read_translation_unit_from_file, read_corpus_from_file): New entry points. (struct array_deleter): New functor. (translation_unit::read): Remove this. * src/abg-writer.cc: Update top file comments. (namespace xml_writer): Rename namespace writer into this. (struct archive_write_ctxt): New internal type. (create_archive_write_context, write_translation_unit_to_archive) (write_translation_unit, write_corpus_to_archive): New low level static functions overloads. (write_corpus_to_archive, write_translation_unit): Public higher level overloads. (translation_unit::write): Remove. (dump): Update for new xml_writer namespace. * include/abg-ir.h (translation_unit::{read, write}): Remove these serialization methods. * include/abg-corpus.h (corpus_sptr): New convenience typedef. (corpus::{read, write}): Remove these methods. * src/abg-corpus.cc (corpus::{read, write}) (corpus::impl::{serialized_tus, archive}): Remove these members. (corpus::impl::{get_archive, close_archive, write_tu_to_archive, read_to_translation_unit}): Remove these methods. * tests/test-bidiff.cc (main): Update for usage of the new xml_reader API. * tests/test-read-write.cc (main): Likewise. Update for the usage of the new xml_writer API, too. * tests/test-walker.cc (main): Update for the usage of the new xml_reader API. * tests/test-write-read-archive.cc (main): Likewise. And for the xml_writer API, too. * tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise. * tools/bidiff.cc (main): Likewise, for xml_reader APIs. * tools/bilint.cc (main): Likewise, for xml_writer APIs, too. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
using abigail::xml_reader::read_translation_unit_from_file;
using abigail::xml_reader::read_translation_unit_from_istream;
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
using abigail::xml_reader::read_corpus_from_file;
using abigail::xml_reader::read_corpus_from_native_xml;
using abigail::xml_reader::read_corpus_from_native_xml_file;
using abigail::dwarf_reader::read_corpus_from_elf;
using abigail::xml_writer::write_translation_unit;
using abigail::xml_writer::write_corpus;
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
using abigail::xml_writer::write_corpus_to_archive;
struct options
{
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
string wrong_option;
string file_path;
Add --version option to several libabigail tools This patch changed the revision number of the libabigail library to make it reflect the fact that we are not in "release candidate" mode, before the first 1.0 release. So the revision number is now "rc0". The configuration manager has been updated to support version numbers that are strings, so that it can supports things like "rc0". Then, several libabigail tools have been modified to support the --version option to display their version number. * configure.ac: Set the version revision to "rc0". * doc/manuals/abicompat.rst: Adjust manual for new --version option. * doc/manuals/abidiff.rst: Likewise. * doc/manuals/abidw.rst: Likewise. * doc/manuals/abilint.rst: Likewise. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-config.h (config::{m_format_minor, m_format_major}): Make these be strings. (config::{get,set}_format_minor_version_number): Make these return strings. (config::{get,set}_format_major_version_number): Make these return or take strings. (abigail_get_library_version): Make this take strings. * src/abg-config.cc (config::config): Adjust. (config::{get,set}_format_major_version_number): Make these return or take strings. (config::{get,set}_format_minor_version_number): Make these return strings. (abigail_get_library_version): Make this take strings. * include/abg-version.h.in: Make the version variables be strings. * src/abg-writer.cc (write_translation_unit): The version numbers are now strings so adjust. * tools/{abicompat,abidiff,abidw,abilint,abipkgdiff,abisym}.cc (options::display_version): New data member. (options::options): Initialize it. (display_usage): Add documentation for new --version option. (parse_command_line): Parse new --version option. (main): Support --version. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-11-16 10:39:15 +00:00
bool display_version;
bool read_from_stdin;
bool read_tu;
bool diff;
bool noout;
std::tr1::shared_ptr<char> di_root_path;
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
vector<string> suppression_paths;
string headers_dir;
options()
Add --version option to several libabigail tools This patch changed the revision number of the libabigail library to make it reflect the fact that we are not in "release candidate" mode, before the first 1.0 release. So the revision number is now "rc0". The configuration manager has been updated to support version numbers that are strings, so that it can supports things like "rc0". Then, several libabigail tools have been modified to support the --version option to display their version number. * configure.ac: Set the version revision to "rc0". * doc/manuals/abicompat.rst: Adjust manual for new --version option. * doc/manuals/abidiff.rst: Likewise. * doc/manuals/abidw.rst: Likewise. * doc/manuals/abilint.rst: Likewise. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-config.h (config::{m_format_minor, m_format_major}): Make these be strings. (config::{get,set}_format_minor_version_number): Make these return strings. (config::{get,set}_format_major_version_number): Make these return or take strings. (abigail_get_library_version): Make this take strings. * src/abg-config.cc (config::config): Adjust. (config::{get,set}_format_major_version_number): Make these return or take strings. (config::{get,set}_format_minor_version_number): Make these return strings. (abigail_get_library_version): Make this take strings. * include/abg-version.h.in: Make the version variables be strings. * src/abg-writer.cc (write_translation_unit): The version numbers are now strings so adjust. * tools/{abicompat,abidiff,abidw,abilint,abipkgdiff,abisym}.cc (options::display_version): New data member. (options::options): Initialize it. (display_usage): Add documentation for new --version option. (parse_command_line): Parse new --version option. (main): Support --version. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-11-16 10:39:15 +00:00
: display_version(false),
read_from_stdin(false),
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
read_tu(false),
diff(false),
noout(false)
{}
};//end struct options;
static void
display_usage(const string& prog_name, ostream& out)
{
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
emit_prefix(prog_name, out)
<< "usage: " << prog_name << " [options] [<abi-file1>]\n"
<< " where options can be:\n"
<< " --help display this message\n"
<< " --version|-v display program version information and exit\n"
<< " --debug-info-dir <path> the path under which to look for "
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
<< " --headers-dir|--hd <patch> the path to headers of the elf file\n"
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
"debug info for the elf <abi-file>\n"
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
<< " --suppressions|--suppr <path> specify a suppression file\n"
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
<< " --diff for xml inputs, perform a text diff between "
"the input and the memory model saved back to disk\n"
<< " --noout do not display anything on stdout\n"
<< " --stdin|-- read abi-file content from stdin\n"
<< " --tu expect a single translation unit file\n";
}
bool
parse_command_line(int argc, char* argv[], options& opts)
{
if (argc < 2)
{
opts.read_from_stdin = true;
return true;
}
for (int i = 1; i < argc; ++i)
{
if (argv[i][0] != '-')
{
if (opts.file_path.empty())
opts.file_path = argv[i];
else
return false;
}
else if (!strcmp(argv[i], "--help"))
return false;
Add --version option to several libabigail tools This patch changed the revision number of the libabigail library to make it reflect the fact that we are not in "release candidate" mode, before the first 1.0 release. So the revision number is now "rc0". The configuration manager has been updated to support version numbers that are strings, so that it can supports things like "rc0". Then, several libabigail tools have been modified to support the --version option to display their version number. * configure.ac: Set the version revision to "rc0". * doc/manuals/abicompat.rst: Adjust manual for new --version option. * doc/manuals/abidiff.rst: Likewise. * doc/manuals/abidw.rst: Likewise. * doc/manuals/abilint.rst: Likewise. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-config.h (config::{m_format_minor, m_format_major}): Make these be strings. (config::{get,set}_format_minor_version_number): Make these return strings. (config::{get,set}_format_major_version_number): Make these return or take strings. (abigail_get_library_version): Make this take strings. * src/abg-config.cc (config::config): Adjust. (config::{get,set}_format_major_version_number): Make these return or take strings. (config::{get,set}_format_minor_version_number): Make these return strings. (abigail_get_library_version): Make this take strings. * include/abg-version.h.in: Make the version variables be strings. * src/abg-writer.cc (write_translation_unit): The version numbers are now strings so adjust. * tools/{abicompat,abidiff,abidw,abilint,abipkgdiff,abisym}.cc (options::display_version): New data member. (options::options): Initialize it. (display_usage): Add documentation for new --version option. (parse_command_line): Parse new --version option. (main): Support --version. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-11-16 10:39:15 +00:00
else if (!strcmp(argv[i], "--version")
|| !strcmp(argv[i], "-v"))
{
opts.display_version = true;
return true;
}
else if (!strcmp(argv[i], "--debug-info-dir"))
{
if (argc <= i + 1
|| argv[i + 1][0] == '-')
return false;
// elfutils wants the root path to the debug info to be
// absolute.
Expose a new libabigail::tools_utils namespace The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 10:34:03 +00:00
opts.di_root_path =
abigail::tools_utils::make_path_absolute(argv[i + 1]);
++i;
}
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
else if (!strcmp(argv[i], "--headers-dir")
|| !strcmp(argv[i], "--hd"))
{
int j = i + 1;
if (j >= argc)
return false;
opts.headers_dir = argv[j];
++i;
}
else if (!strcmp(argv[i], "--suppressions")
|| !strcmp(argv[i], "--suppr"))
{
int j = i + 1;
if (j >= argc)
{
opts.wrong_option = argv[i];
return true;
}
opts.suppression_paths.push_back(argv[j]);
++i;
}
else if (!strcmp(argv[i], "--stdin"))
opts.read_from_stdin = true;
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
else if (!strcmp(argv[i], "--tu"))
opts.read_tu = true;
else if (!strcmp(argv[i], "--diff"))
opts.diff = true;
else if (!strcmp(argv[i], "--noout"))
opts.noout = true;
else
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
{
if (strlen(argv[i]) >= 2 && argv[i][0] == '-' && argv[i][1] == '-')
opts.wrong_option = argv[i];
return false;
}
}
if (opts.file_path.empty())
opts.read_from_stdin = true;
return true;
}
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
/// Check that the suppression specification files supplied are
/// present. If not, emit an error on stderr.
///
/// @param opts the options instance to use.
///
/// @return true if all suppression specification files are present,
/// false otherwise.
static bool
maybe_check_suppression_files(const options& opts)
{
for (vector<string>::const_iterator i = opts.suppression_paths.begin();
i != opts.suppression_paths.end();
++i)
if (!check_file(*i, cerr, "abidiff"))
return false;
return true;
}
/// Set suppression specifications to the @p read_context used to load
/// the ABI corpus from the ELF/DWARF file.
///
/// These suppression specifications are going to be applied to drop
/// some ABI artifacts on the floor (while reading the ELF/DWARF file
/// or the native XML ABI file) and thus minimize the size of the
/// resulting ABI corpus.
///
/// @param read_ctxt the read context to apply the suppression
/// specifications to. Note that the type of this parameter is
/// generic (class template) because in practise, it can be either an
/// abigail::dwarf_reader::read_context type or an
/// abigail::xml_reader::read_context type.
///
/// @param opts the options where to get the suppression
/// specifications from.
template<class ReadContextType>
static void
set_suppressions(ReadContextType& read_ctxt, const options& opts)
{
suppressions_type supprs;
for (vector<string>::const_iterator i = opts.suppression_paths.begin();
i != opts.suppression_paths.end();
++i)
read_suppressions(*i, supprs);
suppression_sptr suppr =
abigail::tools_utils::gen_suppr_spec_from_headers(opts.headers_dir);
if (suppr)
supprs.push_back(suppr);
add_read_context_suppressions(read_ctxt, supprs);
}
/// Reads a bi (binary instrumentation) file, saves it back to a
/// temporary file and run a diff on the two versions.
int
main(int argc, char* argv[])
{
options opts;
if (!parse_command_line(argc, argv, opts))
{
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
if (!opts.wrong_option.empty())
emit_prefix(argv[0], cerr)
<< "unrecognized option: " << opts.wrong_option << "\n";
display_usage(argv[0], cerr);
return true;
}
Prepare serialization API for multiple backends * include/abg-reader.h: New file with abigail::xml_reader APIs. * include/abg-writer.h: New file with abigail::xml_writer APIs. * include/Makefile.am: Add the new files above to the source distribution. * src/abg-reader.cc: Update top-file comments. (namespace xml_reader): Rename namespace reader into this. (read_to_translation_unit, read_corpus_from_archive): New static functions. (read_translation_unit_from_file) (read_translation_unit_from_file, read_corpus_from_file): New entry points. (struct array_deleter): New functor. (translation_unit::read): Remove this. * src/abg-writer.cc: Update top file comments. (namespace xml_writer): Rename namespace writer into this. (struct archive_write_ctxt): New internal type. (create_archive_write_context, write_translation_unit_to_archive) (write_translation_unit, write_corpus_to_archive): New low level static functions overloads. (write_corpus_to_archive, write_translation_unit): Public higher level overloads. (translation_unit::write): Remove. (dump): Update for new xml_writer namespace. * include/abg-ir.h (translation_unit::{read, write}): Remove these serialization methods. * include/abg-corpus.h (corpus_sptr): New convenience typedef. (corpus::{read, write}): Remove these methods. * src/abg-corpus.cc (corpus::{read, write}) (corpus::impl::{serialized_tus, archive}): Remove these members. (corpus::impl::{get_archive, close_archive, write_tu_to_archive, read_to_translation_unit}): Remove these methods. * tests/test-bidiff.cc (main): Update for usage of the new xml_reader API. * tests/test-read-write.cc (main): Likewise. Update for the usage of the new xml_writer API, too. * tests/test-walker.cc (main): Update for the usage of the new xml_reader API. * tests/test-write-read-archive.cc (main): Likewise. And for the xml_writer API, too. * tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise. * tools/bidiff.cc (main): Likewise, for xml_reader APIs. * tools/bilint.cc (main): Likewise, for xml_writer APIs, too. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-04 08:44:20 +00:00
Add --version option to several libabigail tools This patch changed the revision number of the libabigail library to make it reflect the fact that we are not in "release candidate" mode, before the first 1.0 release. So the revision number is now "rc0". The configuration manager has been updated to support version numbers that are strings, so that it can supports things like "rc0". Then, several libabigail tools have been modified to support the --version option to display their version number. * configure.ac: Set the version revision to "rc0". * doc/manuals/abicompat.rst: Adjust manual for new --version option. * doc/manuals/abidiff.rst: Likewise. * doc/manuals/abidw.rst: Likewise. * doc/manuals/abilint.rst: Likewise. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-config.h (config::{m_format_minor, m_format_major}): Make these be strings. (config::{get,set}_format_minor_version_number): Make these return strings. (config::{get,set}_format_major_version_number): Make these return or take strings. (abigail_get_library_version): Make this take strings. * src/abg-config.cc (config::config): Adjust. (config::{get,set}_format_major_version_number): Make these return or take strings. (config::{get,set}_format_minor_version_number): Make these return strings. (abigail_get_library_version): Make this take strings. * include/abg-version.h.in: Make the version variables be strings. * src/abg-writer.cc (write_translation_unit): The version numbers are now strings so adjust. * tools/{abicompat,abidiff,abidw,abilint,abipkgdiff,abisym}.cc (options::display_version): New data member. (options::options): Initialize it. (display_usage): Add documentation for new --version option. (parse_command_line): Parse new --version option. (main): Support --version. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-11-16 10:39:15 +00:00
if (opts.display_version)
{
emit_prefix(argv[0], cout)
<< abigail::tools_utils::get_library_version_string();
Add --version option to several libabigail tools This patch changed the revision number of the libabigail library to make it reflect the fact that we are not in "release candidate" mode, before the first 1.0 release. So the revision number is now "rc0". The configuration manager has been updated to support version numbers that are strings, so that it can supports things like "rc0". Then, several libabigail tools have been modified to support the --version option to display their version number. * configure.ac: Set the version revision to "rc0". * doc/manuals/abicompat.rst: Adjust manual for new --version option. * doc/manuals/abidiff.rst: Likewise. * doc/manuals/abidw.rst: Likewise. * doc/manuals/abilint.rst: Likewise. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-config.h (config::{m_format_minor, m_format_major}): Make these be strings. (config::{get,set}_format_minor_version_number): Make these return strings. (config::{get,set}_format_major_version_number): Make these return or take strings. (abigail_get_library_version): Make this take strings. * src/abg-config.cc (config::config): Adjust. (config::{get,set}_format_major_version_number): Make these return or take strings. (config::{get,set}_format_minor_version_number): Make these return strings. (abigail_get_library_version): Make this take strings. * include/abg-version.h.in: Make the version variables be strings. * src/abg-writer.cc (write_translation_unit): The version numbers are now strings so adjust. * tools/{abicompat,abidiff,abidw,abilint,abipkgdiff,abisym}.cc (options::display_version): New data member. (options::options): Initialize it. (display_usage): Add documentation for new --version option. (parse_command_line): Parse new --version option. (main): Support --version. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-11-16 10:39:15 +00:00
return 0;
}
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
if (!maybe_check_suppression_files(opts))
return true;
Introduce the concept of environment There are resources needed by the type system and other artifacts of libabigail. Today, when the life time of those resources need to be greater than all of artifacts of Abigail, then said resources are made global. But then global resources are not great, if anything because they complicate the future use of the library in concurrent computing setups. As I was in the need to add one resource to be used by the type system, I decided to sit down and first overhaul how these long lived resources needed to be handled. And here comes the concept of "environment". An environment is a place where one can put resources that need to live longer than all the other artifacts of the Abigail system. And so, the code that creates Abigail artifacts needs and environment of for said artifacts to use. In other words, artifacts now use an environment. This has interesting and strong implications. We can only compare two artifacts if they use the same environment. This is quite a strong requirement. But then when this requirement is fulfilled, comparing two types amounts to just comparing two pointer values; hash values for types can also be cached. Now *that* is great for speed of comparison, is it not? This patch introduce the concept environment (which is basically a new abigail::ir::environment type), removes the global variables and uses the environment instead. Each ABI artifact (either type or decl) now has a ::get_environment() member function to get its environment. This patch also disables the caching of hash values because the caching must happen only *after* all types have been canonicalized. We were not respecting that requirement until now, and that introduces wrong hash values. A subsequent patch is going to re-introduce hash value caching again, once the infrastructure is in place to set a flag in the environment (hah!) once type canonicalization is done, and then later read that flag when some client code requests a hash value, to know if we should look in the hash value cache or not. The patch obviously changes the output of numerous regression tests (if anything b/c it disables hash value caching) so 'make check' yields regressions. But then, it's only the subsequent patch that updates the tests. * include/abg-ir.h: Adjust note about memory management. (class environment): Declare new class. (translation_unit::translation_unit): Take an environment in parameter. (translation_unit::{g,s}et_environment): Declare new member functions. (type_or_decl_base::{g,s}et_environment): Likewise. (type_or_decl_base::{get_cached_hash_value, set_cached_hash_value}): Change the name of decl_base::peek_hash_value() and decl_base::set_hash() here into these and move them here. (type_or_decl_base::hashing_started): Move decl_base::hashing_started() here. ({g,s}et_environment_for_artifact): Declare new functions. (class decl_base): Move member functions hashing_started(), peek_hash_value() and set_hash() on to the type_or_decl_base base class. (scope_decl::scope_decl): Initialize the virtual member type_or_decl_base(). (type_decl::{get_void_type_decl, get_variadic_parameter_type_decl}): Remove these static member functions. They are now non-static member functions of the new environment type. * src/abg-ir.cc (class environment_setter): New internal class. (get_canonical_types_map): Remove. This now becomes a member function of the environment type. (class usage_watchdog): Remove. (usage_watchdog_{s,w}ptr): Remove these typedefs. (get_usage_watchdog_wptr, ref_usage_watchdog) (maybe_cleanup_type_system_data): Remove these functions. (translation_unit::priv::usage_watchdog_): Remove data member. (translation_unit::priv::env_): New data member. (translation_unit::priv::priv): Take an environment and initialize the new env_ data member. Do not initialize the removed usage_watchdog_. (translation_unit::translation_unit): Take an environment parameter. (translation_unit::get_global_scope): Set the environment of a new global scope. (translation_unit::{g,s}et_environment): New accessors. (translation_unit::bind_function_type_life_time): Set the environment of the function type. (struct environment::priv): New class. (environment::{environment, ~environment, get_canonical_types_map, get_variadic_parameter_type_decl, canonicalization_is_done}): New member functions. (struct type_or_decl_base::priv): New class. (type_or_decl_base::{type_or_decl_base, hashing_started, get_cached_hash_value, set_cached_hash_value, set_environment, get_environment, traverse}): New member functions. ({s,g}get_environment_for_artifact): New functions. (decl_base::priv::{hash_, hashing_started}): Remove. (decl_base::priv::priv): Adjust. (decl_base::decl_base): In the copy constructor, initialize the virtual base type_or_decl_base. Do not initialize hash_ and hashing_started data member that got removed. (decl_base::{hashing_started, peek_hash_value, set_hash}): Remove member functions. (strip_typedef): Set the environment of the new type which has its typedefs stripped off. Adjust the call to type_or_void(). (scope_decl::{add, insert}_member_decl): Set the environment of the new member decl to the environment of its scope. (synthesize_type_from_translation_unit) (synthesize_function_type_from_translation_unit): Set the environment for the newly synthesized type. Adjust calls to type_or_void(). (type_or_void): Take an environment in parameter. Get the void type from the environment. (get_canonical_types_map): Remove. (type_base::get_canonical_type_for): Get the canonical types map from the environment, not from a global variable. (type_decl::{get_void_type_decl, get_variadic_parameter_type_decl}): Remove. (pointer_type_def::pointer_type_def): Adjust call to type_or_void. (reference_type_def::reference_type_def): Likewise. (function_decl::parameter::get_pretty_representation): Get the variadic parameter type decl from the environment. (class_decl::priv::classes_being_compared_): Remove static data member. (class_decl::priv::{mark_as_being_compared, unmark_as_being_compared, comparison_started): Use the "classes being compared" map from the environment. (class_decl::base_spec::get_hash): Adjust. (keep_type_alive): Get the alive types array from the environment) not from a global variable anymore. (get_next_string): Put the counter in thread-local storage. * src/abg-hash.cc (scope_decl::hash::operator()) (function_decl::hash::operator()): Do not handle caching (here). * include/abg-corpus.h (corpus::{g,s}et_environment): Declare new accessors. * src/abg-corpus.cc (corpus::priv::env): New data member. (corpus::priv::priv): Initialize it. (corpus::corpus): Take an environment in parameter. (corpus::{g,s}et_environment): Define new member functions (corpus::add): Set the environment of the newly added translation unit, if it's not set already set. In any case, assert that the translation unit must use the same environment as the corpus. * include/abg-dwarf-reader.h (create_read_context) (read_corpus_from_elf): Take an environment parameter. ({s,g}et_debug_info_root_path, {s,g}et_environment): Declare new functions. * src/abg-dwarf-reader.cc (read_context::{env_, offline_callbacks_}): New data members. (read_context::read_context): Initialize them. (read_context::clear_per_translation_unit_data): Do not touch the void type declaration, it doesn't belong to the translation unit. (read_context::{env, offline_callbacks}): New accessors. (read_context::{create_default_dwfl}): New member function. (read_context::dwfl_handle): Add a setter overload. ({s,g}et_debug_info_root_path): Define new accessors. (create_default_dwfl, create_dwfl_sptr, create_default_dwfl_sptr): Remove these. (build_translation_unit_and_add_to_ir): Adjust to pass the environment to the newly created translation unit. (build_function_decl): Adjust to pass the environment to the created function and parameter types. Get variadic parameter type node from the current environment, not from a global variable. And do not try to canonicalize function types here. (read_debug_info_into_corpus): Set the environment of the newly created corpus. (build_ir_node_for_void_type): Get the void type node from the current environment, rather than from a global variable. (create_read_context): Take the environment in parameter. Create the default dwarf front end library handle using the new member function of the read context. Set the current environment used by the reader. (read_corpus_from_elf): Take an environment in parameter. Overhaul. This is now simpler. (has_alt_debug_info): Adjust the call to create_read_context() to make it pass an empty environment. * include/abg-fwd.h (class environment): Forward declare. * include/abg-reader.h (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream) (read_corpus_from_native_xml): Take an environment in parameter. * src/abg-reader.cc (read_context::m_env): New data member. (read_context::read_context): Initialize it. (read_context::{get_environment, set_environment}): New data member. (read_translation_unit): Set environment of the new translation unit. (read_corpus_from_input): Set the environment of the new corpus. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream, read_corpus_from_native_xml): Take an environment in parameter. (build_function_parameter): Get variadic parameter type from the environment. * src/abg-comparison.cc (compute_diff): Add asserts in all the overloads to ensure that the artifact being compared come from the same environment. * tests/print-diff-tree.cc (main): Create an env for the ABI artifacts to use. * tests/test-abidiff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-ir-walker.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tools/abicompat.cc (main): Likewise. * tools/abidiff.cc (main): Likewise. * tools/abidw.cc (main): Likewise. * tools/abilint.cc (main): Likewise. * tools/abipkgdiff.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-09-07 20:27:50 +00:00
abigail::ir::environment_sptr env(new abigail::ir::environment);
if (opts.read_from_stdin)
{
if (!cin.good())
return true;
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
if (opts.read_tu)
{
abigail::translation_unit_sptr tu =
Introduce the concept of environment There are resources needed by the type system and other artifacts of libabigail. Today, when the life time of those resources need to be greater than all of artifacts of Abigail, then said resources are made global. But then global resources are not great, if anything because they complicate the future use of the library in concurrent computing setups. As I was in the need to add one resource to be used by the type system, I decided to sit down and first overhaul how these long lived resources needed to be handled. And here comes the concept of "environment". An environment is a place where one can put resources that need to live longer than all the other artifacts of the Abigail system. And so, the code that creates Abigail artifacts needs and environment of for said artifacts to use. In other words, artifacts now use an environment. This has interesting and strong implications. We can only compare two artifacts if they use the same environment. This is quite a strong requirement. But then when this requirement is fulfilled, comparing two types amounts to just comparing two pointer values; hash values for types can also be cached. Now *that* is great for speed of comparison, is it not? This patch introduce the concept environment (which is basically a new abigail::ir::environment type), removes the global variables and uses the environment instead. Each ABI artifact (either type or decl) now has a ::get_environment() member function to get its environment. This patch also disables the caching of hash values because the caching must happen only *after* all types have been canonicalized. We were not respecting that requirement until now, and that introduces wrong hash values. A subsequent patch is going to re-introduce hash value caching again, once the infrastructure is in place to set a flag in the environment (hah!) once type canonicalization is done, and then later read that flag when some client code requests a hash value, to know if we should look in the hash value cache or not. The patch obviously changes the output of numerous regression tests (if anything b/c it disables hash value caching) so 'make check' yields regressions. But then, it's only the subsequent patch that updates the tests. * include/abg-ir.h: Adjust note about memory management. (class environment): Declare new class. (translation_unit::translation_unit): Take an environment in parameter. (translation_unit::{g,s}et_environment): Declare new member functions. (type_or_decl_base::{g,s}et_environment): Likewise. (type_or_decl_base::{get_cached_hash_value, set_cached_hash_value}): Change the name of decl_base::peek_hash_value() and decl_base::set_hash() here into these and move them here. (type_or_decl_base::hashing_started): Move decl_base::hashing_started() here. ({g,s}et_environment_for_artifact): Declare new functions. (class decl_base): Move member functions hashing_started(), peek_hash_value() and set_hash() on to the type_or_decl_base base class. (scope_decl::scope_decl): Initialize the virtual member type_or_decl_base(). (type_decl::{get_void_type_decl, get_variadic_parameter_type_decl}): Remove these static member functions. They are now non-static member functions of the new environment type. * src/abg-ir.cc (class environment_setter): New internal class. (get_canonical_types_map): Remove. This now becomes a member function of the environment type. (class usage_watchdog): Remove. (usage_watchdog_{s,w}ptr): Remove these typedefs. (get_usage_watchdog_wptr, ref_usage_watchdog) (maybe_cleanup_type_system_data): Remove these functions. (translation_unit::priv::usage_watchdog_): Remove data member. (translation_unit::priv::env_): New data member. (translation_unit::priv::priv): Take an environment and initialize the new env_ data member. Do not initialize the removed usage_watchdog_. (translation_unit::translation_unit): Take an environment parameter. (translation_unit::get_global_scope): Set the environment of a new global scope. (translation_unit::{g,s}et_environment): New accessors. (translation_unit::bind_function_type_life_time): Set the environment of the function type. (struct environment::priv): New class. (environment::{environment, ~environment, get_canonical_types_map, get_variadic_parameter_type_decl, canonicalization_is_done}): New member functions. (struct type_or_decl_base::priv): New class. (type_or_decl_base::{type_or_decl_base, hashing_started, get_cached_hash_value, set_cached_hash_value, set_environment, get_environment, traverse}): New member functions. ({s,g}get_environment_for_artifact): New functions. (decl_base::priv::{hash_, hashing_started}): Remove. (decl_base::priv::priv): Adjust. (decl_base::decl_base): In the copy constructor, initialize the virtual base type_or_decl_base. Do not initialize hash_ and hashing_started data member that got removed. (decl_base::{hashing_started, peek_hash_value, set_hash}): Remove member functions. (strip_typedef): Set the environment of the new type which has its typedefs stripped off. Adjust the call to type_or_void(). (scope_decl::{add, insert}_member_decl): Set the environment of the new member decl to the environment of its scope. (synthesize_type_from_translation_unit) (synthesize_function_type_from_translation_unit): Set the environment for the newly synthesized type. Adjust calls to type_or_void(). (type_or_void): Take an environment in parameter. Get the void type from the environment. (get_canonical_types_map): Remove. (type_base::get_canonical_type_for): Get the canonical types map from the environment, not from a global variable. (type_decl::{get_void_type_decl, get_variadic_parameter_type_decl}): Remove. (pointer_type_def::pointer_type_def): Adjust call to type_or_void. (reference_type_def::reference_type_def): Likewise. (function_decl::parameter::get_pretty_representation): Get the variadic parameter type decl from the environment. (class_decl::priv::classes_being_compared_): Remove static data member. (class_decl::priv::{mark_as_being_compared, unmark_as_being_compared, comparison_started): Use the "classes being compared" map from the environment. (class_decl::base_spec::get_hash): Adjust. (keep_type_alive): Get the alive types array from the environment) not from a global variable anymore. (get_next_string): Put the counter in thread-local storage. * src/abg-hash.cc (scope_decl::hash::operator()) (function_decl::hash::operator()): Do not handle caching (here). * include/abg-corpus.h (corpus::{g,s}et_environment): Declare new accessors. * src/abg-corpus.cc (corpus::priv::env): New data member. (corpus::priv::priv): Initialize it. (corpus::corpus): Take an environment in parameter. (corpus::{g,s}et_environment): Define new member functions (corpus::add): Set the environment of the newly added translation unit, if it's not set already set. In any case, assert that the translation unit must use the same environment as the corpus. * include/abg-dwarf-reader.h (create_read_context) (read_corpus_from_elf): Take an environment parameter. ({s,g}et_debug_info_root_path, {s,g}et_environment): Declare new functions. * src/abg-dwarf-reader.cc (read_context::{env_, offline_callbacks_}): New data members. (read_context::read_context): Initialize them. (read_context::clear_per_translation_unit_data): Do not touch the void type declaration, it doesn't belong to the translation unit. (read_context::{env, offline_callbacks}): New accessors. (read_context::{create_default_dwfl}): New member function. (read_context::dwfl_handle): Add a setter overload. ({s,g}et_debug_info_root_path): Define new accessors. (create_default_dwfl, create_dwfl_sptr, create_default_dwfl_sptr): Remove these. (build_translation_unit_and_add_to_ir): Adjust to pass the environment to the newly created translation unit. (build_function_decl): Adjust to pass the environment to the created function and parameter types. Get variadic parameter type node from the current environment, not from a global variable. And do not try to canonicalize function types here. (read_debug_info_into_corpus): Set the environment of the newly created corpus. (build_ir_node_for_void_type): Get the void type node from the current environment, rather than from a global variable. (create_read_context): Take the environment in parameter. Create the default dwarf front end library handle using the new member function of the read context. Set the current environment used by the reader. (read_corpus_from_elf): Take an environment in parameter. Overhaul. This is now simpler. (has_alt_debug_info): Adjust the call to create_read_context() to make it pass an empty environment. * include/abg-fwd.h (class environment): Forward declare. * include/abg-reader.h (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream) (read_corpus_from_native_xml): Take an environment in parameter. * src/abg-reader.cc (read_context::m_env): New data member. (read_context::read_context): Initialize it. (read_context::{get_environment, set_environment}): New data member. (read_translation_unit): Set environment of the new translation unit. (read_corpus_from_input): Set the environment of the new corpus. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream, read_corpus_from_native_xml): Take an environment in parameter. (build_function_parameter): Get variadic parameter type from the environment. * src/abg-comparison.cc (compute_diff): Add asserts in all the overloads to ensure that the artifact being compared come from the same environment. * tests/print-diff-tree.cc (main): Create an env for the ABI artifacts to use. * tests/test-abidiff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-ir-walker.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tools/abicompat.cc (main): Likewise. * tools/abidiff.cc (main): Likewise. * tools/abidw.cc (main): Likewise. * tools/abilint.cc (main): Likewise. * tools/abipkgdiff.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-09-07 20:27:50 +00:00
read_translation_unit_from_istream(&cin, env.get());
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
if (!tu)
{
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
emit_prefix(argv[0], cerr)
<< "failed to read the ABI instrumentation from stdin\n";
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
return true;
}
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
if (!opts.noout)
write_translation_unit(*tu, 0, cout);
return false;
}
else
{
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
abigail::xml_reader::read_context_sptr ctxt =
abigail::xml_reader::create_native_xml_read_context(&cin,
env.get());
assert(ctxt);
set_suppressions(*ctxt, opts);
corpus_sptr corp = abigail::xml_reader::read_corpus_from_input(*ctxt);
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
if (!opts.noout)
write_corpus(corp, /*indent=*/0, cout);
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
return false;
}
}
else if (!opts.file_path.empty())
{
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
if (!check_file(opts.file_path, cerr, argv[0]))
return true;
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
abigail::translation_unit_sptr tu;
abigail::corpus_sptr corp;
abigail::dwarf_reader::status s = abigail::dwarf_reader::STATUS_OK;
char* di_root_path = 0;
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
file_type type = guess_file_type(opts.file_path);
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
switch (type)
{
Expose a new libabigail::tools_utils namespace The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 10:34:03 +00:00
case abigail::tools_utils::FILE_TYPE_UNKNOWN:
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
emit_prefix(argv[0], cerr)
<< "Unknown file type given in input: " << opts.file_path;
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
return true;
Expose a new libabigail::tools_utils namespace The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 10:34:03 +00:00
case abigail::tools_utils::FILE_TYPE_NATIVE_BI:
Introduce the concept of environment There are resources needed by the type system and other artifacts of libabigail. Today, when the life time of those resources need to be greater than all of artifacts of Abigail, then said resources are made global. But then global resources are not great, if anything because they complicate the future use of the library in concurrent computing setups. As I was in the need to add one resource to be used by the type system, I decided to sit down and first overhaul how these long lived resources needed to be handled. And here comes the concept of "environment". An environment is a place where one can put resources that need to live longer than all the other artifacts of the Abigail system. And so, the code that creates Abigail artifacts needs and environment of for said artifacts to use. In other words, artifacts now use an environment. This has interesting and strong implications. We can only compare two artifacts if they use the same environment. This is quite a strong requirement. But then when this requirement is fulfilled, comparing two types amounts to just comparing two pointer values; hash values for types can also be cached. Now *that* is great for speed of comparison, is it not? This patch introduce the concept environment (which is basically a new abigail::ir::environment type), removes the global variables and uses the environment instead. Each ABI artifact (either type or decl) now has a ::get_environment() member function to get its environment. This patch also disables the caching of hash values because the caching must happen only *after* all types have been canonicalized. We were not respecting that requirement until now, and that introduces wrong hash values. A subsequent patch is going to re-introduce hash value caching again, once the infrastructure is in place to set a flag in the environment (hah!) once type canonicalization is done, and then later read that flag when some client code requests a hash value, to know if we should look in the hash value cache or not. The patch obviously changes the output of numerous regression tests (if anything b/c it disables hash value caching) so 'make check' yields regressions. But then, it's only the subsequent patch that updates the tests. * include/abg-ir.h: Adjust note about memory management. (class environment): Declare new class. (translation_unit::translation_unit): Take an environment in parameter. (translation_unit::{g,s}et_environment): Declare new member functions. (type_or_decl_base::{g,s}et_environment): Likewise. (type_or_decl_base::{get_cached_hash_value, set_cached_hash_value}): Change the name of decl_base::peek_hash_value() and decl_base::set_hash() here into these and move them here. (type_or_decl_base::hashing_started): Move decl_base::hashing_started() here. ({g,s}et_environment_for_artifact): Declare new functions. (class decl_base): Move member functions hashing_started(), peek_hash_value() and set_hash() on to the type_or_decl_base base class. (scope_decl::scope_decl): Initialize the virtual member type_or_decl_base(). (type_decl::{get_void_type_decl, get_variadic_parameter_type_decl}): Remove these static member functions. They are now non-static member functions of the new environment type. * src/abg-ir.cc (class environment_setter): New internal class. (get_canonical_types_map): Remove. This now becomes a member function of the environment type. (class usage_watchdog): Remove. (usage_watchdog_{s,w}ptr): Remove these typedefs. (get_usage_watchdog_wptr, ref_usage_watchdog) (maybe_cleanup_type_system_data): Remove these functions. (translation_unit::priv::usage_watchdog_): Remove data member. (translation_unit::priv::env_): New data member. (translation_unit::priv::priv): Take an environment and initialize the new env_ data member. Do not initialize the removed usage_watchdog_. (translation_unit::translation_unit): Take an environment parameter. (translation_unit::get_global_scope): Set the environment of a new global scope. (translation_unit::{g,s}et_environment): New accessors. (translation_unit::bind_function_type_life_time): Set the environment of the function type. (struct environment::priv): New class. (environment::{environment, ~environment, get_canonical_types_map, get_variadic_parameter_type_decl, canonicalization_is_done}): New member functions. (struct type_or_decl_base::priv): New class. (type_or_decl_base::{type_or_decl_base, hashing_started, get_cached_hash_value, set_cached_hash_value, set_environment, get_environment, traverse}): New member functions. ({s,g}get_environment_for_artifact): New functions. (decl_base::priv::{hash_, hashing_started}): Remove. (decl_base::priv::priv): Adjust. (decl_base::decl_base): In the copy constructor, initialize the virtual base type_or_decl_base. Do not initialize hash_ and hashing_started data member that got removed. (decl_base::{hashing_started, peek_hash_value, set_hash}): Remove member functions. (strip_typedef): Set the environment of the new type which has its typedefs stripped off. Adjust the call to type_or_void(). (scope_decl::{add, insert}_member_decl): Set the environment of the new member decl to the environment of its scope. (synthesize_type_from_translation_unit) (synthesize_function_type_from_translation_unit): Set the environment for the newly synthesized type. Adjust calls to type_or_void(). (type_or_void): Take an environment in parameter. Get the void type from the environment. (get_canonical_types_map): Remove. (type_base::get_canonical_type_for): Get the canonical types map from the environment, not from a global variable. (type_decl::{get_void_type_decl, get_variadic_parameter_type_decl}): Remove. (pointer_type_def::pointer_type_def): Adjust call to type_or_void. (reference_type_def::reference_type_def): Likewise. (function_decl::parameter::get_pretty_representation): Get the variadic parameter type decl from the environment. (class_decl::priv::classes_being_compared_): Remove static data member. (class_decl::priv::{mark_as_being_compared, unmark_as_being_compared, comparison_started): Use the "classes being compared" map from the environment. (class_decl::base_spec::get_hash): Adjust. (keep_type_alive): Get the alive types array from the environment) not from a global variable anymore. (get_next_string): Put the counter in thread-local storage. * src/abg-hash.cc (scope_decl::hash::operator()) (function_decl::hash::operator()): Do not handle caching (here). * include/abg-corpus.h (corpus::{g,s}et_environment): Declare new accessors. * src/abg-corpus.cc (corpus::priv::env): New data member. (corpus::priv::priv): Initialize it. (corpus::corpus): Take an environment in parameter. (corpus::{g,s}et_environment): Define new member functions (corpus::add): Set the environment of the newly added translation unit, if it's not set already set. In any case, assert that the translation unit must use the same environment as the corpus. * include/abg-dwarf-reader.h (create_read_context) (read_corpus_from_elf): Take an environment parameter. ({s,g}et_debug_info_root_path, {s,g}et_environment): Declare new functions. * src/abg-dwarf-reader.cc (read_context::{env_, offline_callbacks_}): New data members. (read_context::read_context): Initialize them. (read_context::clear_per_translation_unit_data): Do not touch the void type declaration, it doesn't belong to the translation unit. (read_context::{env, offline_callbacks}): New accessors. (read_context::{create_default_dwfl}): New member function. (read_context::dwfl_handle): Add a setter overload. ({s,g}et_debug_info_root_path): Define new accessors. (create_default_dwfl, create_dwfl_sptr, create_default_dwfl_sptr): Remove these. (build_translation_unit_and_add_to_ir): Adjust to pass the environment to the newly created translation unit. (build_function_decl): Adjust to pass the environment to the created function and parameter types. Get variadic parameter type node from the current environment, not from a global variable. And do not try to canonicalize function types here. (read_debug_info_into_corpus): Set the environment of the newly created corpus. (build_ir_node_for_void_type): Get the void type node from the current environment, rather than from a global variable. (create_read_context): Take the environment in parameter. Create the default dwarf front end library handle using the new member function of the read context. Set the current environment used by the reader. (read_corpus_from_elf): Take an environment in parameter. Overhaul. This is now simpler. (has_alt_debug_info): Adjust the call to create_read_context() to make it pass an empty environment. * include/abg-fwd.h (class environment): Forward declare. * include/abg-reader.h (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream) (read_corpus_from_native_xml): Take an environment in parameter. * src/abg-reader.cc (read_context::m_env): New data member. (read_context::read_context): Initialize it. (read_context::{get_environment, set_environment}): New data member. (read_translation_unit): Set environment of the new translation unit. (read_corpus_from_input): Set the environment of the new corpus. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream, read_corpus_from_native_xml): Take an environment in parameter. (build_function_parameter): Get variadic parameter type from the environment. * src/abg-comparison.cc (compute_diff): Add asserts in all the overloads to ensure that the artifact being compared come from the same environment. * tests/print-diff-tree.cc (main): Create an env for the ABI artifacts to use. * tests/test-abidiff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-ir-walker.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tools/abicompat.cc (main): Likewise. * tools/abidiff.cc (main): Likewise. * tools/abidw.cc (main): Likewise. * tools/abilint.cc (main): Likewise. * tools/abipkgdiff.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-09-07 20:27:50 +00:00
tu = read_translation_unit_from_file(opts.file_path, env.get());
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
break;
Expose a new libabigail::tools_utils namespace The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 10:34:03 +00:00
case abigail::tools_utils::FILE_TYPE_ELF:
case abigail::tools_utils::FILE_TYPE_AR:
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
{
di_root_path = opts.di_root_path.get();
abigail::dwarf_reader::read_context_sptr ctxt =
abigail::dwarf_reader::create_read_context(opts.file_path,
&di_root_path,
env.get(),
/*load_all_types=*/false);
assert(ctxt);
set_suppressions(*ctxt, opts);
corp = read_corpus_from_elf(*ctxt, s);
}
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
break;
Expose a new libabigail::tools_utils namespace The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 10:34:03 +00:00
case abigail::tools_utils::FILE_TYPE_XML_CORPUS:
Drop suppressed ABI artifacts from the IR This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-19 16:03:19 +00:00
{
abigail::xml_reader::read_context_sptr ctxt =
abigail::xml_reader::create_native_xml_read_context(opts.file_path,
env.get());
assert(ctxt);
set_suppressions(*ctxt, opts);
corp = read_corpus_from_input(*ctxt);
break;
}
Expose a new libabigail::tools_utils namespace The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 10:34:03 +00:00
case abigail::tools_utils::FILE_TYPE_ZIP_CORPUS:
#if WITH_ZIP_ARCHIVE
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
corp = read_corpus_from_file(opts.file_path);
#endif
Initial support of de-serializing the KMI of a Linux Kernel Tree With this patch, kmidiff knows how to compare a serialized corpus_group that represents a Kernel Module Interface (a .kmi file) against either another serialized .kmi file, or against a kernel tree. The patch extends the abixml reader to make it parse an 'abi-corpus-group' element. To do that, the patch modifies read_corpus_from_input to make it be capable of parsing several 'abi-corpus' in a row. That modified function is then used by a new read_corpus_group_from_input, which is itself used by the new public entry points read_corpus_group_from_native_xml_file and read_corpus_group_from_native_xml. With that read_corpus_group_from_native_xml_file building block function, the kmidiff program is modified so that it can take either two directory trees, two .kmi files or one directory tree and one .kmi file. * include/abg-libxml-utils.h (advance_to_next_sibling_element): Declare new function. * src/abg-libxml-utils.cc (go_to_next_sibling_element_or_stay) (advance_to_next_sibling_element): Define new functions. * include/abg-reader.h (read_corpus_group_from_input) (read_corpus_group_from_native_xml) (read_corpus_group_from_native_xml_file): Declare new functions. * src/abg-reader.cc (read_context::m_corpus_group): New data member. (read_context::{get_corpus_group, set_corpus_group}): Define new member functions. (read_translation_unit_from_input): Cleanup logic. (read_corpus_from_input): Don't assume that the document is starting with an 'abi-corpus' element. Support the mode where a caller called the xmlTextReaderExpand function (and so we are given an expanded xmlNodePtr) and the mode where we need to use the xmlTextReader API to walk through the 'abi-corpus' element. Also, if we are building a corpus group, do not clear what used to be 'per-corpus' data. That data must be shared by all the corpora of a given abi-corpus-group. (read_corpus_group_from_input, read_corpus_group_from_native_xml) (read_corpus_group_from_native_xml_file): Define new functions. * include/abg-tools-utils.h (FILE_TYPE_XML_CORPUS_GROUP): New enumerator of the file_type enum. * src/abg-tools-utils.cc (operator<<): In the overload for file_type, add a case for the new FILE_TYPE_XML_CORPUS_GROUP. (guess_file_type): Dectect abi-corpus-group xml element. * tools/abidiff.cc (adjust_diff_context_for_kmidiff): Define new static function. (main): Adjust to handle the new FILE_TYPE_XML_CORPUS_GROUP. That is, compare two FILE_TYPE_XML_CORPUS_GROUP if they are present. * tools/abilint.cc (main): Likewise. * tools/kmidiff.cc (main): Detect that one of two .kmi files are passed. In that case, load the .kmi file(s), build a corpus_group of it and use it in the comparison. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-04-07 21:06:14 +00:00
break;
case abigail::tools_utils::FILE_TYPE_RPM:
break;
case abigail::tools_utils::FILE_TYPE_SRPM:
break;
case abigail::tools_utils::FILE_TYPE_DEB:
break;
case abigail::tools_utils::FILE_TYPE_DIR:
break;
case abigail::tools_utils::FILE_TYPE_TAR:
break;
case abigail::tools_utils::FILE_TYPE_XML_CORPUS_GROUP:
break;
}
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
if (!tu && !corp)
{
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
emit_prefix(argv[0], cerr)
<< "failed to read " << opts.file_path << "\n";
Support comparing symbols not referenced by debug info * doc/manuals/abidiff.rst: Adjust intro to mention that w/o debug info, abidiff now works but just report about added/removed symbols. Add documentation about the new --no-unreferenced-symbols option. * include/abg-comparison.h (string_elf_symbol_map): New typedef. (diff_context::show_symbols_unreferenced_by_debug_info): Declare new accessors. * src/abg-comparison.cc (diff_context::priv::show_syms_unreferenced_by_di_): New data member. (diff_context::priv::priv): Adjust. (diff_context::show_symbols_unreferenced_by_debug_info): Implement these accessors. (corpus_diff::priv::{unrefed_fn_syms_edit_script_, unrefed_var_syms_edit_script_, added_unrefed_fn_syms_, deleted_unrefed_fn_syms_, added_unrefed_var_syms_, deleted_unrefed_var_syms_}): New data members. (corpus_diff::priv::diff_stats::{num_func_syms_removed, num_func_syms_added, num_var_syms_removed, num_var_syms_added}): New data members. (corpus_diff::priv::diff_stats::diff_stats): Adjust. (corpus_diff::ensure_lookup_tables_populated): Populate lookup tables for added/removed symbols that are not referenced by any debug info. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Compute stats for the added/removed symbols not referenced by any debug info. (corpus_diff::priv::emit_diff_stats): Emit stats about added/removed symbols that are not referenced by any debug info. (corpus_diff::length): Adjust to take in account added/removed symbols not referenced by any debug info. (show_linkage_name_and_aliases): New static function. (corpus_diff::report): When emitting a symbol name, emit its version too, and tell if it aliases other symbols. Avoid emitted extra new lines. Report added/removed symbols not referenced by any debug info. (compute_diff): In the overload for corpus_sptr, compute the diffs for symbols not referenced by debug info. * include/abg-corpus.h (corpus::get_unreferenced_{function,variable}_symbols): Declare new member functions. * src/abg-corpus.cc (corpus_priv::{unrefed_fun_symbols, unrefed_var_symbols}): New data members. (corpus_priv::build_unreferenced_symbols_tables): Define new member function. (struct comp_elf_symbols_functor): New functor. (corpus::is_empty): Adjust to take in account added/removed symbols not referenced by debug info. (corpus::{get_unreferenced_function_symbols, corpus::get_unreferenced_variable_symbols}): Define these accessors. * include/abg-dwarf-reader.h (enum status): Transform this into bitfields. Add a STATUS_UNKNOWN value that has the value 0. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): New bit-wise operators to manipulate instances of the status bit-field. * src/abg-dwarf-reader.cc (get_version_for_symbol): Fix this to avoid returning garbage version sometimes. (read_debug_info_into_corpus): Fix this to return a non-null but empty corpus_sptr when there is no debug info available. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): Define these new bitwise operators to manipulate instances of the status bit-field. (read_corpus_from_elf): Now that the abigail::dwarf_reader::status is a bit-field, set it to reflect if debug info and/or symbol tables have been found. Do not bail out if debug info hasn't been found. Rather, keep going, and go look for symbols-only; this is a kind of operating in degraded mode. * include/abg-ir.h (elf_symbol::get_aliases_id_string): Add a flag that says if the current instance of elf_symbol should be included in the list of aliases or not. * src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define it. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.o: New test input. * tools/abidiff.cc (options::show_symbols_not_referenced_by_debug_info): New data member. (options:options): Adjust. (display_usage): Add an info string for the new --no-unreferenced-symbols command line option. (parse_command_line): Parse the new --no-unreferenced-symbols command line. (set_diff_context_from_opts): Set the diff_context according to the presence of --no-unreferenced-symbols. (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field. * tools/abilint.cc (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field.. (): * tests/data/test-diff-dwarf/test16-syms-only-report.txt: New test reference output. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.o: New test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.cc: New source code for test input. * tests/data/test-diff-dwarf/libtest18-alias-sym-v{0,1}.so: New test input. * tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Reference output for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-version-script: Source code for new test input. * tests/Makefile.am: Add the new test materials to the source distribution. * tests/test-diff-dwarf.cc(in_out_specs): Add the new input tests above to the array of tests to run by this harness. (main): Emit empty reports for empty resulting diffs. * tests/data/test-diff-dwarf/test{0,8,9,12,14-inline-report,}-report.txt: Adjust. * tests/data/test-diff-filter/test{0,01,2,4,5,7,8,9,10,12,13,15-0,15-1}-report.txt: Likewise. * tests/data/test-diff-filter/test{19-enum,20-inline,}-report-0.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-{1,2}.txt: Likewise. * tests/data/test-diff-suppr/test{1,2}-typedef-suppr-report-1.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-22 16:05:31 +00:00
if (!(s & abigail::dwarf_reader::STATUS_OK))
{
Support comparing symbols not referenced by debug info * doc/manuals/abidiff.rst: Adjust intro to mention that w/o debug info, abidiff now works but just report about added/removed symbols. Add documentation about the new --no-unreferenced-symbols option. * include/abg-comparison.h (string_elf_symbol_map): New typedef. (diff_context::show_symbols_unreferenced_by_debug_info): Declare new accessors. * src/abg-comparison.cc (diff_context::priv::show_syms_unreferenced_by_di_): New data member. (diff_context::priv::priv): Adjust. (diff_context::show_symbols_unreferenced_by_debug_info): Implement these accessors. (corpus_diff::priv::{unrefed_fn_syms_edit_script_, unrefed_var_syms_edit_script_, added_unrefed_fn_syms_, deleted_unrefed_fn_syms_, added_unrefed_var_syms_, deleted_unrefed_var_syms_}): New data members. (corpus_diff::priv::diff_stats::{num_func_syms_removed, num_func_syms_added, num_var_syms_removed, num_var_syms_added}): New data members. (corpus_diff::priv::diff_stats::diff_stats): Adjust. (corpus_diff::ensure_lookup_tables_populated): Populate lookup tables for added/removed symbols that are not referenced by any debug info. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Compute stats for the added/removed symbols not referenced by any debug info. (corpus_diff::priv::emit_diff_stats): Emit stats about added/removed symbols that are not referenced by any debug info. (corpus_diff::length): Adjust to take in account added/removed symbols not referenced by any debug info. (show_linkage_name_and_aliases): New static function. (corpus_diff::report): When emitting a symbol name, emit its version too, and tell if it aliases other symbols. Avoid emitted extra new lines. Report added/removed symbols not referenced by any debug info. (compute_diff): In the overload for corpus_sptr, compute the diffs for symbols not referenced by debug info. * include/abg-corpus.h (corpus::get_unreferenced_{function,variable}_symbols): Declare new member functions. * src/abg-corpus.cc (corpus_priv::{unrefed_fun_symbols, unrefed_var_symbols}): New data members. (corpus_priv::build_unreferenced_symbols_tables): Define new member function. (struct comp_elf_symbols_functor): New functor. (corpus::is_empty): Adjust to take in account added/removed symbols not referenced by debug info. (corpus::{get_unreferenced_function_symbols, corpus::get_unreferenced_variable_symbols}): Define these accessors. * include/abg-dwarf-reader.h (enum status): Transform this into bitfields. Add a STATUS_UNKNOWN value that has the value 0. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): New bit-wise operators to manipulate instances of the status bit-field. * src/abg-dwarf-reader.cc (get_version_for_symbol): Fix this to avoid returning garbage version sometimes. (read_debug_info_into_corpus): Fix this to return a non-null but empty corpus_sptr when there is no debug info available. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): Define these new bitwise operators to manipulate instances of the status bit-field. (read_corpus_from_elf): Now that the abigail::dwarf_reader::status is a bit-field, set it to reflect if debug info and/or symbol tables have been found. Do not bail out if debug info hasn't been found. Rather, keep going, and go look for symbols-only; this is a kind of operating in degraded mode. * include/abg-ir.h (elf_symbol::get_aliases_id_string): Add a flag that says if the current instance of elf_symbol should be included in the list of aliases or not. * src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define it. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.o: New test input. * tools/abidiff.cc (options::show_symbols_not_referenced_by_debug_info): New data member. (options:options): Adjust. (display_usage): Add an info string for the new --no-unreferenced-symbols command line option. (parse_command_line): Parse the new --no-unreferenced-symbols command line. (set_diff_context_from_opts): Set the diff_context according to the presence of --no-unreferenced-symbols. (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field. * tools/abilint.cc (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field.. (): * tests/data/test-diff-dwarf/test16-syms-only-report.txt: New test reference output. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.o: New test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.cc: New source code for test input. * tests/data/test-diff-dwarf/libtest18-alias-sym-v{0,1}.so: New test input. * tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Reference output for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-version-script: Source code for new test input. * tests/Makefile.am: Add the new test materials to the source distribution. * tests/test-diff-dwarf.cc(in_out_specs): Add the new input tests above to the array of tests to run by this harness. (main): Emit empty reports for empty resulting diffs. * tests/data/test-diff-dwarf/test{0,8,9,12,14-inline-report,}-report.txt: Adjust. * tests/data/test-diff-filter/test{0,01,2,4,5,7,8,9,10,12,13,15-0,15-1}-report.txt: Likewise. * tests/data/test-diff-filter/test{19-enum,20-inline,}-report-0.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-{1,2}.txt: Likewise. * tests/data/test-diff-suppr/test{1,2}-typedef-suppr-report-1.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-22 16:05:31 +00:00
if (s & abigail::dwarf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
{
cerr << "could not find the debug info";
if(di_root_path == 0)
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
emit_prefix(argv[0], cerr)
<< " Maybe you should consider using the "
"--debug-info-dir1 option to tell me about the "
"root directory of the debuginfo? "
"(e.g, --debug-info-dir1 /usr/lib/debug)\n";
Support comparing symbols not referenced by debug info * doc/manuals/abidiff.rst: Adjust intro to mention that w/o debug info, abidiff now works but just report about added/removed symbols. Add documentation about the new --no-unreferenced-symbols option. * include/abg-comparison.h (string_elf_symbol_map): New typedef. (diff_context::show_symbols_unreferenced_by_debug_info): Declare new accessors. * src/abg-comparison.cc (diff_context::priv::show_syms_unreferenced_by_di_): New data member. (diff_context::priv::priv): Adjust. (diff_context::show_symbols_unreferenced_by_debug_info): Implement these accessors. (corpus_diff::priv::{unrefed_fn_syms_edit_script_, unrefed_var_syms_edit_script_, added_unrefed_fn_syms_, deleted_unrefed_fn_syms_, added_unrefed_var_syms_, deleted_unrefed_var_syms_}): New data members. (corpus_diff::priv::diff_stats::{num_func_syms_removed, num_func_syms_added, num_var_syms_removed, num_var_syms_added}): New data members. (corpus_diff::priv::diff_stats::diff_stats): Adjust. (corpus_diff::ensure_lookup_tables_populated): Populate lookup tables for added/removed symbols that are not referenced by any debug info. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Compute stats for the added/removed symbols not referenced by any debug info. (corpus_diff::priv::emit_diff_stats): Emit stats about added/removed symbols that are not referenced by any debug info. (corpus_diff::length): Adjust to take in account added/removed symbols not referenced by any debug info. (show_linkage_name_and_aliases): New static function. (corpus_diff::report): When emitting a symbol name, emit its version too, and tell if it aliases other symbols. Avoid emitted extra new lines. Report added/removed symbols not referenced by any debug info. (compute_diff): In the overload for corpus_sptr, compute the diffs for symbols not referenced by debug info. * include/abg-corpus.h (corpus::get_unreferenced_{function,variable}_symbols): Declare new member functions. * src/abg-corpus.cc (corpus_priv::{unrefed_fun_symbols, unrefed_var_symbols}): New data members. (corpus_priv::build_unreferenced_symbols_tables): Define new member function. (struct comp_elf_symbols_functor): New functor. (corpus::is_empty): Adjust to take in account added/removed symbols not referenced by debug info. (corpus::{get_unreferenced_function_symbols, corpus::get_unreferenced_variable_symbols}): Define these accessors. * include/abg-dwarf-reader.h (enum status): Transform this into bitfields. Add a STATUS_UNKNOWN value that has the value 0. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): New bit-wise operators to manipulate instances of the status bit-field. * src/abg-dwarf-reader.cc (get_version_for_symbol): Fix this to avoid returning garbage version sometimes. (read_debug_info_into_corpus): Fix this to return a non-null but empty corpus_sptr when there is no debug info available. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): Define these new bitwise operators to manipulate instances of the status bit-field. (read_corpus_from_elf): Now that the abigail::dwarf_reader::status is a bit-field, set it to reflect if debug info and/or symbol tables have been found. Do not bail out if debug info hasn't been found. Rather, keep going, and go look for symbols-only; this is a kind of operating in degraded mode. * include/abg-ir.h (elf_symbol::get_aliases_id_string): Add a flag that says if the current instance of elf_symbol should be included in the list of aliases or not. * src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define it. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.o: New test input. * tools/abidiff.cc (options::show_symbols_not_referenced_by_debug_info): New data member. (options:options): Adjust. (display_usage): Add an info string for the new --no-unreferenced-symbols command line option. (parse_command_line): Parse the new --no-unreferenced-symbols command line. (set_diff_context_from_opts): Set the diff_context according to the presence of --no-unreferenced-symbols. (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field. * tools/abilint.cc (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field.. (): * tests/data/test-diff-dwarf/test16-syms-only-report.txt: New test reference output. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.o: New test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.cc: New source code for test input. * tests/data/test-diff-dwarf/libtest18-alias-sym-v{0,1}.so: New test input. * tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Reference output for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-version-script: Source code for new test input. * tests/Makefile.am: Add the new test materials to the source distribution. * tests/test-diff-dwarf.cc(in_out_specs): Add the new input tests above to the array of tests to run by this harness. (main): Emit empty reports for empty resulting diffs. * tests/data/test-diff-dwarf/test{0,8,9,12,14-inline-report,}-report.txt: Adjust. * tests/data/test-diff-filter/test{0,01,2,4,5,7,8,9,10,12,13,15-0,15-1}-report.txt: Likewise. * tests/data/test-diff-filter/test{19-enum,20-inline,}-report-0.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-{1,2}.txt: Likewise. * tests/data/test-diff-suppr/test{1,2}-typedef-suppr-report-1.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-22 16:05:31 +00:00
else
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
emit_prefix(argv[0], cerr)
<< "Maybe the root path to the debug "
Support comparing symbols not referenced by debug info * doc/manuals/abidiff.rst: Adjust intro to mention that w/o debug info, abidiff now works but just report about added/removed symbols. Add documentation about the new --no-unreferenced-symbols option. * include/abg-comparison.h (string_elf_symbol_map): New typedef. (diff_context::show_symbols_unreferenced_by_debug_info): Declare new accessors. * src/abg-comparison.cc (diff_context::priv::show_syms_unreferenced_by_di_): New data member. (diff_context::priv::priv): Adjust. (diff_context::show_symbols_unreferenced_by_debug_info): Implement these accessors. (corpus_diff::priv::{unrefed_fn_syms_edit_script_, unrefed_var_syms_edit_script_, added_unrefed_fn_syms_, deleted_unrefed_fn_syms_, added_unrefed_var_syms_, deleted_unrefed_var_syms_}): New data members. (corpus_diff::priv::diff_stats::{num_func_syms_removed, num_func_syms_added, num_var_syms_removed, num_var_syms_added}): New data members. (corpus_diff::priv::diff_stats::diff_stats): Adjust. (corpus_diff::ensure_lookup_tables_populated): Populate lookup tables for added/removed symbols that are not referenced by any debug info. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Compute stats for the added/removed symbols not referenced by any debug info. (corpus_diff::priv::emit_diff_stats): Emit stats about added/removed symbols that are not referenced by any debug info. (corpus_diff::length): Adjust to take in account added/removed symbols not referenced by any debug info. (show_linkage_name_and_aliases): New static function. (corpus_diff::report): When emitting a symbol name, emit its version too, and tell if it aliases other symbols. Avoid emitted extra new lines. Report added/removed symbols not referenced by any debug info. (compute_diff): In the overload for corpus_sptr, compute the diffs for symbols not referenced by debug info. * include/abg-corpus.h (corpus::get_unreferenced_{function,variable}_symbols): Declare new member functions. * src/abg-corpus.cc (corpus_priv::{unrefed_fun_symbols, unrefed_var_symbols}): New data members. (corpus_priv::build_unreferenced_symbols_tables): Define new member function. (struct comp_elf_symbols_functor): New functor. (corpus::is_empty): Adjust to take in account added/removed symbols not referenced by debug info. (corpus::{get_unreferenced_function_symbols, corpus::get_unreferenced_variable_symbols}): Define these accessors. * include/abg-dwarf-reader.h (enum status): Transform this into bitfields. Add a STATUS_UNKNOWN value that has the value 0. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): New bit-wise operators to manipulate instances of the status bit-field. * src/abg-dwarf-reader.cc (get_version_for_symbol): Fix this to avoid returning garbage version sometimes. (read_debug_info_into_corpus): Fix this to return a non-null but empty corpus_sptr when there is no debug info available. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): Define these new bitwise operators to manipulate instances of the status bit-field. (read_corpus_from_elf): Now that the abigail::dwarf_reader::status is a bit-field, set it to reflect if debug info and/or symbol tables have been found. Do not bail out if debug info hasn't been found. Rather, keep going, and go look for symbols-only; this is a kind of operating in degraded mode. * include/abg-ir.h (elf_symbol::get_aliases_id_string): Add a flag that says if the current instance of elf_symbol should be included in the list of aliases or not. * src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define it. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.o: New test input. * tools/abidiff.cc (options::show_symbols_not_referenced_by_debug_info): New data member. (options:options): Adjust. (display_usage): Add an info string for the new --no-unreferenced-symbols command line option. (parse_command_line): Parse the new --no-unreferenced-symbols command line. (set_diff_context_from_opts): Set the diff_context according to the presence of --no-unreferenced-symbols. (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field. * tools/abilint.cc (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field.. (): * tests/data/test-diff-dwarf/test16-syms-only-report.txt: New test reference output. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.o: New test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.cc: New source code for test input. * tests/data/test-diff-dwarf/libtest18-alias-sym-v{0,1}.so: New test input. * tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Reference output for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-version-script: Source code for new test input. * tests/Makefile.am: Add the new test materials to the source distribution. * tests/test-diff-dwarf.cc(in_out_specs): Add the new input tests above to the array of tests to run by this harness. (main): Emit empty reports for empty resulting diffs. * tests/data/test-diff-dwarf/test{0,8,9,12,14-inline-report,}-report.txt: Adjust. * tests/data/test-diff-filter/test{0,01,2,4,5,7,8,9,10,12,13,15-0,15-1}-report.txt: Likewise. * tests/data/test-diff-filter/test{19-enum,20-inline,}-report-0.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-{1,2}.txt: Likewise. * tests/data/test-diff-suppr/test{1,2}-typedef-suppr-report-1.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-22 16:05:31 +00:00
"information is wrong?\n";
}
Support comparing symbols not referenced by debug info * doc/manuals/abidiff.rst: Adjust intro to mention that w/o debug info, abidiff now works but just report about added/removed symbols. Add documentation about the new --no-unreferenced-symbols option. * include/abg-comparison.h (string_elf_symbol_map): New typedef. (diff_context::show_symbols_unreferenced_by_debug_info): Declare new accessors. * src/abg-comparison.cc (diff_context::priv::show_syms_unreferenced_by_di_): New data member. (diff_context::priv::priv): Adjust. (diff_context::show_symbols_unreferenced_by_debug_info): Implement these accessors. (corpus_diff::priv::{unrefed_fn_syms_edit_script_, unrefed_var_syms_edit_script_, added_unrefed_fn_syms_, deleted_unrefed_fn_syms_, added_unrefed_var_syms_, deleted_unrefed_var_syms_}): New data members. (corpus_diff::priv::diff_stats::{num_func_syms_removed, num_func_syms_added, num_var_syms_removed, num_var_syms_added}): New data members. (corpus_diff::priv::diff_stats::diff_stats): Adjust. (corpus_diff::ensure_lookup_tables_populated): Populate lookup tables for added/removed symbols that are not referenced by any debug info. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Compute stats for the added/removed symbols not referenced by any debug info. (corpus_diff::priv::emit_diff_stats): Emit stats about added/removed symbols that are not referenced by any debug info. (corpus_diff::length): Adjust to take in account added/removed symbols not referenced by any debug info. (show_linkage_name_and_aliases): New static function. (corpus_diff::report): When emitting a symbol name, emit its version too, and tell if it aliases other symbols. Avoid emitted extra new lines. Report added/removed symbols not referenced by any debug info. (compute_diff): In the overload for corpus_sptr, compute the diffs for symbols not referenced by debug info. * include/abg-corpus.h (corpus::get_unreferenced_{function,variable}_symbols): Declare new member functions. * src/abg-corpus.cc (corpus_priv::{unrefed_fun_symbols, unrefed_var_symbols}): New data members. (corpus_priv::build_unreferenced_symbols_tables): Define new member function. (struct comp_elf_symbols_functor): New functor. (corpus::is_empty): Adjust to take in account added/removed symbols not referenced by debug info. (corpus::{get_unreferenced_function_symbols, corpus::get_unreferenced_variable_symbols}): Define these accessors. * include/abg-dwarf-reader.h (enum status): Transform this into bitfields. Add a STATUS_UNKNOWN value that has the value 0. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): New bit-wise operators to manipulate instances of the status bit-field. * src/abg-dwarf-reader.cc (get_version_for_symbol): Fix this to avoid returning garbage version sometimes. (read_debug_info_into_corpus): Fix this to return a non-null but empty corpus_sptr when there is no debug info available. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): Define these new bitwise operators to manipulate instances of the status bit-field. (read_corpus_from_elf): Now that the abigail::dwarf_reader::status is a bit-field, set it to reflect if debug info and/or symbol tables have been found. Do not bail out if debug info hasn't been found. Rather, keep going, and go look for symbols-only; this is a kind of operating in degraded mode. * include/abg-ir.h (elf_symbol::get_aliases_id_string): Add a flag that says if the current instance of elf_symbol should be included in the list of aliases or not. * src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define it. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.o: New test input. * tools/abidiff.cc (options::show_symbols_not_referenced_by_debug_info): New data member. (options:options): Adjust. (display_usage): Add an info string for the new --no-unreferenced-symbols command line option. (parse_command_line): Parse the new --no-unreferenced-symbols command line. (set_diff_context_from_opts): Set the diff_context according to the presence of --no-unreferenced-symbols. (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field. * tools/abilint.cc (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field.. (): * tests/data/test-diff-dwarf/test16-syms-only-report.txt: New test reference output. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.o: New test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.cc: New source code for test input. * tests/data/test-diff-dwarf/libtest18-alias-sym-v{0,1}.so: New test input. * tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Reference output for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-version-script: Source code for new test input. * tests/Makefile.am: Add the new test materials to the source distribution. * tests/test-diff-dwarf.cc(in_out_specs): Add the new input tests above to the array of tests to run by this harness. (main): Emit empty reports for empty resulting diffs. * tests/data/test-diff-dwarf/test{0,8,9,12,14-inline-report,}-report.txt: Adjust. * tests/data/test-diff-filter/test{0,01,2,4,5,7,8,9,10,12,13,15-0,15-1}-report.txt: Likewise. * tests/data/test-diff-filter/test{19-enum,20-inline,}-report-0.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-{1,2}.txt: Likewise. * tests/data/test-diff-suppr/test{1,2}-typedef-suppr-report-1.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-22 16:05:31 +00:00
if (s & abigail::dwarf_reader::STATUS_NO_SYMBOLS_FOUND)
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
emit_prefix(argv[0], cerr)
<< "could not find the ELF symbols in the file "
<< opts.file_path
<< "\n";
}
return true;
}
using abigail::tools_utils::temp_file;
using abigail::tools_utils::temp_file_sptr;
temp_file_sptr tmp_file = temp_file::create();
if (!tmp_file)
{
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
emit_prefix(argv[0], cerr) << "failed to create temporary file\n";
return true;
}
std::iostream& of = tmp_file->get_stream();
bool r = true;
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
if (tu)
{
if (opts.diff)
r = write_translation_unit(*tu, /*indent=*/0,
tmp_file->get_stream());
if (!opts.noout && !opts.diff)
r &= write_translation_unit(*tu, /*indent=*/0, cout);
}
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
else
{
r = true;
Expose a new libabigail::tools_utils namespace The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 10:34:03 +00:00
if (type == abigail::tools_utils::FILE_TYPE_XML_CORPUS)
{
if (opts.diff)
r = write_corpus(corp, /*indent=*/0, of);
if (!opts.noout && !opts.diff)
r &= write_corpus(corp, /*indent=*/0, cout);
}
Expose a new libabigail::tools_utils namespace The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 10:34:03 +00:00
else if (type == abigail::tools_utils::FILE_TYPE_ZIP_CORPUS)
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
{
#ifdef WITH_ZIP_ARCHIVE
if (!opts.noout)
r = write_corpus_to_archive(*corp, tmp_file->get_path());
#endif //WITH_ZIP_ARCHIVE
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
}
Expose a new libabigail::tools_utils namespace The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 10:34:03 +00:00
else if (type == abigail::tools_utils::FILE_TYPE_ELF)
{
if (!opts.noout)
r = write_corpus(corp, /*indent=*/0, cout);
}
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
}
bool is_ok = r;
if (!is_ok)
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
{
string output =
Expose a new libabigail::tools_utils namespace The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 10:34:03 +00:00
(type == abigail::tools_utils::FILE_TYPE_NATIVE_BI)
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
? "translation unit"
: "ABI corpus";
Emit more informational messages on unrecognized options This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-12 11:37:04 +00:00
emit_prefix(argv[0], cerr)
<< "failed to write the translation unit "
<< opts.file_path << " back\n";
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
}
Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 13:12:26 +00:00
if (is_ok
&& opts.diff
Expose a new libabigail::tools_utils namespace The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 10:34:03 +00:00
&& ((type == abigail::tools_utils::FILE_TYPE_XML_CORPUS)
|| type == abigail::tools_utils::FILE_TYPE_NATIVE_BI
|| type == abigail::tools_utils::FILE_TYPE_ZIP_CORPUS))
{
string cmd = "diff -u " + opts.file_path + " " + tmp_file->get_path();
if (system(cmd.c_str()))
is_ok = false;
}
return !is_ok;
}
return true;
}