Commit Graph

6 Commits

Author SHA1 Message Date
Dodji Seketeli
d0bd599b4b 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-05-24 23:43:02 +02:00
Dodji Seketeli
76837d1cbf Update copyright years
* include/abg-comp-filter.h: Update copyright years.
	* include/abg-comparison.h: Likewise.
	* include/abg-config.h: Likewise.
	* include/abg-corpus.h: Likewise.
	* include/abg-diff-utils.h: Likewise.
	* include/abg-dwarf-reader.h: Likewise.
	* include/abg-fwd.h: Likewise.
	* include/abg-hash.h: Likewise.
	* include/abg-ini.h: Likewise.
	* include/abg-ir.h: Likewise.
	* include/abg-libxml-utils.h: Likewise.
	* include/abg-libzip-utils.h: Likewise.
	* include/abg-reader.h: Likewise.
	* include/abg-sptr-utils.h: Likewise.
	* include/abg-traverse.h: Likewise.
	* include/abg-viz-common.h: Likewise.
	* include/abg-viz-dot.h: Likewise.
	* include/abg-viz-svg.h: Likewise.
	* include/abg-writer.h: Likewise.
	* src/abg-comp-filter.cc: Likewise.
	* src/abg-comparison.cc: Likewise.
	* src/abg-config.cc: Likewise.
	* src/abg-corpus.cc: Likewise.
	* src/abg-diff-utils.cc: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* src/abg-hash.cc: Likewise.
	* src/abg-ini.cc: Likewise.
	* src/abg-ir.cc: Likewise.
	* src/abg-libxml-utils.cc: Likewise.
	* src/abg-libzip-utils.cc: Likewise.
	* src/abg-reader.cc: Likewise.
	* src/abg-traverse.cc: Likewise.
	* src/abg-viz-common.cc: Likewise.
	* src/abg-viz-dot.cc: Likewise.
	* src/abg-viz-svg.cc: Likewise.
	* src/abg-writer.cc: Likewise.
	* tests/print-diff-tree.cc: Likewise.
	* tests/test-abidiff.cc: Likewise.
	* tests/test-alt-dwarf-file.cc: Likewise.
	* tests/test-core-diff.cc: Likewise.
	* tests/test-diff-dwarf.cc: Likewise.
	* tests/test-diff-filter.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tests/test-diff2.cc: Likewise.
	* tests/test-ir-walker.cc: Likewise.
	* tests/test-lookup-syms.cc: Likewise.
	* tests/test-read-dwarf.cc: Likewise.
	* tests/test-read-write.cc: Likewise.
	* tests/test-utils.cc: Likewise.
	* tests/test-utils.h: Likewise.
	* tests/test-write-read-archive.cc: Likewise.
	* tools/abg-tools-utils.cc: Likewise.
	* tools/abg-tools-utils.h: Likewise.
	* tools/abiar.cc: Likewise.
	* tools/abidiff.cc: Likewise.
	* tools/abidw.cc: Likewise.
	* tools/abilint.cc: Likewise.
	* tools/abisym.cc: Likewise.
	* tools/binilint.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-07 17:52:10 +01:00
Dodji Seketeli
feea5df3fe 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-10-13 17:44:44 +02:00
Dodji Seketeli
c2ca83d62a Rename abigail::ini::config::section_vector to sections_type
* include/abg-ini.h (abigail::ini::config::sections_type): Renamed
	section_vector into this.
	(config::{get_sections, set_sections, read_sections,
	write_sections}): Adjust.
	* src/abg-ini.cc (config::priv::sections_): Adjust.
	(config::priv::priv): Likewise.
	(config::{config, get_sections}): Likewise.
	(read_sections, read_config, write_sections): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-13 17:44:43 +02:00
Dodji Seketeli
74b9337efc Implement the abigail::ini::config abstraction
* include/abg-ini.h (config::config): Add an overload that take a
	path and sections.
	(config::{get,set}_sections): New accessors.
	(read_sections): Rename the previous read_config() functions into
	these.
	(read_config): Add these function declarations to really act on
	instances of abigail::ini::config.
	(write_section): Rename the previous write_config functions into
	these.
	(write_config): Add these function declarations to really act on
	instances of abigail::ini::config.
	* src/abg-ini.cc (class config::priv): Implement this.
	(config::{config, ~config, get_path, set_path, get_sections,
	set_sections}): Define these new methods.
	(read_sections): Rename the former read_config into this.
	(read_config): Add this function definitions to really act on
	instances of abigail::ini::config.
	(write_sections): Rename the former write_config into this.
	(write_config):: Add this function definitions to really act on
	instances of abigail::ini::config.
	* tools/binilint.cc (main): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-13 17:44:43 +02:00
Dodji Seketeli
284c9e488f Initial support of ini-style file parsing
* include/abg-ini.h: New file.
	* include/Makefile.am: Add include/abg-ini.h to the source
	distribution.
	* src/abg-ini.cc: New file.
	* src/Makefile.am: Add src/abg-ini.cc to the source distribution.
	* tools/binilint.cc: New testing tool.
	* tools/Makefile.am: Add tools/binilint.cc to the source distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-13 17:44:43 +02:00