mirror of
git://sourceware.org/git/libabigail.git
synced 2025-03-07 15:17:39 +00:00
This is to address the following enhancement requests: #19588 - Add a --headers-dir1 and --headers-dir2 option to abidiff #19948 - Add --devel-pkg1 and --devel-pkg2 options to abipkgdiff When the user specifies where to find header files for two binaries (or packages) being compared, this patch generates a type suppression specification that filters out change reports about types that are defined in files that are not in the set of header files specified. The type suppression specification also suppresses change reports about changed/added/removed virtual member functions which enclosing class type matches the type suppression specification. There is a corner case that the patch handles too, and that is exhibited by the accompanying test case for abidiff. There can be a class defined by DWARF as having no source location and as being a pure declaration. This can be a class declaration that has inline virtual members only, and one or several non-defined virtual methods too. When that declaration is included in a source file, GCC generates debug info that describes that class as being a declaration-only class with no source declaration. This patch considers such a class as being non defined; you know, like a true opaque type. So it's considered being not defined in any public header file. Changes to this kind of class are thus filtered out. * include/abg-comp-filter.h: Update copyright year. * src/abg-comp-filter.cc (has_virtual_mem_fn_change): Make this static function become exported. (has_virtual_mem_fn_change): Declare new function. * include/abg-suppression.h (suppression_base::{get,set}_is_artificial): Declare new accessors. (type_suppression::get_source_locations_to_keep): Return an unordered set of strings, not a vector. Add a non-const overload. (type_suppression::set_source_locations_to_keep): Set an unordered set of strings, not a vector. * src/abg-suppression.cc (suppression_base::priv::is_artificial_): New data member. (suppression_base::priv::priv): Initialize the new data member. (suppression_base::{get,set}_is_artificial): Define new accessors. (type_suppression::priv::source_locations_to_keep_): Change the vector of strings representing source file names into unordered set of string. (type_suppression::get_source_locations_to_keep): Return an unordered set of strings, not a vector. Define a non-const overload. (type_suppression::set_source_locations_to_keep): Set an unordered set of strings, not a vector. (type_suppression::suppresses_diff): Make this suppress virtual member function diffs if the enclosing type of the changed virtual member is suppressed by the current type_suppression. (read_type_suppression): Adjust to use the fact that the source locations are not stored in an unordered set, not in a vector anymore. Otherwise, using a vector here make things too slow. (type_suppression::suppresses_type): Likewise. Also, If the type we are looking at has no location because it's a true opaque type and if the current suppression is an artificial suppression that is meant to suppress change reports about non-public types, then suppress the type. * include/abg-tools-utils.h (gen_suppr_spec_from_headers): Declare new public function. * src/abg-tools-utils.cc (PRIVATE_TYPES_SUPPR_SPEC_NAME): Define a new constant variable. (handle_fts_entry): Define new static function. (gen_suppr_spec_from_headers): Define new public function. * src/abg-comparison.cc (corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars): If a type suppression suppresses a given class C, make it change added/removed virtual functions whose enclosing type is C. * tools/abidiff.cc (options::{headers_dir1, headers_dir2}): New data members. (display_usage): Add help strings for --headers-dir1 and --headers-dir2. (parse_command_line): Parse the new --headers-dir1 and --headers-dir2 options. (set_diff_context_from_opts): Generate suppression specifications to filter out changes on private types, if --headers-dir1 or --headers-dir2 is given. * tools/abipkgdiff.cc (options::{devel_package1, devel_package2}): New data members. (typedef package_sptr): New typedef. (enum package::kind): New enum. (package::kind_): New data member. This replaces ... (package::is_debug_info_): ... this data member. (package::{devel_package_, private_types_suppressions_}): New data members. (package::package): Adjust. (package::get_kind): Define new member function. This replaces ... (package::is_debug_info): ... this member function overload. (package::set_kind): Define new member functin. It replaces ... (package::is_debug_info): ... this member function overload. (package::{devel_package, private_types_suppressions}): Define new accessors. (package::erase_extraction_directies): Erase the sub-directory where development packages are extracted to. (compare_args::private_types_suppr{1,2}): New data members. (compare_args::compare_args): Adjust. (display_usage): Add help strings for --devel-pkg1/--devel-pkg2. (compare): Make the overload that compares elf files take private types suppressions. Add the private types suppressions to the diff context. (pthread_routine_compare): Adjust the call to compare. (maybe_create_private_types_suppressions): Define new static function. (pthread_routine_extract_pkg_and_map_its_content): If a devel package was specified for the main package then extract it in parallel with the other package extraction. When the extraction is done, create private types suppressions by visiting the directories that contain the header files. (compare): In the overload that compares packages by scheduling comparison of individual elf files that are in the packages, pass in the private type suppressions too. (parse_command_line): Parse the new --devel-pkg{1,2} command line options. (main): Associate the devel package to the main package, if the --devel-pkg{1,2}. * doc/manuals/abidiff.rst: Add documentation about the new --headers-dir1 and --headers-dir2 options. * doc/manuals/abipkgdiff.rst: Likewise, add documentation about the new --devel-pkg1 and --devel-pkg2 libraries. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: New test reference output. * tests/data/test-diff-pkg/tbb-devel-4.1-9.20130314.fc22.x86_64.rpm: New test input package. * tests/data/test-diff-pkg/tbb-devel-4.3-3.20141204.fc23.x86_64.rpm: Likewise. * tests/test-diff-pkg.cc b/tests/test-diff-pkg.cc (InOutSpec::{first,second}_in_devel_package_path): New data members. (in_out_specs): Adjust. Also, add a new entry describing the new test inputs above. (test_task::perform): When the new test entry contains devel packages, pass them to abipkgdiff using the --devel1 and --devel2 options. * tests/data/test-diff-suppr/test30-include-dir-v0/test30-pub-lib-v0.h: A new test input source code. * tests/data/test-diff-suppr/test30-include-dir-v1/test30-pub-lib-v1.h: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v0.cc: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v0.h: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v1.cc: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v1.h: Likewise. * tests/data/test-diff-suppr/test30-pub-lib-v0.cc: Likewise. * tests/data/test-diff-suppr/test30-pub-lib-v0.so: Add new test binary input. * tests/data/test-diff-suppr/test30-pub-lib-v1.cc: Add new test input source code. * tests/data/test-diff-suppr/test30-pub-lib-v1.so: Add new test binary input. * tests/data/test-diff-suppr/test30-report-0.txt: Add new test reference output. * tests/data/test-diff-suppr/test30-report-1.txt: Add new test reference output. * tests/test-diff-suppr.cc (InOutSpec::headers_dir{1,2}): New data members. (InOutSpec::abidiff_options): Renamed the bidiff_options data member into this. (in_out_specs): Adjust. Also, added the new test input above to this. (main): Adjust to invoke abidiff with the new --hd1 and --hd2 options if the input specs for the tests has the new InOutSpec::headers_dir{1,2} data member set. Renamed bidiff into abidiff. * tests/data/Makefile.am: Add the new test inputs to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
787 lines
19 KiB
C++
787 lines
19 KiB
C++
// -*- Mode: C++ -*-
|
|
//
|
|
// Copyright (C) 2016 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
|
|
|
|
#ifndef __ABG_SUPPRESSION_H__
|
|
#define __ABG_SUPPRESSION_H__
|
|
|
|
#include <tr1/unordered_set>
|
|
#include "abg-ini.h"
|
|
#include "abg-comparison.h"
|
|
|
|
namespace abigail
|
|
{
|
|
|
|
/// @brief an engine to suppress the parts of the result of comparing
|
|
/// two sets of ABI artifacts.
|
|
///
|
|
/// The user specifies the kind of changes between ABI artefact she
|
|
/// wants to see suppressed. That suppression specification is done
|
|
/// in an INI format.
|
|
///
|
|
/// That INI file is parsed and represented internally using the types
|
|
/// that are defined in this namespace.
|
|
namespace suppr
|
|
{
|
|
|
|
using namespace abigail::comparison;
|
|
using std::tr1::unordered_set;
|
|
|
|
/// Base type of the suppression specifications types.
|
|
///
|
|
/// This abstracts a suppression specification. It's a way to specify
|
|
/// how to drop reports about a particular diff node on the floor, if
|
|
/// it matches the supppression specification.
|
|
class suppression_base
|
|
{
|
|
class priv;
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
// Forbid default constructor
|
|
suppression_base();
|
|
|
|
protected:
|
|
priv_sptr priv_;
|
|
|
|
public:
|
|
suppression_base(const string& label);
|
|
|
|
suppression_base(const string& label,
|
|
const string& file_name_regex_str,
|
|
const string& file_name_not_regex_str);
|
|
|
|
bool
|
|
get_is_artificial() const;
|
|
|
|
void
|
|
set_is_artificial(bool);
|
|
|
|
const string
|
|
get_label() const;
|
|
|
|
void
|
|
set_label(const string&);
|
|
|
|
void
|
|
set_file_name_regex_str(const string& regexp);
|
|
|
|
const string&
|
|
get_file_name_regex_str() const;
|
|
|
|
void
|
|
set_file_name_not_regex_str(const string& regexp);
|
|
|
|
const string&
|
|
get_file_name_not_regex_str() const;
|
|
|
|
void
|
|
set_soname_regex_str(const string& regexp);
|
|
|
|
const string&
|
|
get_soname_regex_str() const;
|
|
|
|
void
|
|
set_soname_not_regex_str(const string& regexp);
|
|
|
|
const string&
|
|
get_soname_not_regex_str() const;
|
|
|
|
bool names_of_binaries_match(const diff_context& context) const;
|
|
|
|
bool sonames_of_binaries_match(const diff_context& context) const;
|
|
|
|
virtual bool
|
|
suppresses_diff(const diff*) const = 0;
|
|
|
|
virtual ~suppression_base();
|
|
}; // end class suppression_base
|
|
|
|
void
|
|
read_suppressions(std::istream& input,
|
|
suppressions_type& suppressions);
|
|
|
|
void
|
|
read_suppressions(const string& file_path,
|
|
suppressions_type& suppressions);
|
|
|
|
class type_suppression;
|
|
|
|
/// Convenience typedef for a shared pointer to type_suppression.
|
|
typedef shared_ptr<type_suppression> type_suppression_sptr;
|
|
|
|
/// Convenience typedef for vector of @ref type_suppression_sptr.
|
|
typedef vector<type_suppression_sptr> type_suppressions_type;
|
|
|
|
/// Abstraction of a type suppression specification.
|
|
///
|
|
/// Specifies under which condition reports about a type diff node
|
|
/// should be dropped on the floor.
|
|
class type_suppression : public suppression_base
|
|
{
|
|
class priv;
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
priv_sptr priv_;
|
|
|
|
// Forbid this;
|
|
type_suppression();
|
|
|
|
public:
|
|
|
|
/// The kind of the type the current type suppression is supposed to
|
|
/// be about.
|
|
enum type_kind
|
|
{
|
|
UNKNOWN_TYPE_KIND,
|
|
CLASS_TYPE_KIND,
|
|
STRUCT_TYPE_KIND,
|
|
UNION_TYPE_KIND,
|
|
ENUM_TYPE_KIND,
|
|
ARRAY_TYPE_KIND,
|
|
TYPEDEF_TYPE_KIND,
|
|
BUILTIN_TYPE_KIND
|
|
}; // end enum type_kind
|
|
|
|
/// The different ways through which the type diff has been reached.
|
|
enum reach_kind
|
|
{
|
|
/// The type diff has been reached (from a function or variable
|
|
/// change) directly.
|
|
DIRECT_REACH_KIND = 0,
|
|
|
|
/// The type diff has been reached (from a function or variable
|
|
/// change) through a pointer.
|
|
POINTER_REACH_KIND,
|
|
|
|
/// The type diff has been reached (from a function or variable
|
|
/// change) through a reference; you know, like a c++ reference..
|
|
REFERENCE_REACH_KIND,
|
|
|
|
/// The type diff has been reached (from a function or variable
|
|
/// change) through either a reference or a pointer.
|
|
REFERENCE_OR_POINTER_REACH_KIND
|
|
}; // end enum reach_kind
|
|
|
|
class insertion_range;
|
|
/// A convenience typedef for a shared pointer to @ref
|
|
/// insertion_range.
|
|
typedef shared_ptr<insertion_range> insertion_range_sptr;
|
|
/// A convenience typedef for a vector of @ref insertion_range_sptr.
|
|
typedef vector<insertion_range_sptr> insertion_ranges;
|
|
|
|
type_suppression(const string& label,
|
|
const string& type_name_regexp,
|
|
const string& type_name);
|
|
|
|
virtual ~type_suppression();
|
|
|
|
void
|
|
set_type_name_regex_str(const string& name_regex_str);
|
|
|
|
const string&
|
|
get_type_name_regex_str() const;
|
|
|
|
void
|
|
set_type_name(const string& name);
|
|
|
|
const string&
|
|
get_type_name() const;
|
|
|
|
bool
|
|
get_consider_type_kind() const;
|
|
|
|
void
|
|
set_consider_type_kind(bool f);
|
|
|
|
void
|
|
set_type_kind(type_kind k);
|
|
|
|
type_kind
|
|
get_type_kind() const;
|
|
|
|
bool
|
|
get_consider_reach_kind() const;
|
|
|
|
void
|
|
set_consider_reach_kind(bool f);
|
|
|
|
reach_kind
|
|
get_reach_kind() const;
|
|
|
|
void
|
|
set_reach_kind(reach_kind k);
|
|
|
|
void
|
|
set_data_member_insertion_ranges(const insertion_ranges& r);
|
|
|
|
const insertion_ranges&
|
|
get_data_member_insertion_ranges() const;
|
|
|
|
insertion_ranges&
|
|
get_data_member_insertion_ranges();
|
|
|
|
const unordered_set<string>&
|
|
get_source_locations_to_keep() const;
|
|
|
|
unordered_set<string>&
|
|
get_source_locations_to_keep();
|
|
|
|
void
|
|
set_source_locations_to_keep(const unordered_set<string>&);
|
|
|
|
const string&
|
|
get_source_location_to_keep_regex_str() const;
|
|
|
|
void
|
|
set_source_location_to_keep_regex_str(const string&);
|
|
|
|
virtual bool
|
|
suppresses_diff(const diff* diff) const;
|
|
|
|
bool
|
|
suppresses_type(const type_base_sptr& type,
|
|
const diff_context_sptr& ctxt) const;
|
|
}; // end type_suppression
|
|
|
|
type_suppression_sptr
|
|
is_type_suppression(const suppression_sptr);
|
|
|
|
/// The abstraction of a range of offsets in which a member of a type
|
|
/// might get inserted.
|
|
class type_suppression::insertion_range
|
|
{
|
|
public:
|
|
|
|
class boundary;
|
|
class integer_boundary;
|
|
class fn_call_expr_boundary;
|
|
|
|
/// Convenience typedef for a shared_ptr to @ref boundary
|
|
typedef shared_ptr<boundary> boundary_sptr;
|
|
|
|
/// Convenience typedef for a shared_ptr to a @ref integer_boundary
|
|
typedef shared_ptr<integer_boundary> integer_boundary_sptr;
|
|
|
|
/// Convenience typedef for a shared_ptr to a @ref
|
|
/// fn_call_expr_boundary
|
|
typedef shared_ptr<fn_call_expr_boundary> fn_call_expr_boundary_sptr;
|
|
|
|
private:
|
|
struct priv;
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
priv_sptr priv_;
|
|
|
|
public:
|
|
insertion_range();
|
|
|
|
insertion_range(boundary_sptr begin, boundary_sptr end);
|
|
|
|
boundary_sptr
|
|
begin() const;
|
|
|
|
boundary_sptr
|
|
end() const;
|
|
|
|
static insertion_range::integer_boundary_sptr
|
|
create_integer_boundary(int value);
|
|
|
|
static insertion_range::fn_call_expr_boundary_sptr
|
|
create_fn_call_expr_boundary(ini::function_call_expr_sptr);
|
|
|
|
static insertion_range::fn_call_expr_boundary_sptr
|
|
create_fn_call_expr_boundary(const string&);
|
|
|
|
static bool
|
|
eval_boundary(boundary_sptr boundary,
|
|
class_decl_sptr context,
|
|
ssize_t& value);
|
|
}; // end class insertion_range
|
|
|
|
type_suppression::insertion_range::integer_boundary_sptr
|
|
is_integer_boundary(type_suppression::insertion_range::boundary_sptr);
|
|
|
|
type_suppression::insertion_range::fn_call_expr_boundary_sptr
|
|
is_fn_call_expr_boundary(type_suppression::insertion_range::boundary_sptr);
|
|
|
|
/// The abstraction of the boundary of an @ref insertion_range, in the
|
|
/// context of a @ref type_suppression
|
|
class type_suppression::insertion_range::boundary
|
|
{
|
|
struct priv;
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
priv_sptr priv_;
|
|
|
|
public:
|
|
boundary();
|
|
virtual ~boundary();
|
|
};// end class type_suppression::insertion_range::boundary
|
|
|
|
/// An @ref insertion_range boundary that is expressed as an integer
|
|
/// value. That integer value is usually a bit offset.
|
|
class type_suppression::insertion_range::integer_boundary
|
|
: public type_suppression::insertion_range::boundary
|
|
{
|
|
struct priv;
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
priv_sptr priv_;
|
|
|
|
integer_boundary();
|
|
|
|
public:
|
|
integer_boundary(int value);
|
|
int as_integer() const;
|
|
operator int() const;
|
|
~integer_boundary();
|
|
}; //end class type_suppression::insertion_range::integer_boundary
|
|
|
|
/// An @ref insertion_range boundary that is expressed as function
|
|
/// call expression. The (integer) value of that expression is
|
|
/// usually a bit offset.
|
|
class type_suppression::insertion_range::fn_call_expr_boundary
|
|
: public type_suppression::insertion_range::boundary
|
|
{
|
|
struct priv;
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
priv_sptr priv_;
|
|
|
|
fn_call_expr_boundary();
|
|
|
|
public:
|
|
fn_call_expr_boundary(ini::function_call_expr_sptr expr);
|
|
ini::function_call_expr_sptr as_function_call_expr() const;
|
|
operator ini::function_call_expr_sptr () const;
|
|
~fn_call_expr_boundary();
|
|
}; //end class type_suppression::insertion_range::fn_call_expr_boundary
|
|
|
|
class function_suppression;
|
|
|
|
/// Convenience typedef for a shared pointer to function_suppression.
|
|
typedef shared_ptr<function_suppression> function_suppression_sptr;
|
|
|
|
/// Convenience typedef for a vector of @ref function_suppression_sptr.
|
|
typedef vector<function_suppression_sptr> function_suppressions_type;
|
|
|
|
/// Abstraction of a function suppression specification.
|
|
///
|
|
/// Specifies under which condition reports about a @ref
|
|
/// function_decl_diff diff node should be dropped on the floor for
|
|
/// the purpose of reporting.
|
|
class function_suppression : public suppression_base
|
|
{
|
|
class priv;
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
priv_sptr priv_;
|
|
|
|
// Forbid this.
|
|
function_suppression();
|
|
|
|
public:
|
|
|
|
class parameter_spec;
|
|
|
|
/// Convenience typedef for shared_ptr of @ref parameter_spec.
|
|
typedef shared_ptr<parameter_spec> parameter_spec_sptr;
|
|
|
|
/// Convenience typedef for vector of @ref parameter_spec_sptr.
|
|
typedef vector<parameter_spec_sptr> parameter_specs_type;
|
|
|
|
/// The kind of change the current function suppression should apply
|
|
/// to.
|
|
enum change_kind
|
|
{
|
|
UNDEFINED_CHANGE_KIND,
|
|
/// A change in a sub-type of the function.
|
|
FUNCTION_SUBTYPE_CHANGE_KIND = 1,
|
|
/// The function was added to the second second subject of the
|
|
/// diff.
|
|
ADDED_FUNCTION_CHANGE_KIND = 1 << 1,
|
|
/// The function was deleted from the second subject of the diff.
|
|
DELETED_FUNCTION_CHANGE_KIND = 1 << 2,
|
|
/// This represents all the changes possibly described by this
|
|
/// enum. It's a logical 'OR' of all the change enumerators
|
|
/// above.
|
|
ALL_CHANGE_KIND = (FUNCTION_SUBTYPE_CHANGE_KIND
|
|
| ADDED_FUNCTION_CHANGE_KIND
|
|
| DELETED_FUNCTION_CHANGE_KIND)
|
|
};
|
|
|
|
function_suppression(const string& label,
|
|
const string& name,
|
|
const string& name_regex,
|
|
const string& return_type_name,
|
|
const string& return_type_regex,
|
|
parameter_specs_type& parm_specs,
|
|
const string& symbol_name,
|
|
const string& symbol_name_regex,
|
|
const string& symbol_version,
|
|
const string& symbol_version_regex_str);
|
|
|
|
virtual ~function_suppression();
|
|
|
|
static change_kind
|
|
parse_change_kind(const string&);
|
|
|
|
change_kind
|
|
get_change_kind() const;
|
|
|
|
void
|
|
set_change_kind(change_kind k);
|
|
|
|
const string&
|
|
get_function_name() const;
|
|
|
|
void
|
|
set_function_name(const string&);
|
|
|
|
const string&
|
|
get_function_name_regex_str() const;
|
|
|
|
void
|
|
set_function_name_regex_str(const string&);
|
|
|
|
const string&
|
|
get_return_type_name() const;
|
|
|
|
void
|
|
set_return_type_name(const string&);
|
|
|
|
const string&
|
|
get_return_type_regex_str() const;
|
|
|
|
void
|
|
set_return_type_regex_str(const string& r);
|
|
|
|
const parameter_specs_type&
|
|
get_parameter_specs() const;
|
|
|
|
void
|
|
set_parameter_specs(parameter_specs_type&);
|
|
|
|
void
|
|
append_parameter_specs(const parameter_spec_sptr);
|
|
|
|
const string&
|
|
get_symbol_name() const;
|
|
|
|
void
|
|
set_symbol_name(const string& n);
|
|
|
|
const string&
|
|
get_symbol_name_regex_str() const;
|
|
|
|
void
|
|
set_symbol_name_regex_str(const string&);
|
|
|
|
const string&
|
|
get_symbol_version() const;
|
|
|
|
void
|
|
set_symbol_version(const string&);
|
|
|
|
const string&
|
|
get_symbol_version_regex_str() const;
|
|
|
|
void
|
|
set_symbol_version_regex_str(const string&);
|
|
|
|
bool
|
|
get_allow_other_aliases() const;
|
|
|
|
void
|
|
set_allow_other_aliases(bool f);
|
|
|
|
virtual bool
|
|
suppresses_diff(const diff* diff) const;
|
|
|
|
bool
|
|
suppresses_function(const function_decl* fn,
|
|
change_kind k,
|
|
const diff_context_sptr ctxt) const;
|
|
|
|
bool
|
|
suppresses_function(const function_decl_sptr fn,
|
|
change_kind k,
|
|
const diff_context_sptr ctxt) const;
|
|
|
|
bool
|
|
suppresses_function_symbol(const elf_symbol* sym,
|
|
change_kind k,
|
|
const diff_context_sptr ctxt);
|
|
|
|
bool
|
|
suppresses_function_symbol(const elf_symbol_sptr sym,
|
|
change_kind k,
|
|
const diff_context_sptr ctxt);
|
|
}; // end class function_suppression.
|
|
|
|
function_suppression_sptr
|
|
is_function_suppression(const suppression_sptr);
|
|
|
|
function_suppression::change_kind
|
|
operator&(function_suppression::change_kind l,
|
|
function_suppression::change_kind r);
|
|
|
|
function_suppression::change_kind
|
|
operator|(function_suppression::change_kind l,
|
|
function_suppression::change_kind r);
|
|
|
|
/// Abstraction of the specification of a function parameter in a
|
|
/// function suppression specification.
|
|
class function_suppression::parameter_spec
|
|
{
|
|
class priv;
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
friend class function_suppression;
|
|
|
|
priv_sptr priv_;
|
|
|
|
// Forbid this.
|
|
parameter_spec();
|
|
|
|
public:
|
|
parameter_spec(size_t index,
|
|
const string& type_name,
|
|
const string& type_name_regex);
|
|
|
|
size_t
|
|
get_index() const;
|
|
|
|
void
|
|
set_index(size_t);
|
|
|
|
const string&
|
|
get_parameter_type_name() const;
|
|
|
|
void
|
|
set_parameter_type_name(const string&);
|
|
|
|
const string&
|
|
get_parameter_type_name_regex_str() const;
|
|
|
|
void
|
|
set_parameter_type_name_regex_str(const string&);
|
|
};// end class function_suppression::parameter_spec
|
|
|
|
class variable_suppression;
|
|
|
|
/// A convenience typedef for a shared pointer to @ref
|
|
/// variable_suppression.
|
|
typedef shared_ptr<variable_suppression> variable_suppression_sptr;
|
|
|
|
/// A convenience typedef for a vector of @ref
|
|
/// variable_suppression_sptr.
|
|
typedef vector<variable_suppression_sptr> variable_suppressions_type;
|
|
|
|
/// The abstraction of a variable suppression specification.
|
|
///
|
|
/// It specifies under which condition reports about a @ref var_diff
|
|
/// diff node should be dropped on the floor for the purpose of
|
|
/// reporting.
|
|
class variable_suppression : public suppression_base
|
|
{
|
|
public:
|
|
|
|
|
|
/// The kind of change the current variable suppression should apply
|
|
/// to.
|
|
enum change_kind
|
|
{
|
|
UNDEFINED_CHANGE_KIND,
|
|
/// A change in a sub-type of the variable.
|
|
VARIABLE_SUBTYPE_CHANGE_KIND = 1,
|
|
/// The variable was added to the second second subject of the
|
|
/// diff.
|
|
ADDED_VARIABLE_CHANGE_KIND = 1 << 1,
|
|
/// The variable was deleted from the second subject of the diff.
|
|
DELETED_VARIABLE_CHANGE_KIND = 1 << 2,
|
|
/// This represents all the changes possibly described by this
|
|
/// enum. It's a logical 'OR' of all the change enumerators
|
|
/// above.
|
|
ALL_CHANGE_KIND = (VARIABLE_SUBTYPE_CHANGE_KIND
|
|
| ADDED_VARIABLE_CHANGE_KIND
|
|
| DELETED_VARIABLE_CHANGE_KIND)
|
|
};
|
|
|
|
private:
|
|
class priv;
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
priv_sptr priv_;
|
|
|
|
public:
|
|
variable_suppression(const string& label,
|
|
const string& name,
|
|
const string& name_regex_str,
|
|
const string& symbol_name,
|
|
const string& symbol_name_regex_str,
|
|
const string& symbol_version,
|
|
const string& symbol_version_regex_str,
|
|
const string& type_name,
|
|
const string& type_name_regex_str);
|
|
|
|
virtual ~variable_suppression();
|
|
|
|
static change_kind
|
|
parse_change_kind(const string&);
|
|
|
|
change_kind
|
|
get_change_kind() const;
|
|
|
|
void
|
|
set_change_kind(change_kind k);
|
|
|
|
const string&
|
|
get_name() const;
|
|
|
|
void
|
|
set_name(const string&);
|
|
|
|
const string&
|
|
get_name_regex_str() const;
|
|
|
|
void
|
|
set_name_regex_str(const string&);
|
|
|
|
const string&
|
|
get_symbol_name() const;
|
|
|
|
void
|
|
set_symbol_name(const string&);
|
|
|
|
const string&
|
|
get_symbol_name_regex_str() const;
|
|
|
|
void
|
|
set_symbol_name_regex_str(const string&);
|
|
|
|
const string&
|
|
get_symbol_version() const;
|
|
|
|
void
|
|
set_symbol_version(const string&);
|
|
|
|
const string&
|
|
get_symbol_version_regex_str() const;
|
|
|
|
void
|
|
set_symbol_version_regex_str(const string&);
|
|
|
|
const string&
|
|
get_type_name() const;
|
|
|
|
void
|
|
set_type_name(const string&);
|
|
|
|
const string&
|
|
get_type_name_regex_str() const;
|
|
|
|
void
|
|
set_type_name_regex_str(const string&);
|
|
|
|
bool
|
|
suppresses_diff(const diff* d) const;
|
|
|
|
bool
|
|
suppresses_variable(const var_decl* fn,
|
|
change_kind k,
|
|
const diff_context_sptr cxt) const;
|
|
|
|
bool
|
|
suppresses_variable(const var_decl_sptr fn,
|
|
change_kind k,
|
|
const diff_context_sptr cxt) const;
|
|
|
|
bool
|
|
suppresses_variable_symbol(const elf_symbol* sym,
|
|
change_kind k,
|
|
const diff_context_sptr cxt) const;
|
|
|
|
bool
|
|
suppresses_variable_symbol(const elf_symbol_sptr fn,
|
|
change_kind k,
|
|
const diff_context_sptr cxt) const;
|
|
}; // end class variable_suppression
|
|
|
|
variable_suppression_sptr
|
|
is_variable_suppression(const suppression_sptr);
|
|
|
|
variable_suppression::change_kind
|
|
operator&(variable_suppression::change_kind l,
|
|
variable_suppression::change_kind r);
|
|
|
|
variable_suppression::change_kind
|
|
operator|(variable_suppression::change_kind l,
|
|
variable_suppression::change_kind r);
|
|
|
|
class file_suppression;
|
|
|
|
/// A convenience typedef for a shared_ptr to @ref file_suppression
|
|
typedef shared_ptr<file_suppression> file_suppression_sptr;
|
|
|
|
/// Abstraction of a suppression specification to avoid loading a
|
|
/// file.
|
|
///
|
|
/// This can be used by a tool that loads (binary) files, to know
|
|
/// which file it has to avoid loading.
|
|
class file_suppression: public suppression_base
|
|
{
|
|
class priv;
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
priv_sptr priv_;
|
|
|
|
// Forbid this
|
|
file_suppression();
|
|
|
|
public:
|
|
|
|
file_suppression(const string& label,
|
|
const string& file_name_regex,
|
|
const string& file_name_not_regex);
|
|
|
|
virtual bool
|
|
suppresses_diff(const diff* diff) const;
|
|
|
|
bool
|
|
suppresses_file(const string& file_path);
|
|
|
|
virtual ~file_suppression();
|
|
}; // end file_suppression
|
|
|
|
file_suppression_sptr
|
|
is_file_suppression(const suppression_sptr);
|
|
|
|
file_suppression_sptr
|
|
file_is_suppressed(const string& file_path,
|
|
const suppressions_type& suppressions);
|
|
|
|
} // end namespace suppr
|
|
|
|
} // end namespace abigail
|
|
|
|
#endif //__ABG_SUPPRESSION_H__
|