libabigail/include/abg-ini.h

505 lines
11 KiB
C
Raw Normal View History

// -*- Mode: C++ -*-
//
Update copyright for 2019 * include/abg-comp-filter.h: Update copyright for 2019 * include/abg-comparison.h: Update copyright for 2019 * include/abg-config.h: Update copyright for 2019 * include/abg-corpus.h: Update copyright for 2019 * include/abg-diff-utils.h: Update copyright for 2019 * include/abg-dwarf-reader.h: Update copyright for 2019 * include/abg-fwd.h: Update copyright for 2019 * include/abg-hash.h: Update copyright for 2019 * include/abg-ini.h: Update copyright for 2019 * include/abg-interned-str.h: Update copyright for 2019 * include/abg-ir.h: Update copyright for 2019 * include/abg-libxml-utils.h: Update copyright for 2019 * include/abg-libzip-utils.h: Update copyright for 2019 * include/abg-reader.h: Update copyright for 2019 * include/abg-reporter.h: Update copyright for 2019 * include/abg-sptr-utils.h: Update copyright for 2019 * include/abg-suppression.h: Update copyright for 2019 * include/abg-tools-utils.h: Update copyright for 2019 * include/abg-traverse.h: Update copyright for 2019 * include/abg-viz-common.h: Update copyright for 2019 * include/abg-viz-dot.h: Update copyright for 2019 * include/abg-viz-svg.h: Update copyright for 2019 * include/abg-workers.h: Update copyright for 2019 * include/abg-writer.h: Update copyright for 2019 * src/abg-comp-filter.cc: Update copyright for 2019 * src/abg-comparison-priv.h: Update copyright for 2019 * src/abg-comparison.cc: Update copyright for 2019 * src/abg-config.cc: Update copyright for 2019 * src/abg-corpus-priv.h: Update copyright for 2019 * src/abg-corpus.cc: Update copyright for 2019 * src/abg-default-reporter.cc: Update copyright for 2019 * src/abg-diff-utils.cc: Update copyright for 2019 * src/abg-dwarf-reader.cc: Update copyright for 2019 * src/abg-hash.cc: Update copyright for 2019 * src/abg-ini.cc: Update copyright for 2019 * src/abg-internal.h: Update copyright for 2019 * src/abg-ir-priv.h: Update copyright for 2019 * src/abg-ir.cc: Update copyright for 2019 * src/abg-leaf-reporter.cc: Update copyright for 2019 * src/abg-libxml-utils.cc: Update copyright for 2019 * src/abg-libzip-utils.cc: Update copyright for 2019 * src/abg-reader.cc: Update copyright for 2019 * src/abg-reporter-priv.cc: Update copyright for 2019 * src/abg-reporter-priv.h: Update copyright for 2019 * src/abg-sptr-utils.cc: Update copyright for 2019 * src/abg-suppression-priv.h: Update copyright for 2019 * src/abg-suppression.cc: Update copyright for 2019 * src/abg-tools-utils.cc: Update copyright for 2019 * src/abg-traverse.cc: Update copyright for 2019 * src/abg-viz-common.cc: Update copyright for 2019 * src/abg-viz-dot.cc: Update copyright for 2019 * src/abg-viz-svg.cc: Update copyright for 2019 * src/abg-workers.cc: Update copyright for 2019 * src/abg-writer.cc: Update copyright for 2019 * tests/print-diff-tree.cc: Update copyright for 2019 * tests/test-abicompat.cc: Update copyright for 2019 * tests/test-abidiff-exit.cc: Update copyright for 2019 * tests/test-abidiff.cc: Update copyright for 2019 * tests/test-alt-dwarf-file.cc: Update copyright for 2019 * tests/test-core-diff.cc: Update copyright for 2019 * tests/test-diff-dwarf-abixml.cc: Update copyright for 2019 * tests/test-diff-dwarf.cc: Update copyright for 2019 * tests/test-diff-filter.cc: Update copyright for 2019 * tests/test-diff-pkg.cc: Update copyright for 2019 * tests/test-diff-suppr.cc: Update copyright for 2019 * tests/test-diff2.cc: Update copyright for 2019 * tests/test-ini.cc: Update copyright for 2019 * tests/test-ir-walker.cc: Update copyright for 2019 * tests/test-lookup-syms.cc: Update copyright for 2019 * tests/test-read-dwarf.cc: Update copyright for 2019 * tests/test-read-write.cc: Update copyright for 2019 * tests/test-types-stability.cc: Update copyright for 2019 * tests/test-utils.cc: Update copyright for 2019 * tests/test-utils.h: Update copyright for 2019 * tests/test-write-read-archive.cc: Update copyright for 2019 * tools/abiar.cc: Update copyright for 2019 * tools/abicompat.cc: Update copyright for 2019 * tools/abidiff.cc: Update copyright for 2019 * tools/abidw.cc: Update copyright for 2019 * tools/abilint.cc: Update copyright for 2019 * tools/abipkgdiff.cc: Update copyright for 2019 * tools/abisym.cc: Update copyright for 2019 * tools/binilint.cc: Update copyright for 2019 * tools/kmidiff.cc: Update copyright for 2019 * update-copyright.sh: Update new year to 2019 Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2019-01-07 13:54:47 +00:00
// Copyright (C) 2013-2019 Red Hat, Inc.
//
// This file is part of the GNU Application Binary Interface Generic
// Analysis and Instrumentation Library (libabigail). This library is
// free software; you can redistribute it and/or modify it under the
// terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 3, or (at your option) any
// later version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this program; see the file COPYING-LGPLV3. If
// not, see <http://www.gnu.org/licenses/>.
//
// Author: Dodji Seketeli
/// @file
///
/// This file contains the declarations for the ini file reader used in
/// the libabigail library.
#ifndef __ABG_INI_H__
#define __ABG_INI_H__
#include <tr1/memory>
#include <string>
#include <vector>
#include <istream>
#include <ostream>
namespace abigail
{
/// Namespace for handling ini-style files
namespace ini
{
// Inject some standard types in this namespace.
using std::tr1::shared_ptr;
Support specifying data member insertion in suppressions This patch is for supporting this kind of things: [suppress_type] name = S has_data_member_inserted_between = {8, end} or: [suppress_type] name = S has_data_members_inserted_between = {{8, 31}, {64, end}} or: [suppress_type] name = S has_data_members_inserted_at = offset_after(member0) How cool is that, heh? Anyway, to do this, the patch adds support for tuple values (i.e, lists of values) in INI files. Then on top of that the patch adds support for the specific has_data_member_inserted_between, has_data_members_inserted_between and has_data_members_inserted_at properties. * include/abg-comparison.h (type_suppression::insertion_range): Declare new type. (type_suppression::insertion_ranges): Declare new typedef. (type_suppression::{s,g}et_data_member_insertion_ranges): Declare new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Declare new functions. (type_suppression::insertion_range::{boundary, integer_boundary, fn_call_expr_boundary}): Define new types. * src/abg-comparison.cc: (struct type_suppression::insertion_range::priv): New type. (type_suppression::insertion_range::{insertion_range, begin, end}): Define new member functions. (type_suppression::priv::insertion_ranges_): Add data member. (type_suppression::{s,g}et_data_member_insertion_ranges): Define new member functions. (type_suppression::insertion_range::boundary::priv): Define new type. (type_suppression::insertion_range::boundary::{boundary, ~boundary}): Define new member functions. (type_suppression::insertion_range::integer_boundary::priv): Define new type. (type_suppression::insertion_range::integer_boundary::{integer_boundary, as_integer, operator int, ~integer_boundary}): Define member functions. (type_suppression::insertion_range::fn_call_expr_boundary::priv): Define new type. (type_suppression::insertion_range::fn_call_expr_boundary::{fn_call_expr_boundary, as_function_call_expr, operator ini::function_call_expr_sptr}): Define new member functions. (type_suppression::insertion_range::{create_integer_boundary, type_suppression::insertion_range::create_fn_call_expr_boundary, type_suppression::insertion_range::eval_boundary}): Define new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Define new functions. (read_type_suppression, read_function_suppression) (read_variable_suppression): Support the new kinds of property-related types. Aslo, in read_type_suppression, support the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. (type_suppression::suppresses_diff): If we are looking at a type diff node that has inserted data members, evaluate the insertion ranges of the current type_suppression and see if they match the inserted data members. * include/abg-ini.h (property, simple_property, property_value) (string_property_value, tuple_property_value, function_call_expr): Declare new types. (property_sptr, property_value_sptr, string_property_value_sptr) (tuple_property_value_sptr): Declare new typedefs. (is_string_property_value, is_tuple_property_value) (is_simple_property, is_tuple_property, read_function_call_expr): Declare new functions. * src/abg-ini.cc (char_is_white_space, char_is_comment_start) (char_is_delimiter, char_is_property_value_char) (char_is_section_name_char, char_is_property_name_char) (char_is_comment_start, char_is_white_space) (remove_trailing_white_spaces, is_string_property_value) (is_tuple_property_value, is_simple_property, is_tuple_property) (write_property_value, char_is_function_name_char) (char_is_function_argument_char): Define new functions. (property::priv, tuple_property_value::priv) (simple_property::priv, tuple_property::priv): Define new types. (property::{property, get_name, set_name, ~property}): Define new member functions. (struct property_value::priv): Define new type. (property_value::{property_value, get_kind, operator const string&(), ~property_value}): Define new member functions. (struct string_property_value::priv): Define new type. (string_property_value::{string_property_value, set_content, as_string, operator string()}, ~string_property_value): Define new member functions. (tuple_property_value::{tuple_property_value, get_value_items, ~tuple_property_value, as_string}): Likewise. (simple_property::{simple_property, get_value, set_value, ~simple_property}): Likewise. (tuple_property::{tuple_property, set_value, get_value}): Likewise. (config::section::find_property): Adjust return type. (read_context::{char_is_delimiter, char_is_property_value_char, char_is_section_name_char, char_is_property_name_char, char_is_comment_start, char_is_white_space}): Remove these from here as they got moved them to be non-member functions above. (read_context::read_property_value): Return a property_value_sptr and do not take any parameter anymore. (read_context::{read_string_property_value, read_tuple_property_value, read_function_name, read_function_argument, read_function_call_expr}): Define new member functions. (read_context::read_property): Adjust return type. Also, change to read the different new kinds of properties values. (function_call_expr::priv): Define new type. (function_call_expr::{function_call_expr, get_name, get_arguments}): New member functions. (read_context::read_section): Adjust. (write_property, write_section): Adjust. * tests/data/test-diff-suppr/libtest{11,12}-add-data-member-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test{11,12}-add-data-member-{0,1}.suppr: New input suppression files. * tests/data/test-diff-suppr/test11-add-data-member-{2,3,4}.suppr: Add new test input files. * tests/data/test-diff-suppr/test{11,12}-add-data-member-report-{0,1}.txt: New reference output files. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test{11,12}-add-data-member-v{0,1}.cc: Source code for the new binaries above. * tests/test-diff-suppr.cc (in_out_specs): Add new test inputs. * tests/data/Makefile.am: Add the new test related files above to source distribution. * doc/manuals/libabigail-concepts.rst: Document the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-22 18:40:57 +00:00
using std::tr1::dynamic_pointer_cast;
using std::string;
using std::vector;
using std:: pair;
Support specifying data member insertion in suppressions This patch is for supporting this kind of things: [suppress_type] name = S has_data_member_inserted_between = {8, end} or: [suppress_type] name = S has_data_members_inserted_between = {{8, 31}, {64, end}} or: [suppress_type] name = S has_data_members_inserted_at = offset_after(member0) How cool is that, heh? Anyway, to do this, the patch adds support for tuple values (i.e, lists of values) in INI files. Then on top of that the patch adds support for the specific has_data_member_inserted_between, has_data_members_inserted_between and has_data_members_inserted_at properties. * include/abg-comparison.h (type_suppression::insertion_range): Declare new type. (type_suppression::insertion_ranges): Declare new typedef. (type_suppression::{s,g}et_data_member_insertion_ranges): Declare new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Declare new functions. (type_suppression::insertion_range::{boundary, integer_boundary, fn_call_expr_boundary}): Define new types. * src/abg-comparison.cc: (struct type_suppression::insertion_range::priv): New type. (type_suppression::insertion_range::{insertion_range, begin, end}): Define new member functions. (type_suppression::priv::insertion_ranges_): Add data member. (type_suppression::{s,g}et_data_member_insertion_ranges): Define new member functions. (type_suppression::insertion_range::boundary::priv): Define new type. (type_suppression::insertion_range::boundary::{boundary, ~boundary}): Define new member functions. (type_suppression::insertion_range::integer_boundary::priv): Define new type. (type_suppression::insertion_range::integer_boundary::{integer_boundary, as_integer, operator int, ~integer_boundary}): Define member functions. (type_suppression::insertion_range::fn_call_expr_boundary::priv): Define new type. (type_suppression::insertion_range::fn_call_expr_boundary::{fn_call_expr_boundary, as_function_call_expr, operator ini::function_call_expr_sptr}): Define new member functions. (type_suppression::insertion_range::{create_integer_boundary, type_suppression::insertion_range::create_fn_call_expr_boundary, type_suppression::insertion_range::eval_boundary}): Define new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Define new functions. (read_type_suppression, read_function_suppression) (read_variable_suppression): Support the new kinds of property-related types. Aslo, in read_type_suppression, support the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. (type_suppression::suppresses_diff): If we are looking at a type diff node that has inserted data members, evaluate the insertion ranges of the current type_suppression and see if they match the inserted data members. * include/abg-ini.h (property, simple_property, property_value) (string_property_value, tuple_property_value, function_call_expr): Declare new types. (property_sptr, property_value_sptr, string_property_value_sptr) (tuple_property_value_sptr): Declare new typedefs. (is_string_property_value, is_tuple_property_value) (is_simple_property, is_tuple_property, read_function_call_expr): Declare new functions. * src/abg-ini.cc (char_is_white_space, char_is_comment_start) (char_is_delimiter, char_is_property_value_char) (char_is_section_name_char, char_is_property_name_char) (char_is_comment_start, char_is_white_space) (remove_trailing_white_spaces, is_string_property_value) (is_tuple_property_value, is_simple_property, is_tuple_property) (write_property_value, char_is_function_name_char) (char_is_function_argument_char): Define new functions. (property::priv, tuple_property_value::priv) (simple_property::priv, tuple_property::priv): Define new types. (property::{property, get_name, set_name, ~property}): Define new member functions. (struct property_value::priv): Define new type. (property_value::{property_value, get_kind, operator const string&(), ~property_value}): Define new member functions. (struct string_property_value::priv): Define new type. (string_property_value::{string_property_value, set_content, as_string, operator string()}, ~string_property_value): Define new member functions. (tuple_property_value::{tuple_property_value, get_value_items, ~tuple_property_value, as_string}): Likewise. (simple_property::{simple_property, get_value, set_value, ~simple_property}): Likewise. (tuple_property::{tuple_property, set_value, get_value}): Likewise. (config::section::find_property): Adjust return type. (read_context::{char_is_delimiter, char_is_property_value_char, char_is_section_name_char, char_is_property_name_char, char_is_comment_start, char_is_white_space}): Remove these from here as they got moved them to be non-member functions above. (read_context::read_property_value): Return a property_value_sptr and do not take any parameter anymore. (read_context::{read_string_property_value, read_tuple_property_value, read_function_name, read_function_argument, read_function_call_expr}): Define new member functions. (read_context::read_property): Adjust return type. Also, change to read the different new kinds of properties values. (function_call_expr::priv): Define new type. (function_call_expr::{function_call_expr, get_name, get_arguments}): New member functions. (read_context::read_section): Adjust. (write_property, write_section): Adjust. * tests/data/test-diff-suppr/libtest{11,12}-add-data-member-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test{11,12}-add-data-member-{0,1}.suppr: New input suppression files. * tests/data/test-diff-suppr/test11-add-data-member-{2,3,4}.suppr: Add new test input files. * tests/data/test-diff-suppr/test{11,12}-add-data-member-report-{0,1}.txt: New reference output files. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test{11,12}-add-data-member-v{0,1}.cc: Source code for the new binaries above. * tests/test-diff-suppr.cc (in_out_specs): Add new test inputs. * tests/data/Makefile.am: Add the new test related files above to source distribution. * doc/manuals/libabigail-concepts.rst: Document the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-22 18:40:57 +00:00
class property;
/// Convenience typefef for shared_ptr to @ref property.
typedef shared_ptr<property> property_sptr;
/// The base class of the different kinds of properties of an INI
/// file.
class property
{
struct priv;
typedef shared_ptr<priv> priv_sptr;
priv_sptr priv_;
public:
property();
property(const string& name);
const string&
get_name() const;
void
set_name(const string& name);
virtual ~property();
}; // end class property
class property_value;
/// Convenience typedef for a shared_ptr to @ref property_value.
typedef shared_ptr<property_value> property_value_sptr;
/// Base class of propertie values.
class property_value
{
public:
enum value_kind
{
ABSTRACT_PROPERTY_VALUE = 0,
STRING_PROPERTY_VALUE = 1,
Support source_location_not_in and source_location_not_regexp suppressions This patch adds support for properties source_location_not_in and source_location_not_regexp in the [suppress_type] section of suppression specifications. So the suppression specification: [suppress_type] source_location_not_in = foo1.h, foo2.h bar1.h bar2.h suppresses ABI change reports about types that are *NOT* defined in files foo{1,2}.h and bar{1,2}.h. The intended use of this construct is to constrain abi change reports to types that are part of the API of a given shared library. The API of the library is supposed to be defined in foo.h and bar.h only. Similarly, the suppression specification: [suppress_type] source_location_not_regexp = (foo|bar){1,2}\\.h suppresses ABI change reports about types that are not defined in the same set of files foo1.h, foo2.h, bar1.h and bar2.h. * include/abg-ini.h (enum property_value::value_kind): Add a LIST_PROPERTY_VALUE kind. (class {list_property_value, list_property}): Declare new types. (is_list_property, is_list_property_value): Declare new functions. * src/abg-ini.cc (struct list_property_value::priv): Define new type. (list_property_value::{list_property_value, get_content, set_content, as_string}): Define new member functions. (is_list_property_value): Define new function. (struct list_property::priv): Define new type. (list_property::{list_property, get_value, set_value, handle_escape}): Define new member functions. (is_list_property): Define new function. (read_context::buf_): New data member. (read_context::{peek, get, put_back, good, eof, read_string, read_list_property_value}): New member functions. (read_context::read_next_char): Use the new read_context::{get, good, eof} member function, rather than using the input stream directly. (read_context::{skip_white_spaces, skip_comments, skip_white_spaces_or_comments, read_property_name, read_function_name, read_function_argument, read_function_call_expr, read_property_value, read_tuple_property_value, read_section_name, read_section}): Adjust to use the new member functions of read_context rather than using the input stream directly. (read_context::read_string_property_value): Likewise. Use the new read_context::read_string() method. (read_context::{read, write}_property): Support reading list_property. * include/abg-comparison.h (type_suppression::{get_source_locations_to_keep, set_source_locations_to_keep, set_source_location_to_keep_regex_str, get_source_location_to_keep_regex_str}): Add new member functions. * src/abg-comparison.cc (type_suppression::priv::{source_location_to_keep_, source_location_to_keep_regex_str_, source_location_to_keep_regex_}): Add new data members. (type_suppression::priv::{g,s}et_source_location_to_keep_regex): Define new member functions. (type_suppression::{g,s}et_source_locations_to_keep): Define new member functions. (type_suppression::{g,s}et_source_location_to_keep_regex_str): Likewise. (type_suppression::suppresses_type): Support "source_location_not_regexp" and "source_location_not_in" properties of suppression specifications. (read_type_suppression): Likewise. Also adjust to the fact that ta tuple property value that is a list of strings is not a list property value. * doc/manuals/libabigail-concepts.rst: Add documentation for source_location_not_in and source_location_not_regexp. * tests/data/test-diff-suppr/libtest26-loc-suppr-v{0,1}.so: New binary test inputs. * tests/data/test-diff-suppr/test26-loc-suppr-{0,1,2}.suppr: New suppression specification test inputs. * tests/data/test-diff-suppr/test26-loc-suppr-report-{0,1,2,3}.txt: New test reference reports. * tests/data/test-diff-suppr/test26-loc-suppr-v{0,1}.cc: Source code of the test binary input above. * tests/data/test-diff-suppr/test26-loc-suppr.h: Likewise. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new test inputs above. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-09-16 09:37:22 +00:00
LIST_PROPERTY_VALUE = 2,
TUPLE_PROPERTY_VALUE = 3,
Support specifying data member insertion in suppressions This patch is for supporting this kind of things: [suppress_type] name = S has_data_member_inserted_between = {8, end} or: [suppress_type] name = S has_data_members_inserted_between = {{8, 31}, {64, end}} or: [suppress_type] name = S has_data_members_inserted_at = offset_after(member0) How cool is that, heh? Anyway, to do this, the patch adds support for tuple values (i.e, lists of values) in INI files. Then on top of that the patch adds support for the specific has_data_member_inserted_between, has_data_members_inserted_between and has_data_members_inserted_at properties. * include/abg-comparison.h (type_suppression::insertion_range): Declare new type. (type_suppression::insertion_ranges): Declare new typedef. (type_suppression::{s,g}et_data_member_insertion_ranges): Declare new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Declare new functions. (type_suppression::insertion_range::{boundary, integer_boundary, fn_call_expr_boundary}): Define new types. * src/abg-comparison.cc: (struct type_suppression::insertion_range::priv): New type. (type_suppression::insertion_range::{insertion_range, begin, end}): Define new member functions. (type_suppression::priv::insertion_ranges_): Add data member. (type_suppression::{s,g}et_data_member_insertion_ranges): Define new member functions. (type_suppression::insertion_range::boundary::priv): Define new type. (type_suppression::insertion_range::boundary::{boundary, ~boundary}): Define new member functions. (type_suppression::insertion_range::integer_boundary::priv): Define new type. (type_suppression::insertion_range::integer_boundary::{integer_boundary, as_integer, operator int, ~integer_boundary}): Define member functions. (type_suppression::insertion_range::fn_call_expr_boundary::priv): Define new type. (type_suppression::insertion_range::fn_call_expr_boundary::{fn_call_expr_boundary, as_function_call_expr, operator ini::function_call_expr_sptr}): Define new member functions. (type_suppression::insertion_range::{create_integer_boundary, type_suppression::insertion_range::create_fn_call_expr_boundary, type_suppression::insertion_range::eval_boundary}): Define new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Define new functions. (read_type_suppression, read_function_suppression) (read_variable_suppression): Support the new kinds of property-related types. Aslo, in read_type_suppression, support the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. (type_suppression::suppresses_diff): If we are looking at a type diff node that has inserted data members, evaluate the insertion ranges of the current type_suppression and see if they match the inserted data members. * include/abg-ini.h (property, simple_property, property_value) (string_property_value, tuple_property_value, function_call_expr): Declare new types. (property_sptr, property_value_sptr, string_property_value_sptr) (tuple_property_value_sptr): Declare new typedefs. (is_string_property_value, is_tuple_property_value) (is_simple_property, is_tuple_property, read_function_call_expr): Declare new functions. * src/abg-ini.cc (char_is_white_space, char_is_comment_start) (char_is_delimiter, char_is_property_value_char) (char_is_section_name_char, char_is_property_name_char) (char_is_comment_start, char_is_white_space) (remove_trailing_white_spaces, is_string_property_value) (is_tuple_property_value, is_simple_property, is_tuple_property) (write_property_value, char_is_function_name_char) (char_is_function_argument_char): Define new functions. (property::priv, tuple_property_value::priv) (simple_property::priv, tuple_property::priv): Define new types. (property::{property, get_name, set_name, ~property}): Define new member functions. (struct property_value::priv): Define new type. (property_value::{property_value, get_kind, operator const string&(), ~property_value}): Define new member functions. (struct string_property_value::priv): Define new type. (string_property_value::{string_property_value, set_content, as_string, operator string()}, ~string_property_value): Define new member functions. (tuple_property_value::{tuple_property_value, get_value_items, ~tuple_property_value, as_string}): Likewise. (simple_property::{simple_property, get_value, set_value, ~simple_property}): Likewise. (tuple_property::{tuple_property, set_value, get_value}): Likewise. (config::section::find_property): Adjust return type. (read_context::{char_is_delimiter, char_is_property_value_char, char_is_section_name_char, char_is_property_name_char, char_is_comment_start, char_is_white_space}): Remove these from here as they got moved them to be non-member functions above. (read_context::read_property_value): Return a property_value_sptr and do not take any parameter anymore. (read_context::{read_string_property_value, read_tuple_property_value, read_function_name, read_function_argument, read_function_call_expr}): Define new member functions. (read_context::read_property): Adjust return type. Also, change to read the different new kinds of properties values. (function_call_expr::priv): Define new type. (function_call_expr::{function_call_expr, get_name, get_arguments}): New member functions. (read_context::read_section): Adjust. (write_property, write_section): Adjust. * tests/data/test-diff-suppr/libtest{11,12}-add-data-member-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test{11,12}-add-data-member-{0,1}.suppr: New input suppression files. * tests/data/test-diff-suppr/test11-add-data-member-{2,3,4}.suppr: Add new test input files. * tests/data/test-diff-suppr/test{11,12}-add-data-member-report-{0,1}.txt: New reference output files. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test{11,12}-add-data-member-v{0,1}.cc: Source code for the new binaries above. * tests/test-diff-suppr.cc (in_out_specs): Add new test inputs. * tests/data/Makefile.am: Add the new test related files above to source distribution. * doc/manuals/libabigail-concepts.rst: Document the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-22 18:40:57 +00:00
};
private:
struct priv;
typedef shared_ptr<priv> priv_sptr;
priv_sptr priv_;
public:
property_value();
property_value(value_kind);
value_kind
get_kind() const;
virtual const string&
as_string() const = 0;
operator const string& () const;
virtual ~property_value();
}; // end class property_value.
class string_property_value;
/// A convenience typedef for a shared_ptr to @ref string_property_value.
typedef shared_ptr<string_property_value> string_property_value_sptr;
/// A property value which is a string.
class string_property_value : public property_value
{
struct priv;
typedef shared_ptr<priv> priv_sptr;
priv_sptr priv_;
public:
string_property_value();
string_property_value(const string& value);
void
set_content(const string&);
virtual const string&
as_string() const;
operator string() const;
virtual ~string_property_value();
}; // end class string_property_value
string_property_value*
is_string_property_value(const property_value*);
string_property_value_sptr
is_string_property_value(const property_value_sptr);
Support source_location_not_in and source_location_not_regexp suppressions This patch adds support for properties source_location_not_in and source_location_not_regexp in the [suppress_type] section of suppression specifications. So the suppression specification: [suppress_type] source_location_not_in = foo1.h, foo2.h bar1.h bar2.h suppresses ABI change reports about types that are *NOT* defined in files foo{1,2}.h and bar{1,2}.h. The intended use of this construct is to constrain abi change reports to types that are part of the API of a given shared library. The API of the library is supposed to be defined in foo.h and bar.h only. Similarly, the suppression specification: [suppress_type] source_location_not_regexp = (foo|bar){1,2}\\.h suppresses ABI change reports about types that are not defined in the same set of files foo1.h, foo2.h, bar1.h and bar2.h. * include/abg-ini.h (enum property_value::value_kind): Add a LIST_PROPERTY_VALUE kind. (class {list_property_value, list_property}): Declare new types. (is_list_property, is_list_property_value): Declare new functions. * src/abg-ini.cc (struct list_property_value::priv): Define new type. (list_property_value::{list_property_value, get_content, set_content, as_string}): Define new member functions. (is_list_property_value): Define new function. (struct list_property::priv): Define new type. (list_property::{list_property, get_value, set_value, handle_escape}): Define new member functions. (is_list_property): Define new function. (read_context::buf_): New data member. (read_context::{peek, get, put_back, good, eof, read_string, read_list_property_value}): New member functions. (read_context::read_next_char): Use the new read_context::{get, good, eof} member function, rather than using the input stream directly. (read_context::{skip_white_spaces, skip_comments, skip_white_spaces_or_comments, read_property_name, read_function_name, read_function_argument, read_function_call_expr, read_property_value, read_tuple_property_value, read_section_name, read_section}): Adjust to use the new member functions of read_context rather than using the input stream directly. (read_context::read_string_property_value): Likewise. Use the new read_context::read_string() method. (read_context::{read, write}_property): Support reading list_property. * include/abg-comparison.h (type_suppression::{get_source_locations_to_keep, set_source_locations_to_keep, set_source_location_to_keep_regex_str, get_source_location_to_keep_regex_str}): Add new member functions. * src/abg-comparison.cc (type_suppression::priv::{source_location_to_keep_, source_location_to_keep_regex_str_, source_location_to_keep_regex_}): Add new data members. (type_suppression::priv::{g,s}et_source_location_to_keep_regex): Define new member functions. (type_suppression::{g,s}et_source_locations_to_keep): Define new member functions. (type_suppression::{g,s}et_source_location_to_keep_regex_str): Likewise. (type_suppression::suppresses_type): Support "source_location_not_regexp" and "source_location_not_in" properties of suppression specifications. (read_type_suppression): Likewise. Also adjust to the fact that ta tuple property value that is a list of strings is not a list property value. * doc/manuals/libabigail-concepts.rst: Add documentation for source_location_not_in and source_location_not_regexp. * tests/data/test-diff-suppr/libtest26-loc-suppr-v{0,1}.so: New binary test inputs. * tests/data/test-diff-suppr/test26-loc-suppr-{0,1,2}.suppr: New suppression specification test inputs. * tests/data/test-diff-suppr/test26-loc-suppr-report-{0,1,2,3}.txt: New test reference reports. * tests/data/test-diff-suppr/test26-loc-suppr-v{0,1}.cc: Source code of the test binary input above. * tests/data/test-diff-suppr/test26-loc-suppr.h: Likewise. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new test inputs above. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-09-16 09:37:22 +00:00
class list_property_value;
/// A convenience typedef for a shared_ptr to @ref
/// list_property_value.
typedef shared_ptr<list_property_value> list_property_value_sptr;
/// Abstracts the value of a property representing a list of strings.
///
/// It's the right hand side of the construct which syntax looks like:
///
/// name = val1, val2, val3
///
/// where val1, val2 and val3 are strings.
///
/// So this class abstracts the set [val1, val2, val3].
class list_property_value : public property_value
{
struct priv;
typedef shared_ptr<priv> priv_sptr;
priv_sptr priv_;
public:
list_property_value();
list_property_value(const vector<string>& values);
const vector<string>&
get_content() const;
void
set_content(const vector<string>&);
virtual const string&
as_string() const;
}; // end class list_property_value
list_property_value*
is_list_property_value(const property_value*);
list_property_value_sptr
is_list_property_value(const property_value_sptr&);
Support specifying data member insertion in suppressions This patch is for supporting this kind of things: [suppress_type] name = S has_data_member_inserted_between = {8, end} or: [suppress_type] name = S has_data_members_inserted_between = {{8, 31}, {64, end}} or: [suppress_type] name = S has_data_members_inserted_at = offset_after(member0) How cool is that, heh? Anyway, to do this, the patch adds support for tuple values (i.e, lists of values) in INI files. Then on top of that the patch adds support for the specific has_data_member_inserted_between, has_data_members_inserted_between and has_data_members_inserted_at properties. * include/abg-comparison.h (type_suppression::insertion_range): Declare new type. (type_suppression::insertion_ranges): Declare new typedef. (type_suppression::{s,g}et_data_member_insertion_ranges): Declare new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Declare new functions. (type_suppression::insertion_range::{boundary, integer_boundary, fn_call_expr_boundary}): Define new types. * src/abg-comparison.cc: (struct type_suppression::insertion_range::priv): New type. (type_suppression::insertion_range::{insertion_range, begin, end}): Define new member functions. (type_suppression::priv::insertion_ranges_): Add data member. (type_suppression::{s,g}et_data_member_insertion_ranges): Define new member functions. (type_suppression::insertion_range::boundary::priv): Define new type. (type_suppression::insertion_range::boundary::{boundary, ~boundary}): Define new member functions. (type_suppression::insertion_range::integer_boundary::priv): Define new type. (type_suppression::insertion_range::integer_boundary::{integer_boundary, as_integer, operator int, ~integer_boundary}): Define member functions. (type_suppression::insertion_range::fn_call_expr_boundary::priv): Define new type. (type_suppression::insertion_range::fn_call_expr_boundary::{fn_call_expr_boundary, as_function_call_expr, operator ini::function_call_expr_sptr}): Define new member functions. (type_suppression::insertion_range::{create_integer_boundary, type_suppression::insertion_range::create_fn_call_expr_boundary, type_suppression::insertion_range::eval_boundary}): Define new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Define new functions. (read_type_suppression, read_function_suppression) (read_variable_suppression): Support the new kinds of property-related types. Aslo, in read_type_suppression, support the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. (type_suppression::suppresses_diff): If we are looking at a type diff node that has inserted data members, evaluate the insertion ranges of the current type_suppression and see if they match the inserted data members. * include/abg-ini.h (property, simple_property, property_value) (string_property_value, tuple_property_value, function_call_expr): Declare new types. (property_sptr, property_value_sptr, string_property_value_sptr) (tuple_property_value_sptr): Declare new typedefs. (is_string_property_value, is_tuple_property_value) (is_simple_property, is_tuple_property, read_function_call_expr): Declare new functions. * src/abg-ini.cc (char_is_white_space, char_is_comment_start) (char_is_delimiter, char_is_property_value_char) (char_is_section_name_char, char_is_property_name_char) (char_is_comment_start, char_is_white_space) (remove_trailing_white_spaces, is_string_property_value) (is_tuple_property_value, is_simple_property, is_tuple_property) (write_property_value, char_is_function_name_char) (char_is_function_argument_char): Define new functions. (property::priv, tuple_property_value::priv) (simple_property::priv, tuple_property::priv): Define new types. (property::{property, get_name, set_name, ~property}): Define new member functions. (struct property_value::priv): Define new type. (property_value::{property_value, get_kind, operator const string&(), ~property_value}): Define new member functions. (struct string_property_value::priv): Define new type. (string_property_value::{string_property_value, set_content, as_string, operator string()}, ~string_property_value): Define new member functions. (tuple_property_value::{tuple_property_value, get_value_items, ~tuple_property_value, as_string}): Likewise. (simple_property::{simple_property, get_value, set_value, ~simple_property}): Likewise. (tuple_property::{tuple_property, set_value, get_value}): Likewise. (config::section::find_property): Adjust return type. (read_context::{char_is_delimiter, char_is_property_value_char, char_is_section_name_char, char_is_property_name_char, char_is_comment_start, char_is_white_space}): Remove these from here as they got moved them to be non-member functions above. (read_context::read_property_value): Return a property_value_sptr and do not take any parameter anymore. (read_context::{read_string_property_value, read_tuple_property_value, read_function_name, read_function_argument, read_function_call_expr}): Define new member functions. (read_context::read_property): Adjust return type. Also, change to read the different new kinds of properties values. (function_call_expr::priv): Define new type. (function_call_expr::{function_call_expr, get_name, get_arguments}): New member functions. (read_context::read_section): Adjust. (write_property, write_section): Adjust. * tests/data/test-diff-suppr/libtest{11,12}-add-data-member-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test{11,12}-add-data-member-{0,1}.suppr: New input suppression files. * tests/data/test-diff-suppr/test11-add-data-member-{2,3,4}.suppr: Add new test input files. * tests/data/test-diff-suppr/test{11,12}-add-data-member-report-{0,1}.txt: New reference output files. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test{11,12}-add-data-member-v{0,1}.cc: Source code for the new binaries above. * tests/test-diff-suppr.cc (in_out_specs): Add new test inputs. * tests/data/Makefile.am: Add the new test related files above to source distribution. * doc/manuals/libabigail-concepts.rst: Document the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-22 18:40:57 +00:00
class tuple_property_value;
/// Convenience typedef for a shared_ptr to a @ref
/// tuple_property_value.
typedef shared_ptr<tuple_property_value> tuple_property_value_sptr;
/// A property value that is a tuple.
///
/// Each element of the tuple is itself a property value that can
/// either be a string, or another tuple, for instance.
class tuple_property_value : public property_value
{
struct priv;
typedef shared_ptr<priv> priv_sptr;
priv_sptr priv_;
public:
tuple_property_value(const vector<property_value_sptr>&);
const vector<property_value_sptr>&
get_value_items() const;
vector<property_value_sptr>&
get_value_items();
virtual const string&
as_string() const;
operator string() const;
virtual ~tuple_property_value();
}; // end class tuple_property_value
tuple_property_value*
is_tuple_property_value(const property_value*);
tuple_property_value_sptr
is_tuple_property_value(const property_value_sptr);
class simple_property;
/// Convenience typedef for a shared_ptr to an @ref simple_property.
typedef shared_ptr<simple_property> simple_property_sptr;
/// A simple property. That is, one which value is a
/// @ref string_property_value.
class simple_property : public property
{
struct priv;
typedef shared_ptr<priv> priv_sptr;
priv_sptr priv_;
public:
simple_property();
simple_property(const string& name,
const string_property_value_sptr& value);
Support specifying data member insertion in suppressions This patch is for supporting this kind of things: [suppress_type] name = S has_data_member_inserted_between = {8, end} or: [suppress_type] name = S has_data_members_inserted_between = {{8, 31}, {64, end}} or: [suppress_type] name = S has_data_members_inserted_at = offset_after(member0) How cool is that, heh? Anyway, to do this, the patch adds support for tuple values (i.e, lists of values) in INI files. Then on top of that the patch adds support for the specific has_data_member_inserted_between, has_data_members_inserted_between and has_data_members_inserted_at properties. * include/abg-comparison.h (type_suppression::insertion_range): Declare new type. (type_suppression::insertion_ranges): Declare new typedef. (type_suppression::{s,g}et_data_member_insertion_ranges): Declare new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Declare new functions. (type_suppression::insertion_range::{boundary, integer_boundary, fn_call_expr_boundary}): Define new types. * src/abg-comparison.cc: (struct type_suppression::insertion_range::priv): New type. (type_suppression::insertion_range::{insertion_range, begin, end}): Define new member functions. (type_suppression::priv::insertion_ranges_): Add data member. (type_suppression::{s,g}et_data_member_insertion_ranges): Define new member functions. (type_suppression::insertion_range::boundary::priv): Define new type. (type_suppression::insertion_range::boundary::{boundary, ~boundary}): Define new member functions. (type_suppression::insertion_range::integer_boundary::priv): Define new type. (type_suppression::insertion_range::integer_boundary::{integer_boundary, as_integer, operator int, ~integer_boundary}): Define member functions. (type_suppression::insertion_range::fn_call_expr_boundary::priv): Define new type. (type_suppression::insertion_range::fn_call_expr_boundary::{fn_call_expr_boundary, as_function_call_expr, operator ini::function_call_expr_sptr}): Define new member functions. (type_suppression::insertion_range::{create_integer_boundary, type_suppression::insertion_range::create_fn_call_expr_boundary, type_suppression::insertion_range::eval_boundary}): Define new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Define new functions. (read_type_suppression, read_function_suppression) (read_variable_suppression): Support the new kinds of property-related types. Aslo, in read_type_suppression, support the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. (type_suppression::suppresses_diff): If we are looking at a type diff node that has inserted data members, evaluate the insertion ranges of the current type_suppression and see if they match the inserted data members. * include/abg-ini.h (property, simple_property, property_value) (string_property_value, tuple_property_value, function_call_expr): Declare new types. (property_sptr, property_value_sptr, string_property_value_sptr) (tuple_property_value_sptr): Declare new typedefs. (is_string_property_value, is_tuple_property_value) (is_simple_property, is_tuple_property, read_function_call_expr): Declare new functions. * src/abg-ini.cc (char_is_white_space, char_is_comment_start) (char_is_delimiter, char_is_property_value_char) (char_is_section_name_char, char_is_property_name_char) (char_is_comment_start, char_is_white_space) (remove_trailing_white_spaces, is_string_property_value) (is_tuple_property_value, is_simple_property, is_tuple_property) (write_property_value, char_is_function_name_char) (char_is_function_argument_char): Define new functions. (property::priv, tuple_property_value::priv) (simple_property::priv, tuple_property::priv): Define new types. (property::{property, get_name, set_name, ~property}): Define new member functions. (struct property_value::priv): Define new type. (property_value::{property_value, get_kind, operator const string&(), ~property_value}): Define new member functions. (struct string_property_value::priv): Define new type. (string_property_value::{string_property_value, set_content, as_string, operator string()}, ~string_property_value): Define new member functions. (tuple_property_value::{tuple_property_value, get_value_items, ~tuple_property_value, as_string}): Likewise. (simple_property::{simple_property, get_value, set_value, ~simple_property}): Likewise. (tuple_property::{tuple_property, set_value, get_value}): Likewise. (config::section::find_property): Adjust return type. (read_context::{char_is_delimiter, char_is_property_value_char, char_is_section_name_char, char_is_property_name_char, char_is_comment_start, char_is_white_space}): Remove these from here as they got moved them to be non-member functions above. (read_context::read_property_value): Return a property_value_sptr and do not take any parameter anymore. (read_context::{read_string_property_value, read_tuple_property_value, read_function_name, read_function_argument, read_function_call_expr}): Define new member functions. (read_context::read_property): Adjust return type. Also, change to read the different new kinds of properties values. (function_call_expr::priv): Define new type. (function_call_expr::{function_call_expr, get_name, get_arguments}): New member functions. (read_context::read_section): Adjust. (write_property, write_section): Adjust. * tests/data/test-diff-suppr/libtest{11,12}-add-data-member-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test{11,12}-add-data-member-{0,1}.suppr: New input suppression files. * tests/data/test-diff-suppr/test11-add-data-member-{2,3,4}.suppr: Add new test input files. * tests/data/test-diff-suppr/test{11,12}-add-data-member-report-{0,1}.txt: New reference output files. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test{11,12}-add-data-member-v{0,1}.cc: Source code for the new binaries above. * tests/test-diff-suppr.cc (in_out_specs): Add new test inputs. * tests/data/Makefile.am: Add the new test related files above to source distribution. * doc/manuals/libabigail-concepts.rst: Document the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-22 18:40:57 +00:00
simple_property(const string& name);
Support specifying data member insertion in suppressions This patch is for supporting this kind of things: [suppress_type] name = S has_data_member_inserted_between = {8, end} or: [suppress_type] name = S has_data_members_inserted_between = {{8, 31}, {64, end}} or: [suppress_type] name = S has_data_members_inserted_at = offset_after(member0) How cool is that, heh? Anyway, to do this, the patch adds support for tuple values (i.e, lists of values) in INI files. Then on top of that the patch adds support for the specific has_data_member_inserted_between, has_data_members_inserted_between and has_data_members_inserted_at properties. * include/abg-comparison.h (type_suppression::insertion_range): Declare new type. (type_suppression::insertion_ranges): Declare new typedef. (type_suppression::{s,g}et_data_member_insertion_ranges): Declare new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Declare new functions. (type_suppression::insertion_range::{boundary, integer_boundary, fn_call_expr_boundary}): Define new types. * src/abg-comparison.cc: (struct type_suppression::insertion_range::priv): New type. (type_suppression::insertion_range::{insertion_range, begin, end}): Define new member functions. (type_suppression::priv::insertion_ranges_): Add data member. (type_suppression::{s,g}et_data_member_insertion_ranges): Define new member functions. (type_suppression::insertion_range::boundary::priv): Define new type. (type_suppression::insertion_range::boundary::{boundary, ~boundary}): Define new member functions. (type_suppression::insertion_range::integer_boundary::priv): Define new type. (type_suppression::insertion_range::integer_boundary::{integer_boundary, as_integer, operator int, ~integer_boundary}): Define member functions. (type_suppression::insertion_range::fn_call_expr_boundary::priv): Define new type. (type_suppression::insertion_range::fn_call_expr_boundary::{fn_call_expr_boundary, as_function_call_expr, operator ini::function_call_expr_sptr}): Define new member functions. (type_suppression::insertion_range::{create_integer_boundary, type_suppression::insertion_range::create_fn_call_expr_boundary, type_suppression::insertion_range::eval_boundary}): Define new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Define new functions. (read_type_suppression, read_function_suppression) (read_variable_suppression): Support the new kinds of property-related types. Aslo, in read_type_suppression, support the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. (type_suppression::suppresses_diff): If we are looking at a type diff node that has inserted data members, evaluate the insertion ranges of the current type_suppression and see if they match the inserted data members. * include/abg-ini.h (property, simple_property, property_value) (string_property_value, tuple_property_value, function_call_expr): Declare new types. (property_sptr, property_value_sptr, string_property_value_sptr) (tuple_property_value_sptr): Declare new typedefs. (is_string_property_value, is_tuple_property_value) (is_simple_property, is_tuple_property, read_function_call_expr): Declare new functions. * src/abg-ini.cc (char_is_white_space, char_is_comment_start) (char_is_delimiter, char_is_property_value_char) (char_is_section_name_char, char_is_property_name_char) (char_is_comment_start, char_is_white_space) (remove_trailing_white_spaces, is_string_property_value) (is_tuple_property_value, is_simple_property, is_tuple_property) (write_property_value, char_is_function_name_char) (char_is_function_argument_char): Define new functions. (property::priv, tuple_property_value::priv) (simple_property::priv, tuple_property::priv): Define new types. (property::{property, get_name, set_name, ~property}): Define new member functions. (struct property_value::priv): Define new type. (property_value::{property_value, get_kind, operator const string&(), ~property_value}): Define new member functions. (struct string_property_value::priv): Define new type. (string_property_value::{string_property_value, set_content, as_string, operator string()}, ~string_property_value): Define new member functions. (tuple_property_value::{tuple_property_value, get_value_items, ~tuple_property_value, as_string}): Likewise. (simple_property::{simple_property, get_value, set_value, ~simple_property}): Likewise. (tuple_property::{tuple_property, set_value, get_value}): Likewise. (config::section::find_property): Adjust return type. (read_context::{char_is_delimiter, char_is_property_value_char, char_is_section_name_char, char_is_property_name_char, char_is_comment_start, char_is_white_space}): Remove these from here as they got moved them to be non-member functions above. (read_context::read_property_value): Return a property_value_sptr and do not take any parameter anymore. (read_context::{read_string_property_value, read_tuple_property_value, read_function_name, read_function_argument, read_function_call_expr}): Define new member functions. (read_context::read_property): Adjust return type. Also, change to read the different new kinds of properties values. (function_call_expr::priv): Define new type. (function_call_expr::{function_call_expr, get_name, get_arguments}): New member functions. (read_context::read_section): Adjust. (write_property, write_section): Adjust. * tests/data/test-diff-suppr/libtest{11,12}-add-data-member-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test{11,12}-add-data-member-{0,1}.suppr: New input suppression files. * tests/data/test-diff-suppr/test11-add-data-member-{2,3,4}.suppr: Add new test input files. * tests/data/test-diff-suppr/test{11,12}-add-data-member-report-{0,1}.txt: New reference output files. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test{11,12}-add-data-member-v{0,1}.cc: Source code for the new binaries above. * tests/test-diff-suppr.cc (in_out_specs): Add new test inputs. * tests/data/Makefile.am: Add the new test related files above to source distribution. * doc/manuals/libabigail-concepts.rst: Document the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-22 18:40:57 +00:00
const string_property_value_sptr&
get_value() const;
void
set_value(const string_property_value_sptr& value);
Support specifying data member insertion in suppressions This patch is for supporting this kind of things: [suppress_type] name = S has_data_member_inserted_between = {8, end} or: [suppress_type] name = S has_data_members_inserted_between = {{8, 31}, {64, end}} or: [suppress_type] name = S has_data_members_inserted_at = offset_after(member0) How cool is that, heh? Anyway, to do this, the patch adds support for tuple values (i.e, lists of values) in INI files. Then on top of that the patch adds support for the specific has_data_member_inserted_between, has_data_members_inserted_between and has_data_members_inserted_at properties. * include/abg-comparison.h (type_suppression::insertion_range): Declare new type. (type_suppression::insertion_ranges): Declare new typedef. (type_suppression::{s,g}et_data_member_insertion_ranges): Declare new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Declare new functions. (type_suppression::insertion_range::{boundary, integer_boundary, fn_call_expr_boundary}): Define new types. * src/abg-comparison.cc: (struct type_suppression::insertion_range::priv): New type. (type_suppression::insertion_range::{insertion_range, begin, end}): Define new member functions. (type_suppression::priv::insertion_ranges_): Add data member. (type_suppression::{s,g}et_data_member_insertion_ranges): Define new member functions. (type_suppression::insertion_range::boundary::priv): Define new type. (type_suppression::insertion_range::boundary::{boundary, ~boundary}): Define new member functions. (type_suppression::insertion_range::integer_boundary::priv): Define new type. (type_suppression::insertion_range::integer_boundary::{integer_boundary, as_integer, operator int, ~integer_boundary}): Define member functions. (type_suppression::insertion_range::fn_call_expr_boundary::priv): Define new type. (type_suppression::insertion_range::fn_call_expr_boundary::{fn_call_expr_boundary, as_function_call_expr, operator ini::function_call_expr_sptr}): Define new member functions. (type_suppression::insertion_range::{create_integer_boundary, type_suppression::insertion_range::create_fn_call_expr_boundary, type_suppression::insertion_range::eval_boundary}): Define new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Define new functions. (read_type_suppression, read_function_suppression) (read_variable_suppression): Support the new kinds of property-related types. Aslo, in read_type_suppression, support the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. (type_suppression::suppresses_diff): If we are looking at a type diff node that has inserted data members, evaluate the insertion ranges of the current type_suppression and see if they match the inserted data members. * include/abg-ini.h (property, simple_property, property_value) (string_property_value, tuple_property_value, function_call_expr): Declare new types. (property_sptr, property_value_sptr, string_property_value_sptr) (tuple_property_value_sptr): Declare new typedefs. (is_string_property_value, is_tuple_property_value) (is_simple_property, is_tuple_property, read_function_call_expr): Declare new functions. * src/abg-ini.cc (char_is_white_space, char_is_comment_start) (char_is_delimiter, char_is_property_value_char) (char_is_section_name_char, char_is_property_name_char) (char_is_comment_start, char_is_white_space) (remove_trailing_white_spaces, is_string_property_value) (is_tuple_property_value, is_simple_property, is_tuple_property) (write_property_value, char_is_function_name_char) (char_is_function_argument_char): Define new functions. (property::priv, tuple_property_value::priv) (simple_property::priv, tuple_property::priv): Define new types. (property::{property, get_name, set_name, ~property}): Define new member functions. (struct property_value::priv): Define new type. (property_value::{property_value, get_kind, operator const string&(), ~property_value}): Define new member functions. (struct string_property_value::priv): Define new type. (string_property_value::{string_property_value, set_content, as_string, operator string()}, ~string_property_value): Define new member functions. (tuple_property_value::{tuple_property_value, get_value_items, ~tuple_property_value, as_string}): Likewise. (simple_property::{simple_property, get_value, set_value, ~simple_property}): Likewise. (tuple_property::{tuple_property, set_value, get_value}): Likewise. (config::section::find_property): Adjust return type. (read_context::{char_is_delimiter, char_is_property_value_char, char_is_section_name_char, char_is_property_name_char, char_is_comment_start, char_is_white_space}): Remove these from here as they got moved them to be non-member functions above. (read_context::read_property_value): Return a property_value_sptr and do not take any parameter anymore. (read_context::{read_string_property_value, read_tuple_property_value, read_function_name, read_function_argument, read_function_call_expr}): Define new member functions. (read_context::read_property): Adjust return type. Also, change to read the different new kinds of properties values. (function_call_expr::priv): Define new type. (function_call_expr::{function_call_expr, get_name, get_arguments}): New member functions. (read_context::read_section): Adjust. (write_property, write_section): Adjust. * tests/data/test-diff-suppr/libtest{11,12}-add-data-member-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test{11,12}-add-data-member-{0,1}.suppr: New input suppression files. * tests/data/test-diff-suppr/test11-add-data-member-{2,3,4}.suppr: Add new test input files. * tests/data/test-diff-suppr/test{11,12}-add-data-member-report-{0,1}.txt: New reference output files. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test{11,12}-add-data-member-v{0,1}.cc: Source code for the new binaries above. * tests/test-diff-suppr.cc (in_out_specs): Add new test inputs. * tests/data/Makefile.am: Add the new test related files above to source distribution. * doc/manuals/libabigail-concepts.rst: Document the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-22 18:40:57 +00:00
bool
has_empty_value() const;
Support specifying data member insertion in suppressions This patch is for supporting this kind of things: [suppress_type] name = S has_data_member_inserted_between = {8, end} or: [suppress_type] name = S has_data_members_inserted_between = {{8, 31}, {64, end}} or: [suppress_type] name = S has_data_members_inserted_at = offset_after(member0) How cool is that, heh? Anyway, to do this, the patch adds support for tuple values (i.e, lists of values) in INI files. Then on top of that the patch adds support for the specific has_data_member_inserted_between, has_data_members_inserted_between and has_data_members_inserted_at properties. * include/abg-comparison.h (type_suppression::insertion_range): Declare new type. (type_suppression::insertion_ranges): Declare new typedef. (type_suppression::{s,g}et_data_member_insertion_ranges): Declare new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Declare new functions. (type_suppression::insertion_range::{boundary, integer_boundary, fn_call_expr_boundary}): Define new types. * src/abg-comparison.cc: (struct type_suppression::insertion_range::priv): New type. (type_suppression::insertion_range::{insertion_range, begin, end}): Define new member functions. (type_suppression::priv::insertion_ranges_): Add data member. (type_suppression::{s,g}et_data_member_insertion_ranges): Define new member functions. (type_suppression::insertion_range::boundary::priv): Define new type. (type_suppression::insertion_range::boundary::{boundary, ~boundary}): Define new member functions. (type_suppression::insertion_range::integer_boundary::priv): Define new type. (type_suppression::insertion_range::integer_boundary::{integer_boundary, as_integer, operator int, ~integer_boundary}): Define member functions. (type_suppression::insertion_range::fn_call_expr_boundary::priv): Define new type. (type_suppression::insertion_range::fn_call_expr_boundary::{fn_call_expr_boundary, as_function_call_expr, operator ini::function_call_expr_sptr}): Define new member functions. (type_suppression::insertion_range::{create_integer_boundary, type_suppression::insertion_range::create_fn_call_expr_boundary, type_suppression::insertion_range::eval_boundary}): Define new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Define new functions. (read_type_suppression, read_function_suppression) (read_variable_suppression): Support the new kinds of property-related types. Aslo, in read_type_suppression, support the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. (type_suppression::suppresses_diff): If we are looking at a type diff node that has inserted data members, evaluate the insertion ranges of the current type_suppression and see if they match the inserted data members. * include/abg-ini.h (property, simple_property, property_value) (string_property_value, tuple_property_value, function_call_expr): Declare new types. (property_sptr, property_value_sptr, string_property_value_sptr) (tuple_property_value_sptr): Declare new typedefs. (is_string_property_value, is_tuple_property_value) (is_simple_property, is_tuple_property, read_function_call_expr): Declare new functions. * src/abg-ini.cc (char_is_white_space, char_is_comment_start) (char_is_delimiter, char_is_property_value_char) (char_is_section_name_char, char_is_property_name_char) (char_is_comment_start, char_is_white_space) (remove_trailing_white_spaces, is_string_property_value) (is_tuple_property_value, is_simple_property, is_tuple_property) (write_property_value, char_is_function_name_char) (char_is_function_argument_char): Define new functions. (property::priv, tuple_property_value::priv) (simple_property::priv, tuple_property::priv): Define new types. (property::{property, get_name, set_name, ~property}): Define new member functions. (struct property_value::priv): Define new type. (property_value::{property_value, get_kind, operator const string&(), ~property_value}): Define new member functions. (struct string_property_value::priv): Define new type. (string_property_value::{string_property_value, set_content, as_string, operator string()}, ~string_property_value): Define new member functions. (tuple_property_value::{tuple_property_value, get_value_items, ~tuple_property_value, as_string}): Likewise. (simple_property::{simple_property, get_value, set_value, ~simple_property}): Likewise. (tuple_property::{tuple_property, set_value, get_value}): Likewise. (config::section::find_property): Adjust return type. (read_context::{char_is_delimiter, char_is_property_value_char, char_is_section_name_char, char_is_property_name_char, char_is_comment_start, char_is_white_space}): Remove these from here as they got moved them to be non-member functions above. (read_context::read_property_value): Return a property_value_sptr and do not take any parameter anymore. (read_context::{read_string_property_value, read_tuple_property_value, read_function_name, read_function_argument, read_function_call_expr}): Define new member functions. (read_context::read_property): Adjust return type. Also, change to read the different new kinds of properties values. (function_call_expr::priv): Define new type. (function_call_expr::{function_call_expr, get_name, get_arguments}): New member functions. (read_context::read_section): Adjust. (write_property, write_section): Adjust. * tests/data/test-diff-suppr/libtest{11,12}-add-data-member-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test{11,12}-add-data-member-{0,1}.suppr: New input suppression files. * tests/data/test-diff-suppr/test11-add-data-member-{2,3,4}.suppr: Add new test input files. * tests/data/test-diff-suppr/test{11,12}-add-data-member-report-{0,1}.txt: New reference output files. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test{11,12}-add-data-member-v{0,1}.cc: Source code for the new binaries above. * tests/test-diff-suppr.cc (in_out_specs): Add new test inputs. * tests/data/Makefile.am: Add the new test related files above to source distribution. * doc/manuals/libabigail-concepts.rst: Document the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-22 18:40:57 +00:00
virtual ~simple_property();
}; // end class simple_property
simple_property*
is_simple_property(const property* p);
simple_property_sptr
is_simple_property(const property_sptr p);
Support source_location_not_in and source_location_not_regexp suppressions This patch adds support for properties source_location_not_in and source_location_not_regexp in the [suppress_type] section of suppression specifications. So the suppression specification: [suppress_type] source_location_not_in = foo1.h, foo2.h bar1.h bar2.h suppresses ABI change reports about types that are *NOT* defined in files foo{1,2}.h and bar{1,2}.h. The intended use of this construct is to constrain abi change reports to types that are part of the API of a given shared library. The API of the library is supposed to be defined in foo.h and bar.h only. Similarly, the suppression specification: [suppress_type] source_location_not_regexp = (foo|bar){1,2}\\.h suppresses ABI change reports about types that are not defined in the same set of files foo1.h, foo2.h, bar1.h and bar2.h. * include/abg-ini.h (enum property_value::value_kind): Add a LIST_PROPERTY_VALUE kind. (class {list_property_value, list_property}): Declare new types. (is_list_property, is_list_property_value): Declare new functions. * src/abg-ini.cc (struct list_property_value::priv): Define new type. (list_property_value::{list_property_value, get_content, set_content, as_string}): Define new member functions. (is_list_property_value): Define new function. (struct list_property::priv): Define new type. (list_property::{list_property, get_value, set_value, handle_escape}): Define new member functions. (is_list_property): Define new function. (read_context::buf_): New data member. (read_context::{peek, get, put_back, good, eof, read_string, read_list_property_value}): New member functions. (read_context::read_next_char): Use the new read_context::{get, good, eof} member function, rather than using the input stream directly. (read_context::{skip_white_spaces, skip_comments, skip_white_spaces_or_comments, read_property_name, read_function_name, read_function_argument, read_function_call_expr, read_property_value, read_tuple_property_value, read_section_name, read_section}): Adjust to use the new member functions of read_context rather than using the input stream directly. (read_context::read_string_property_value): Likewise. Use the new read_context::read_string() method. (read_context::{read, write}_property): Support reading list_property. * include/abg-comparison.h (type_suppression::{get_source_locations_to_keep, set_source_locations_to_keep, set_source_location_to_keep_regex_str, get_source_location_to_keep_regex_str}): Add new member functions. * src/abg-comparison.cc (type_suppression::priv::{source_location_to_keep_, source_location_to_keep_regex_str_, source_location_to_keep_regex_}): Add new data members. (type_suppression::priv::{g,s}et_source_location_to_keep_regex): Define new member functions. (type_suppression::{g,s}et_source_locations_to_keep): Define new member functions. (type_suppression::{g,s}et_source_location_to_keep_regex_str): Likewise. (type_suppression::suppresses_type): Support "source_location_not_regexp" and "source_location_not_in" properties of suppression specifications. (read_type_suppression): Likewise. Also adjust to the fact that ta tuple property value that is a list of strings is not a list property value. * doc/manuals/libabigail-concepts.rst: Add documentation for source_location_not_in and source_location_not_regexp. * tests/data/test-diff-suppr/libtest26-loc-suppr-v{0,1}.so: New binary test inputs. * tests/data/test-diff-suppr/test26-loc-suppr-{0,1,2}.suppr: New suppression specification test inputs. * tests/data/test-diff-suppr/test26-loc-suppr-report-{0,1,2,3}.txt: New test reference reports. * tests/data/test-diff-suppr/test26-loc-suppr-v{0,1}.cc: Source code of the test binary input above. * tests/data/test-diff-suppr/test26-loc-suppr.h: Likewise. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new test inputs above. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-09-16 09:37:22 +00:00
class list_property;
/// A convenience typedef for a shared_ptr to a @ref list_property.
typedef shared_ptr<list_property> list_property_sptr;
/// A class representing a list property.
///
/// It abstracts a construct which syntax looks like:
///
/// name = val1, val2, val3
///
/// The value of a list property is a @ref list_property_value, i.e, a
/// list of strings.
class list_property : public property
{
struct priv;
typedef shared_ptr<priv> priv_sptr;
priv_sptr priv_;
public:
list_property();
list_property(const string& name,
const list_property_value_sptr& value);
const list_property_value_sptr&
get_value() const;
void
set_value(const list_property_value_sptr& value);
virtual ~list_property();
}; // end class list_property
list_property*
is_list_property(const property* p);
list_property_sptr
is_list_property(const property_sptr p);
Support specifying data member insertion in suppressions This patch is for supporting this kind of things: [suppress_type] name = S has_data_member_inserted_between = {8, end} or: [suppress_type] name = S has_data_members_inserted_between = {{8, 31}, {64, end}} or: [suppress_type] name = S has_data_members_inserted_at = offset_after(member0) How cool is that, heh? Anyway, to do this, the patch adds support for tuple values (i.e, lists of values) in INI files. Then on top of that the patch adds support for the specific has_data_member_inserted_between, has_data_members_inserted_between and has_data_members_inserted_at properties. * include/abg-comparison.h (type_suppression::insertion_range): Declare new type. (type_suppression::insertion_ranges): Declare new typedef. (type_suppression::{s,g}et_data_member_insertion_ranges): Declare new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Declare new functions. (type_suppression::insertion_range::{boundary, integer_boundary, fn_call_expr_boundary}): Define new types. * src/abg-comparison.cc: (struct type_suppression::insertion_range::priv): New type. (type_suppression::insertion_range::{insertion_range, begin, end}): Define new member functions. (type_suppression::priv::insertion_ranges_): Add data member. (type_suppression::{s,g}et_data_member_insertion_ranges): Define new member functions. (type_suppression::insertion_range::boundary::priv): Define new type. (type_suppression::insertion_range::boundary::{boundary, ~boundary}): Define new member functions. (type_suppression::insertion_range::integer_boundary::priv): Define new type. (type_suppression::insertion_range::integer_boundary::{integer_boundary, as_integer, operator int, ~integer_boundary}): Define member functions. (type_suppression::insertion_range::fn_call_expr_boundary::priv): Define new type. (type_suppression::insertion_range::fn_call_expr_boundary::{fn_call_expr_boundary, as_function_call_expr, operator ini::function_call_expr_sptr}): Define new member functions. (type_suppression::insertion_range::{create_integer_boundary, type_suppression::insertion_range::create_fn_call_expr_boundary, type_suppression::insertion_range::eval_boundary}): Define new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Define new functions. (read_type_suppression, read_function_suppression) (read_variable_suppression): Support the new kinds of property-related types. Aslo, in read_type_suppression, support the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. (type_suppression::suppresses_diff): If we are looking at a type diff node that has inserted data members, evaluate the insertion ranges of the current type_suppression and see if they match the inserted data members. * include/abg-ini.h (property, simple_property, property_value) (string_property_value, tuple_property_value, function_call_expr): Declare new types. (property_sptr, property_value_sptr, string_property_value_sptr) (tuple_property_value_sptr): Declare new typedefs. (is_string_property_value, is_tuple_property_value) (is_simple_property, is_tuple_property, read_function_call_expr): Declare new functions. * src/abg-ini.cc (char_is_white_space, char_is_comment_start) (char_is_delimiter, char_is_property_value_char) (char_is_section_name_char, char_is_property_name_char) (char_is_comment_start, char_is_white_space) (remove_trailing_white_spaces, is_string_property_value) (is_tuple_property_value, is_simple_property, is_tuple_property) (write_property_value, char_is_function_name_char) (char_is_function_argument_char): Define new functions. (property::priv, tuple_property_value::priv) (simple_property::priv, tuple_property::priv): Define new types. (property::{property, get_name, set_name, ~property}): Define new member functions. (struct property_value::priv): Define new type. (property_value::{property_value, get_kind, operator const string&(), ~property_value}): Define new member functions. (struct string_property_value::priv): Define new type. (string_property_value::{string_property_value, set_content, as_string, operator string()}, ~string_property_value): Define new member functions. (tuple_property_value::{tuple_property_value, get_value_items, ~tuple_property_value, as_string}): Likewise. (simple_property::{simple_property, get_value, set_value, ~simple_property}): Likewise. (tuple_property::{tuple_property, set_value, get_value}): Likewise. (config::section::find_property): Adjust return type. (read_context::{char_is_delimiter, char_is_property_value_char, char_is_section_name_char, char_is_property_name_char, char_is_comment_start, char_is_white_space}): Remove these from here as they got moved them to be non-member functions above. (read_context::read_property_value): Return a property_value_sptr and do not take any parameter anymore. (read_context::{read_string_property_value, read_tuple_property_value, read_function_name, read_function_argument, read_function_call_expr}): Define new member functions. (read_context::read_property): Adjust return type. Also, change to read the different new kinds of properties values. (function_call_expr::priv): Define new type. (function_call_expr::{function_call_expr, get_name, get_arguments}): New member functions. (read_context::read_section): Adjust. (write_property, write_section): Adjust. * tests/data/test-diff-suppr/libtest{11,12}-add-data-member-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test{11,12}-add-data-member-{0,1}.suppr: New input suppression files. * tests/data/test-diff-suppr/test11-add-data-member-{2,3,4}.suppr: Add new test input files. * tests/data/test-diff-suppr/test{11,12}-add-data-member-report-{0,1}.txt: New reference output files. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test{11,12}-add-data-member-v{0,1}.cc: Source code for the new binaries above. * tests/test-diff-suppr.cc (in_out_specs): Add new test inputs. * tests/data/Makefile.am: Add the new test related files above to source distribution. * doc/manuals/libabigail-concepts.rst: Document the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-22 18:40:57 +00:00
class tuple_property;
/// Convenience typedef for a shared_ptr of @ref tuple_property.
typedef shared_ptr<tuple_property> tuple_property_sptr;
/// Abstraction of a tuple property. A tuple property is a property
/// which value is a @ref tuple_property_value.
class tuple_property : public property
{
struct priv;
typedef shared_ptr<priv> priv_sptr;
priv_sptr priv_;
public:
tuple_property();
tuple_property(const string& name,
const tuple_property_value_sptr v);
void
set_value(const tuple_property_value_sptr value);
const tuple_property_value_sptr&
get_value() const;
virtual
~tuple_property();
}; // end class tuple_property
tuple_property*
is_tuple_property(const property* p);
tuple_property_sptr
is_tuple_property(const property_sptr p);
class config;
/// A convenience typedef for a shared pointer to @ref config
typedef shared_ptr<config> config_sptr;
/// The abstraction of the structured content of an .ini file. This
/// roughly follows what is explained at
/// http://en.wikipedia.org/wiki/INI_file.
class config
{
class priv;
typedef shared_ptr<priv> priv_sptr;
public:
class section;
/// A convenience typedef for a shared pointer to a config::section.
typedef shared_ptr<section> section_sptr;
/// A convenience typedef for a vector of config::section_sptr.
typedef vector<section_sptr> sections_type;
/// A convenience typedef for a vector of @ref property_sptr
typedef vector<property_sptr> properties_type;
private:
priv_sptr priv_;
public:
config();
config(const string& path,
sections_type& sections);
virtual ~config();
const string&
get_path() const;
void
set_path(const string& path);
const sections_type&
get_sections() const;
void
set_sections(const sections_type& sections);
}; // end class config
/// The abstraction of one section of the .ini config.
class config::section
{
class priv;
typedef shared_ptr<priv> priv_sptr;
priv_sptr priv_;
// Forbid this
section();
public:
section(const string& name);
section(const string& name, const properties_type& properties);
const string&
get_name() const;
const properties_type&
get_properties() const;
void
set_properties(const properties_type& properties);
void
add_property(const property_sptr prop);
Initial support for type suppressions * include/abg-comparison.h (diff_category::SUPPRESSED_CATEGORY): New enumerator. (diff_category::{SIZE_OR_OFFSET_CHANGE_CATEGORY, VIRTUAL_MEMBER_CHANGE_CATEGORY): Update the enumerator values for these. (diff::EVERYTHING_CATEGORY): Adjust. (suppression_base, type_suppression): Declare new types. (suppression_ptr, suppressions_type, type_suppression_sptr) (type_suppressions_type): New typedefs. (read_type_suppressions, read_suppressions): Declare new functions. (diff_context::{suppressions, add_suppression, add_suppressions}): Declare new methods. (diff::is_suppressed): Declare new member function. (apply_suppressions): Declare new function & overloads. * src/abg-comparison.cc (is_type_diff): Define new static function. ({suppression_base, type_suppression}::priv): Define new types. ({suppression_base, type_suppression}::*): Define the methods of the new suppression_base, type_suppressions types. (read_type_suppression, read_type_suppressions, read_suppressions) (read_type_suppressions): Define new static functions. (diff_context::priv::supprssions_): New data member. (diff_context::{suppressions, add_suppression, add_suppressions}): New methods. (diff::is_filtered_out): Consider that a diff node that is in the SUPPRESSED_CATEGORY is filtered out. (diff::is_suppressed): Define new member function. (operator<<(ostream& o, diff_category c)): Support the SUPPRESSED_CATEGORY category. (corpus_diff::report): Apply suppressions before reporting anything. (category_propagation_visitor::visit_end): Do not propagate SUPPRESSED_CATEGORY. This is just like what we do for REDUNDANT_CATEGORY. (struct suppression_categorization_visitor): New visitor. (apply_suppressions): Define function & overloads. * include/abg-ini.h (config::section::find_property): New method. (config::section): Fix end of class comment. * src/abg-ini.cc (config::section::find_property): Define new method. * tests/data/test-diff-suppr/test0-type-suppr-{0,1,2}.suppr: New test input files. * tests/data/test-diff-suppr/test0-type-suppr-report-{0,1,2,3}.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.o: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.o: New test input files. * tests/data/test-diff-suppr/test1-typedef-suppr.h: Source code for new test input files. * tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.c: Likewise * tests/data/test-diff-suppr/test1-typedef-suppr-{0,1}.suppr: New test input files. * tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise. * tests/test-diff-suppr.cc: New test harness to run type suppression tests using the input files above. * tests/data/test-diff-suppr/test3-struct-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test3-struct-suppr-1.suppr: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v0.cc: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v0.o: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v1.cc: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v1.o: Likewise. * tests/Makefile.am: Build the new runtestdiffsuppr test harness from the test-diff-filter.cc file. Add the new test files to the build system and source distribution. * tools/bidiff.cc (options::suppressions): New data member. (display_usage): Add a help string for the new --suppressions command line switch. (parse_command_line): Parse the --suppressions command line switch. (set_diff_context_from_opts): Read the suppressions provided by the --suppression command line switch and stuff them into the diff context.
2014-09-19 09:55:49 +00:00
property_sptr
find_property(const string& prop_name) const;
virtual ~section();
Initial support for type suppressions * include/abg-comparison.h (diff_category::SUPPRESSED_CATEGORY): New enumerator. (diff_category::{SIZE_OR_OFFSET_CHANGE_CATEGORY, VIRTUAL_MEMBER_CHANGE_CATEGORY): Update the enumerator values for these. (diff::EVERYTHING_CATEGORY): Adjust. (suppression_base, type_suppression): Declare new types. (suppression_ptr, suppressions_type, type_suppression_sptr) (type_suppressions_type): New typedefs. (read_type_suppressions, read_suppressions): Declare new functions. (diff_context::{suppressions, add_suppression, add_suppressions}): Declare new methods. (diff::is_suppressed): Declare new member function. (apply_suppressions): Declare new function & overloads. * src/abg-comparison.cc (is_type_diff): Define new static function. ({suppression_base, type_suppression}::priv): Define new types. ({suppression_base, type_suppression}::*): Define the methods of the new suppression_base, type_suppressions types. (read_type_suppression, read_type_suppressions, read_suppressions) (read_type_suppressions): Define new static functions. (diff_context::priv::supprssions_): New data member. (diff_context::{suppressions, add_suppression, add_suppressions}): New methods. (diff::is_filtered_out): Consider that a diff node that is in the SUPPRESSED_CATEGORY is filtered out. (diff::is_suppressed): Define new member function. (operator<<(ostream& o, diff_category c)): Support the SUPPRESSED_CATEGORY category. (corpus_diff::report): Apply suppressions before reporting anything. (category_propagation_visitor::visit_end): Do not propagate SUPPRESSED_CATEGORY. This is just like what we do for REDUNDANT_CATEGORY. (struct suppression_categorization_visitor): New visitor. (apply_suppressions): Define function & overloads. * include/abg-ini.h (config::section::find_property): New method. (config::section): Fix end of class comment. * src/abg-ini.cc (config::section::find_property): Define new method. * tests/data/test-diff-suppr/test0-type-suppr-{0,1,2}.suppr: New test input files. * tests/data/test-diff-suppr/test0-type-suppr-report-{0,1,2,3}.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.o: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.o: New test input files. * tests/data/test-diff-suppr/test1-typedef-suppr.h: Source code for new test input files. * tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.c: Likewise * tests/data/test-diff-suppr/test1-typedef-suppr-{0,1}.suppr: New test input files. * tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise. * tests/test-diff-suppr.cc: New test harness to run type suppression tests using the input files above. * tests/data/test-diff-suppr/test3-struct-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test3-struct-suppr-1.suppr: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v0.cc: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v0.o: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v1.cc: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v1.o: Likewise. * tests/Makefile.am: Build the new runtestdiffsuppr test harness from the test-diff-filter.cc file. Add the new test files to the build system and source distribution. * tools/bidiff.cc (options::suppressions): New data member. (display_usage): Add a help string for the new --suppressions command line switch. (parse_command_line): Parse the --suppressions command line switch. (set_diff_context_from_opts): Read the suppressions provided by the --suppression command line switch and stuff them into the diff context.
2014-09-19 09:55:49 +00:00
}; //end class config::section
bool
read_sections(std::istream& input,
config::sections_type& sections);
bool
read_sections(const string& path,
config::sections_type& sections);
bool
read_config(std::istream& input,
config& conf);
config_sptr
read_config(std::istream& input);
bool
read_config(const string& path,
config& conf);
config_sptr
read_config(const string& path);
bool
write_sections(const config::sections_type& sections,
std::ostream& output);
bool
write_sections(const config::sections_type& sections,
const string& path);
bool
write_config(const config& conf,
std::ostream& output);
bool
write_config(const config& conf,
const string& path);
Support specifying data member insertion in suppressions This patch is for supporting this kind of things: [suppress_type] name = S has_data_member_inserted_between = {8, end} or: [suppress_type] name = S has_data_members_inserted_between = {{8, 31}, {64, end}} or: [suppress_type] name = S has_data_members_inserted_at = offset_after(member0) How cool is that, heh? Anyway, to do this, the patch adds support for tuple values (i.e, lists of values) in INI files. Then on top of that the patch adds support for the specific has_data_member_inserted_between, has_data_members_inserted_between and has_data_members_inserted_at properties. * include/abg-comparison.h (type_suppression::insertion_range): Declare new type. (type_suppression::insertion_ranges): Declare new typedef. (type_suppression::{s,g}et_data_member_insertion_ranges): Declare new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Declare new functions. (type_suppression::insertion_range::{boundary, integer_boundary, fn_call_expr_boundary}): Define new types. * src/abg-comparison.cc: (struct type_suppression::insertion_range::priv): New type. (type_suppression::insertion_range::{insertion_range, begin, end}): Define new member functions. (type_suppression::priv::insertion_ranges_): Add data member. (type_suppression::{s,g}et_data_member_insertion_ranges): Define new member functions. (type_suppression::insertion_range::boundary::priv): Define new type. (type_suppression::insertion_range::boundary::{boundary, ~boundary}): Define new member functions. (type_suppression::insertion_range::integer_boundary::priv): Define new type. (type_suppression::insertion_range::integer_boundary::{integer_boundary, as_integer, operator int, ~integer_boundary}): Define member functions. (type_suppression::insertion_range::fn_call_expr_boundary::priv): Define new type. (type_suppression::insertion_range::fn_call_expr_boundary::{fn_call_expr_boundary, as_function_call_expr, operator ini::function_call_expr_sptr}): Define new member functions. (type_suppression::insertion_range::{create_integer_boundary, type_suppression::insertion_range::create_fn_call_expr_boundary, type_suppression::insertion_range::eval_boundary}): Define new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Define new functions. (read_type_suppression, read_function_suppression) (read_variable_suppression): Support the new kinds of property-related types. Aslo, in read_type_suppression, support the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. (type_suppression::suppresses_diff): If we are looking at a type diff node that has inserted data members, evaluate the insertion ranges of the current type_suppression and see if they match the inserted data members. * include/abg-ini.h (property, simple_property, property_value) (string_property_value, tuple_property_value, function_call_expr): Declare new types. (property_sptr, property_value_sptr, string_property_value_sptr) (tuple_property_value_sptr): Declare new typedefs. (is_string_property_value, is_tuple_property_value) (is_simple_property, is_tuple_property, read_function_call_expr): Declare new functions. * src/abg-ini.cc (char_is_white_space, char_is_comment_start) (char_is_delimiter, char_is_property_value_char) (char_is_section_name_char, char_is_property_name_char) (char_is_comment_start, char_is_white_space) (remove_trailing_white_spaces, is_string_property_value) (is_tuple_property_value, is_simple_property, is_tuple_property) (write_property_value, char_is_function_name_char) (char_is_function_argument_char): Define new functions. (property::priv, tuple_property_value::priv) (simple_property::priv, tuple_property::priv): Define new types. (property::{property, get_name, set_name, ~property}): Define new member functions. (struct property_value::priv): Define new type. (property_value::{property_value, get_kind, operator const string&(), ~property_value}): Define new member functions. (struct string_property_value::priv): Define new type. (string_property_value::{string_property_value, set_content, as_string, operator string()}, ~string_property_value): Define new member functions. (tuple_property_value::{tuple_property_value, get_value_items, ~tuple_property_value, as_string}): Likewise. (simple_property::{simple_property, get_value, set_value, ~simple_property}): Likewise. (tuple_property::{tuple_property, set_value, get_value}): Likewise. (config::section::find_property): Adjust return type. (read_context::{char_is_delimiter, char_is_property_value_char, char_is_section_name_char, char_is_property_name_char, char_is_comment_start, char_is_white_space}): Remove these from here as they got moved them to be non-member functions above. (read_context::read_property_value): Return a property_value_sptr and do not take any parameter anymore. (read_context::{read_string_property_value, read_tuple_property_value, read_function_name, read_function_argument, read_function_call_expr}): Define new member functions. (read_context::read_property): Adjust return type. Also, change to read the different new kinds of properties values. (function_call_expr::priv): Define new type. (function_call_expr::{function_call_expr, get_name, get_arguments}): New member functions. (read_context::read_section): Adjust. (write_property, write_section): Adjust. * tests/data/test-diff-suppr/libtest{11,12}-add-data-member-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test{11,12}-add-data-member-{0,1}.suppr: New input suppression files. * tests/data/test-diff-suppr/test11-add-data-member-{2,3,4}.suppr: Add new test input files. * tests/data/test-diff-suppr/test{11,12}-add-data-member-report-{0,1}.txt: New reference output files. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test{11,12}-add-data-member-v{0,1}.cc: Source code for the new binaries above. * tests/test-diff-suppr.cc (in_out_specs): Add new test inputs. * tests/data/Makefile.am: Add the new test related files above to source distribution. * doc/manuals/libabigail-concepts.rst: Document the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-22 18:40:57 +00:00
class function_call_expr;
/// Convenience typedef for a shared pointer to function_call_expr
typedef shared_ptr<function_call_expr> function_call_expr_sptr;
/// The abstraction of a function call expression.
class function_call_expr
{
struct priv;
typedef shared_ptr<priv> priv_sptr;
priv_sptr priv_;
function_call_expr();
public:
function_call_expr(const string& name,
const vector<string>& args);
const string&
get_name() const;
const vector<string>&
get_arguments() const;
vector<string>&
get_arguments();
}; //end function_call_expr
bool
read_function_call_expr(std::istream& input,
function_call_expr_sptr& expr);
bool
read_function_call_expr(const string& input,
function_call_expr_sptr& expr);
function_call_expr_sptr
read_function_call_expr(const string& input);
}// end namespace ini
}// end namespace abigail
#endif // __ABG_INI_H__