Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
// -*- Mode: C++ -*-
|
|
|
|
//
|
2019-01-07 13:54:47 +00:00
|
|
|
// Copyright (C) 2016-2019 Red Hat, Inc.
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
//
|
|
|
|
// 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__
|
|
|
|
|
2019-07-05 11:00:23 +00:00
|
|
|
#include "abg-cxx-compat.h"
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
#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;
|
2019-07-05 11:00:23 +00:00
|
|
|
using abg_compat::unordered_set;
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
|
|
|
|
/// 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();
|
|
|
|
|
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
|
|
|
public:
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
priv_sptr priv_;
|
|
|
|
|
|
|
|
suppression_base(const string& label);
|
|
|
|
|
|
|
|
suppression_base(const string& label,
|
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
|
|
|
const string& file_name_regex_str,
|
|
|
|
const string& file_name_not_regex_str);
|
|
|
|
|
|
|
|
bool
|
|
|
|
get_drops_artifact_from_ir() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
set_drops_artifact_from_ir(bool) const;
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
|
Make abi{pkg}diff filter out changes about private types
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>
2016-05-20 07:19:51 +00:00
|
|
|
bool
|
|
|
|
get_is_artificial() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
set_is_artificial(bool);
|
|
|
|
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
// Forbid this;
|
|
|
|
type_suppression();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
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
|
|
|
priv_sptr priv_;
|
|
|
|
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
/// 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();
|
|
|
|
|
Make abi{pkg}diff filter out changes about private types
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>
2016-05-20 07:19:51 +00:00
|
|
|
const unordered_set<string>&
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
get_source_locations_to_keep() const;
|
|
|
|
|
Make abi{pkg}diff filter out changes about private types
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>
2016-05-20 07:19:51 +00:00
|
|
|
unordered_set<string>&
|
|
|
|
get_source_locations_to_keep();
|
|
|
|
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
void
|
Make abi{pkg}diff filter out changes about private types
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>
2016-05-20 07:19:51 +00:00
|
|
|
set_source_locations_to_keep(const unordered_set<string>&);
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
|
|
|
|
const string&
|
|
|
|
get_source_location_to_keep_regex_str() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
set_source_location_to_keep_regex_str(const string&);
|
|
|
|
|
Bug 24139 - Support suppressing some enumerator changes
This patch teaches the suppression specification subsystem how to
ignore changes of some enumerators in particular.
The patch adds a new property to the [suppress_type] section which is:
changed_enumerators = enumerator1, enumerator2, etc
This property is taken into accound iff the current suppress_type does
have the 'type_kind = enum' property.
Changes to enum types that match the new 'changed_enumerators'
property are suppressed.
* doc/manuals/libabigail-concepts.rst: Document the new
'changed_enumerators' property.
* include/abg-suppression.h
(type_suppression::{g, s}et_changed_enumerator_names): Declare two
new member functions.
* src/abg-suppression-priv.h
(type_suppression::priv::changed_enumerator_names_): Add a new
data member.
* src/abg-suppression.cc
(type_suppression::{g,s}et_changed_enumerator_names): Define two
new member functions.
(type_suppression::suppresses_diff): Support evaluating the new
'changed_enumerators = <vector of changed enumerators>'.
(read_type_suppression): Read the new list
property'changed_enumerators" and store it into the
type_suppression using the new
type_suppression::set_changed_enumerator_names ().
* tests/data/test-diff-suppr/libtest4{0,1}-enumerator-changes-v{0,1}.so:
Add new test inpujts.
* tests/data/test-diff-suppr/test4{0,1}-enumerator-changes-0.suppr:
Add a new suppr spec for this new test.
* tests/data/test-diff-suppr/test4{0,1}-enumerator-changes-report-0.txt:
The default report.
* tests/data/test-diff-suppr/test4{0,1}-enumerator-changes-v{0,1}.cc:
Add Source code of libtest4{0,1}-enumerator-changes-v{0,1}.so.
* tests/data/Makefile.am: Add the test files above to source
distribution.
* tests/test-diff-suppr.cc: Add the test input files above to the
harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2019-01-30 12:46:29 +00:00
|
|
|
const vector<string>&
|
|
|
|
get_changed_enumerator_names() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
set_changed_enumerator_names(const vector<string>&);
|
|
|
|
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
virtual bool
|
|
|
|
suppresses_diff(const diff* diff) const;
|
|
|
|
|
|
|
|
bool
|
|
|
|
suppresses_type(const type_base_sptr& type,
|
|
|
|
const diff_context_sptr& ctxt) const;
|
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
|
|
|
|
|
|
|
bool
|
|
|
|
suppresses_type(const type_base_sptr& type) const;
|
|
|
|
|
|
|
|
bool
|
|
|
|
suppresses_type(const type_base_sptr& type,
|
|
|
|
const scope_decl* type_scope) const;
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
}; // 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
|
|
|
|
{
|
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
|
|
|
struct priv;
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
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
|
|
|
priv_sptr priv_;
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
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,
|
2018-06-28 10:58:28 +00:00
|
|
|
/// The function was added to the second subject of the diff.
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
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)
|
|
|
|
};
|
|
|
|
|
2016-11-10 12:49:08 +00:00
|
|
|
function_suppression();
|
|
|
|
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
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&
|
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
|
|
|
get_name() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
set_name(const string&);
|
|
|
|
|
|
|
|
const string&
|
|
|
|
get_name_regex_str() const;
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
|
|
|
|
void
|
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
|
|
|
set_name_regex_str(const string&);
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
|
|
|
|
const string&
|
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
|
|
|
get_name_not_regex_str() const;
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
|
|
|
|
void
|
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
|
|
|
set_name_not_regex_str(const string&);
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
|
|
|
|
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:
|
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
|
|
|
struct priv;
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
|
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
|
|
|
public:
|
|
|
|
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
priv_sptr priv_;
|
|
|
|
|
Make abipkgdiff compare two kernel packages
This patch makes abipkgdiff compare two kernel packages. At the
moment the comparison is done by comparing each binary from the first
package to its counterpart in the second package. No optimization is
done do represent a vmlinux binary and its modules as one single
entity. So this is different from what kmidiff does.
* include/abg-suppression.h
(variable_suppression::variable_suppression): Add default arguments
to the parameters.
* include/abg-tools-utils.h (dir_exists, dir_is_empty)
(string_begins_with, get_rpm_name, get_rpm_arch, get_deb_name)
(file_is_kernel_package, file_is_kernel_debuginfo_package):
Declare new functions.
* src/abg-tools-utils.cc (dir_exists, dir_is_empty)
(string_begins_with, get_deb_name, get_rpm_name, get_rpm_arch)
(file_is_kernel_package, file_is_kernel_debuginfo_package): Define
new functions.
(gen_suppr_spec_from_kernel_abi_whitelist): The kernel ABI
whitelist is made of ELF symbols names that ought to match
functions *and* variables that have ELF symbols with those names.
So generate variable suppression specifications as well. Not just
function suppression specifications.
* tools/abipkgdiff.cc (options::{kabi_whitelist_package,
show_symbols_not_referenced_by_debug_info, kabi_whitelist_paths,
kabi_suppressions}): New data members.
(options::options): Adjust.
(package::KIND_KABI_WHITELISTS): New enumerator in the
package::kind enum.
(package::kabi_whitelist_package_): New data member.
(package::{base_name, kabi_whitelist_package, }): New member
functions.
(display_usage): Add a help string to the new
--linux-kernel-abi-whitelist and --no-unreferenced-symbols
options.
(parse_command_line): Parse the new --no-unreferenced-symbols,
--linux-kernel-abi-whitelist and --lkaw-pkg options.
(maybe_check_suppression_files): Check the presence of kabi
whitelist files.
(set_diff_context_from_opts): Consider (not) showing symbols not
referenced by debug info.
(compare): If we are looking at linux kernel packages, take the
kernel abi whitelist into account, apply the suppressions
resulting from the kabi whitelists to the ELF read context.
(maybe_collect_kabi_whitelists)
(get_kabi_whitelists_from_arch_under_dir)
(maybe_handle_kabi_whitelist_pkg, maybe_collect_kabi_whitelists)
(get_interesting_files_under_dir): Define new functions.
(maybe_update_vector_of_package_content): Take a new
file_name_to_look_for parameter.
(create_maps_of_package_content)
(extract_package_and_map_its_content): Consider the case of the
package being a linux kernel package.
(main): Take the potential --lkaw-pkg into account.
* doc/manuals/abipkgdiff.rst: Add documentation for options
--linux-kernel-abi-whitelist, --lkaw-pkg and
--no-unreferenced-symbols.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-04-03 18:10:06 +00:00
|
|
|
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 = "");
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
|
|
|
|
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&);
|
|
|
|
|
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
|
|
|
const string&
|
|
|
|
get_name_not_regex_str() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
set_name_not_regex_str(const string&);
|
|
|
|
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
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
|
2018-06-28 10:58:28 +00:00
|
|
|
suppresses_variable(const var_decl* var,
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
change_kind k,
|
|
|
|
const diff_context_sptr cxt) const;
|
|
|
|
|
|
|
|
bool
|
2018-06-28 10:58:28 +00:00
|
|
|
suppresses_variable(const var_decl_sptr var,
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
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);
|
|
|
|
|
Implement a [suppress_file] suppression directive
abidiff, abipkgdiff and abicompat now recognize a [suppress_file]
directive in suppression specifications. That directive instructs the
tool to avoid loading some binaries altogether.
This is the first directive that won't act on the result of the
comparison of two binaries. It actually acts earlier and prevents the
tool from loading some binaries altogether.
The directive looks like:
[suppress_file]
# Don't load any library named lib_private*.so
file_name_regexp = lib_private.*\\.so
This prevents the tool from loading (and thus comparing) any library
which name matches the pattern "lib_private*.so".
[suppress_file]
# Only load libraries name lib_public*.so
file_name_not_regexp = lib_public.*\\.so
This instructs the tool to only load (and compare) files which name
match the pattern "lib_public*.so".
* doc/manuals/libabigail-concepts.rst: Document the new
'suppress_file' directive.
* include/abg-suppression.h (file_suppression): Define new class.
(file_suppression_sptr): Define new typedef.
(is_file_suppression, file_is_suppressed): Declare new functions.
* src/abg-suppression.cc ():
(read_file_suppression, is_file_suppression, file_is_suppressed):
Define new functions.
(file_suppression::{file_suppression, suppresses_file,
~file_suppression}): Define new member functions.
* tools/abidiff.cc (main): If a suppression specification
suppresses one of the input files, then do not perform the
comparison.
* tools/abipkgdiff.cc (compare): If a suppression specification
suppresses a file that is to be compared, then do not perform the
comparison.
* tools/abicompat.cc (create_diff_context): New static function.
(perform_compat_check_in_normal_mode)
(perform_compat_check_in_weak_mode): Adjust to take a context in
parameter. Do not create a diff context here anymore, do not load
suppression files here either.
(main): Use the new create_diff_context to create a diff context
and initialize it, including loading suppression specifications.
If any suppression specification suppresses a file to load, then
do not load perform any compatibility checking. Adjust
invocations of perform_compat_check_in_weak_mode and
perform_compat_check_in_normal_mode to pass the diff context.
* tests/data/test-diff-suppr/test0-type-suppr-3.suppr: New test
input.
* tests/data/test-diff-suppr/test0-type-suppr-4.suppr: Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-5.suppr: Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-report-5.txt:
Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-6.suppr: Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-report-6.txt:
Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-report-7.txt:
Likewise.
* tests/test-diff-suppr.cc (in_out_specs): Use the new test
inputs.
* tests/data/test-abicompat/test0-fn-changed-1.suppr: New test
input.
* tests/data/test-abicompat/test0-fn-changed-report-3.txt:
Likewise.
* tests/test-abicompat.cc (in_out_specs):: Use the new test
inputs.
* tests/data/Makefile.am: Add the new test material to source
distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 17:51:08 +00:00
|
|
|
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);
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
|
PR23641 - Type definition DIE matched by a supprspec but not its decl
Suppose we have two versions of a library which are almost identical.
Suppose the difference between the two binaries is a slight difference of
ordering in how the linker put together what the DWARF describes.
Then, while processing the debug info of the first library, libabigail
first comes across the forward declaration of a type T. Suppose that
declaration is not matched by any private type suppression
specification. Libabigail is going to keep the declaration of T and
build an internal representation (IR) for it. It's also going to
build an IR for types and decls using T like "T*" or "T* var".
Now suppose that while processing the debug info of the second
library, libabigail first comes across the *definition* of T --
because in this second library, that definition comes first. Suppose
that the definition is matched by a private type suppression
specification, unlike the declaration in the first library. In this
case, T is going to be dropped, and no IR is going to be built for it.
If other types or decl like 'T*' or 'T *var" refer to this
*definition* of T, they will be dropped too.
We'll end up with those two libraries that are identical (modulo the
order in which libabigail sees type declarations and their
definitions) and are considered different when a suppression
specification makes us drop T: the second library appears to
libabigail as if T was removed from it.
This is the problem addressed by this patch.
When the definition of a type T is suppressed because it's considered
private then we look if there was a forward declaration for it
elsewhere, that is not matched by the private type suppression
specification. If we encountered such a type declaration then it
means that declaration is in effect an "opaque" version of T. So
rather than just dropping T altogether, we keep (and build an IR) for
its opaque version only. And we drop the definition of T.
This seems to fix the issue.
I can't seem to reproduce the slight re-ordering of DIEs descriptions that
uncover the issue so I'll rely on integration tests to catch future
regressions on this issue, rather than on unit tests. Sigh.
* include/abg-tools-utils.h (PRIVATE_TYPES_SUPPR_SPEC_NAME):
Remove this extern constant definition.
* src/abg-dwarf-reader.cc (type_is_suppressed): Add an overload
that takes an additional type_is_private output parameter.
(get_opaque_version_of_type): New static function.
(build_ir_node_from_die): For class types, get the opaque version
for suppressed private types rather than dropping them altogether.
* src/abg-reader.cc (type_is_suppressed): Adjust.
* src/abg-suppression-priv.h (type_is_suppressed): Add an overload
that takes a type_is_private output parameter.
* include/abg-suppression.h (get_private_types_suppr_spec_label)
(is_private_type_suppr_spec): Declare new functions.
* src/abg-suppression.cc
(get_private_types_suppr_spec_label, is_private_type_suppr_spec):
Define new functions.
(suppression_matches_type_name_or_location): Use the new
get_private_types_suppr_spec_label rather than a global extern
variable.
* src/abg-tools-utils.cc (handle_fts_entry): Adjust to use the new
get_private_types_suppr_spec_label.
(gen_suppr_spec_from_headers): Handle the case or an empty headers
root dir.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-09-21 12:33:19 +00:00
|
|
|
const char*
|
|
|
|
get_private_types_suppr_spec_label();
|
|
|
|
|
|
|
|
bool
|
Fix propagation of private type suppression category
This is a partial fix of PR23700.
Conceptually, there are two kinds of type suppression specifications:
1/ a generic user-provided suppression specification that is meant to
suppress changes on types specified by the user
2/ a private type suppression specification that is automatically
generated from the path to public header files provided by the user.
Technically, one difference between 1 and 2 lays in the way we
propagate categories of changes matched by those suppression
specifications.
If a class type change of category SUPPRESSED_CATEGORY is referenced
in a typedef change, then the typedef change is also considered to be
of category SUPPRESSED_CATEGORY. In other words, the
SUPPRESSED_CATEGORY category is propagated to the typedef change.
That means that if a change to a class type is suppressed, a (changed)
typedef to that class is considered to be suppressed too.
But then that is not true if the class type was changed because it's
private. In that, a typedef to that class can be *public*, because
the said typedef is defined in a public header. In that case the
typedef change should *NOT* be considered suppressed just because the
class type change was suppressed.
The problem we have here is that we don't make any difference between
1/ and 2/. So we need to introduce different propagation rules for 1/
and 2/.
So this patch introduces a new PRIVATE_TYPE_CATEGORY category for
types suppression specification that are automatically generated for
private types. That new category has its own propagation rule which
is basically "no propagation"; every type must be matched by the
private type suppression specification to be considered as private.
* include/abg-comp-filter.h (has_harmful_name_change): Declare new
function overloads.
* include/abg-comparison.h (PRIVATE_TYPE_CATEGORY): New enumerator
for diff_category;
(EVERYTHING_CATEGORY): Adjust this enumerator in diff_category;
(is_suppressed): Take an output parameter to say if the
suppression is a private type suppression.
* include/abg-suppression.h (is_private_type_suppr_spec): Take a
const reference parameter and add an overload for a shared
pointer.
* src/abg-comp-filter.cc (has_harmful_name_change): Define new
function.
* src/abg-comparison-priv.h (diff::priv::is_filtered_out): Diffs
of category PRIVATE_TYPE_CATEGORY are also considered filtered
out.
* src/abg-comparison.cc (diff::is_filtered_out): Adjust to account
for canonical diffs of category PRIVATE_TYPE_CATEGORY.
(diff::is_suppressed): Add an overload that takes a
is_private_type output parameter. Re-write the old overload in
terms of the new one.
(operator<<(ostream& o, diff_category c)): Handle
PRIVATE_TYPE_CATEGORY.
(category_propagation_visitor::visit_end): Do not propagate
PRIVATE_TYPE_CATEGORY here. Do not propagate
HARMLESS_DECL_NAME_CHANGE_CATEGORY either, when the class does
have a harmful decl name change.
(suppression_categorization_visitor::visit_begin): Set the new
PRIVATE_TYPE_CATEGORY category but do not propagate it.
(suppression_categorization_visitor::visit_end): Add some
comments.
* src/abg-default-reporter.cc (default_reporter::report): Avoid
reporting typedef underlying types that are in the
PRIVATE_TYPE_CATEGORY category.
* src/abg-suppression.cc (type_suppression::suppresses_diff): Do
not peel typedefs if we are a private type suppression.
(is_private_type_suppr_spec): Take a const reference.
* tests/data/Makefile.am: Add the new test material below to
source distribution.
* tests/test-diff-suppr.cc: Use new test binary input.
* tests/data/test-diff-filter/test7-report.txt: Adjust.
* tests/data/test-diff-suppr/test39-opaque-type-report-0.txt: New
test reference output.
* tests/data/test-diff-suppr/test39-opaque-type-v{0,1}.c: Source
code of new test binary input.
* tests/data/test-diff-suppr/test39-opaque-type-v{0,1}.o: New test
binary input.
* tests/data/test-diff-suppr/test39-public-headers-dir/test39-header-v{0,1}.h:
Source code of new test binary input.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-10-01 14:14:50 +00:00
|
|
|
is_private_type_suppr_spec(const type_suppression&);
|
|
|
|
|
|
|
|
bool
|
|
|
|
is_private_type_suppr_spec(const suppression_sptr& s);
|
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine.
The code of both was in the abg-comparison.{cc,h} files.
For the sake of greater modularity, this patch separates the suppression
engine from the comparison engine. The suppression engine now lives
in include/abg-suppression.h and src/abg-suppression.cc. The patch
also updates logical consumers of the suppression engine to adapt them
to the change.
* include/Makefile.am: Add abg-suppression.h to source
distribution.
* include/abg-comparison.h: Remove abg-ini.h include directive.
(suppression_sptr, suppressions_type): Move these typedefs to
abg-fwd.h.
(class suppression_base, type_suppression)
(type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions to the new
abg-suppression.h.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function declarations to the new
abg-suppression.h.
(type_suppression, type_suppression_sptr, type_suppression_type)
(function_suppression, function_suppression_sptr)
(function_suppressions_type, variable_suppression)
(variable_suppression_sptr, variable_suppressions_type): Move
these forward declaration and typedefs to the new
abg-suppression.h.
(diff_context::suppressions): Adjust return type to
suppr::suppressions_type&.
(diff_context::add_suppression): Adjust parameter type to
suppr::suppressions_sptr.
(diff_context::add_suppressions): Adjust parameter type
suppr::suppressions_type&.
(is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff)
(is_pointer_diff, is_reference_diff, is_fn_parm_diff)
(is_base_diff, is_child_node_of_function_parm_diff)
(is_child_node_of_base_diff): Declare these new functions. They
were previously static, local to abg-comparison.cc only. Now they
need to be exported because they are used by the suppression
engine's code that now lives in its one files.
* include/abg-fwd.h (suppr::{suppression_base, suppression_sptr,
suppressions_type}): Forward declare these here.
* include/abg-suppression.h (class suppression_base)
(type_suppression, type_suppression::insertion_range)
(type_suppression::insertion_range::boundary)
(type_suppression::insertion_range::integer_boundary)
(type_suppression::insertion_range::fn_call_expr_boundary)
(function_suppression, function_suppression::parameter_spec)
(variable_suppression): Move these type definitions here, in the
namespace suppr.
(read_suppressions, is_type_suppression, is_integer_boundary)
(is_fn_call_expr_boundary, is_function_suppression)
(is_variable_suppression, operator&)
(operator|): Move these function decalration here, in the
namespace suppr.
(type_suppression_sptr, type_suppressions_type)
(function_suppression_sptr, function_suppressions_type)
(variable_suppression_sptr, variable_suppressions_type): Move
these typedefs here, in the namespace suppr.
* src/Makefile.am: add src/abg-suppression.cc to source
distribution.
* src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff)
(is_function_decl_diff, is_pointer_diff, is_reference_diff)
(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
Export these functions.
(*suppression*): Move all the suppression-related definitions to
the new abg-suppression.cc.
* src/abg-suppression.cc: New file. Contains all the *suppression*
definitions from src/abg-comparison.cc, that are put in the suppr
namespace.
* tools/abicompat.cc: Adjust.
* tools/abidiff.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-07 09:28:21 +00:00
|
|
|
} // end namespace suppr
|
|
|
|
|
|
|
|
} // end namespace abigail
|
|
|
|
|
|
|
|
#endif //__ABG_SUPPRESSION_H__
|