Commit Graph

607 Commits

Author SHA1 Message Date
Dodji Seketeli
5c67f59f76 constify dm_context_rel::operator==
* include/abg-ir.h (dm_context_rel::operator==): Make this const.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-13 17:41:17 +02:00
Dodji Seketeli
e2a547c613 A distinct_diff node has no children node
* src/abg-comparison.cc (distinct_diff::chain_into_hierarchy): Do
	not append any children node here.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-13 17:40:47 +02:00
Dodji Seketeli
2d51a6429f Remove useless redundant_filter
* include/abg-comp-filter.h (class redundant_filter): Remove this
	now useless type declaration
	* src/abg-comparison.cc (filtering::redundant_filter::visit):
	Remove this useless member function definition.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-13 17:39:26 +02:00
Dodji Seketeli
d09f4de96b Sort diff reports about function parameters by their indexes
* include/abg-comparison.h (changed_parms_type): New convenience
	typedef.
	* src/abg-comparison.cc (struct changed_parm_comp): New comparison
	functor.
	(sort_changed_parm_map): New sorting function.
	(function_decl_diff::report): Use the new sort_changed_parm_map to
	sort the diffs for function parameters by their indexes.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-10 17:07:16 +02:00
Dodji Seketeli
e183228e82 Don't be too eager to use distinct_diff
* src/abg-comparison.cc (try_to_diff):  For this to actually
	select a diff kind, the two diff subject must be of type
	'DiffType'.
	(compute_diff_for_types, compute_diff_for_decls): Use
	distinct_diff in last resort.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-10 17:07:10 +02:00
Dodji Seketeli
2a77bead11 Implement generic diff tree walking and port categorization over it
* include/abg-comp-filter.h (apply_filter): Declare new overload
	that takes a corpus_diff_sptr ...
	* src/abg-comp-filter.cc (apply_filter): ... and define it.  On
	the existing overload for diff_sptr, make sure to traverse all
	diff nodes, even those that have already been traversed.
	* include/abg-comparison.h (enum diff_category): Remove
	NOT_REDUNDANT_CATEGORY, add REDUNDANT_CATEGORY.
	(operator&=, +operator<<): Declare new operators for enum diff_category.
	(diff_context::{forbid_traversing_a_node_twice,
	traversing_a_node_twice_is_forbidden):
	(diff_context::categorizing_redundancy): Remove this declaration.
	(diff_context::maybe_apply_filters): Declare a new overload that
	takes a corpus_diff_sptr.  And a take a new flag that says if it
	should visit all nodes including those that have already been
	visited.
	(diff::priv_): Make this data member protected.
	(diff::{begin_traversing, is_traversing, end_traversing,
	finish_diff_type, children_nodes, append_child_node,
	get_pretty_representation, chain_into_hierarchy, traverse}):
	Declare new member functions.
	(distinct_diff::{finish_diff_type, get_pretty_representation,
	chain_into_hierarchy}): Likewise.
	(distinct_diff::traverse): Remove.
	(pointer_diff::pointer_diff): Take the underlying type diff in
	parameter.
	(pointer_diff::{finish_diff_type, get_pretty_representation,
	chain_into_hierarchy}): Declare new member functions.
	(pointer_diff::traverse): Remove.
	(reference_type_def::reference_type_def): Take the underlying type
	diff in parameter.
	({array_type_def, reference_type_def}::{finish_diff_type,
	get_pretty_representation, chain_into_hierarchy}): Declare new
	member functions.
	({array_type_diff, reference_type_def}::traverse): Remove.
	(qualified_type_diff::qualified_type_diff): Take the underlying
	type diff in parameter.
	({enum_diff, qualified_type_diff, class_diff}::{finish_diff_type,
	get_pretty_representation, chain_into_hierarchy}): Declare new
	member functions.
	({enum_diff, qualified_type_diff, class_diff}::traverse): Remove.
	(is_class_diff): Declare new function.
	(base_diff::base_diff): Take the underlying type diff in
	parameter.
	({scope_diff, base_diff}::{finish_diff_type, get_pretty_representation,
	chain_into_hierarchy}): Declare new member functions.
	({scope_diff, base_diff}::traverse): Remove.
	(function_decl_diff::function_decl_diff): Take the return type
	diff as parameter.
	({function_decl_diff, type_decl_diff}::{finish_diff_type,
	get_pretty_representation, chain_into_hierarchy}): Declare new
	member functions.
	({function_decl_diff, type_decl_diff}::traverse): Remove.
	(typedef_diff::typedef_diff): Take the underlying type diff as
	parameter.
	(typedef::{finish_diff_type, get_pretty_representation,
	chain_into_hierarchy}): Declare new member functions.
	({typedef, translation_unit_diff}::traverse): Remove member
	function.
	(corpus_diff::{finish_diff_type, children_nodes,
	append_child_node, changed_variables, get_pretty_representation,
	chain_into_hierarchy}): Declare new member functions.
	(class diff_node_visitor::{visit_begin, visit_end}): Declare new
	member functions.
	(propagate_categories, print_diff_tree, categorizing_redundancy)
	(clear_redundancy_categorization, apply_filters): New functions
	and function overloads.
	* src/abg-comparison.cc (TRY_PRE_VISIT, TRY_PRE_VISIT_CLASS_DIFF)
	(TRY_POST_VISIT, TRY_POST_VISIT_CLASS_DIFF)
	(CATEGORIZE_REDUNDANCY_FROM_CHILD_NODE)
	(UPDATE_REDUNDANCY_CATEGORIZATION_FROM_NODE_SUBTREE)
	(TRAVERSE_DIFF_NODE_AND_PROPAGATE_CATEGORY)
	(TRAVERSE_MEM_DIFF_NODE_AND_PROPAGATE_CATEGORY)
	(TRAVERSE_MEM_FN_DIFF_NODE_AND_PROPAGATE_CATEGORY)
	(ENSURE_DIFF_NODE_TRAVERSED_ONCE)
	(ENSURE_MEM_DIFF_NODE_TRAVERSED_ONCE): Remove these macros.
	Hurrah.
	(diff_context::priv::categorizing_redundancy_): Remove.
	(diff_context::priv::forbid_traversing_a_node_twice_): Add new
	data member.
	(diff_context::priv::priv): Adjust.
	(diff_context::{forbid_traversing_a_node_twice,
	traversing_a_node_twice_is_forbidden}): Define new member
	functions.
	(diff_context::maybe_apply_filters): Once filters are applied (and
	categories are set to the relevant diff tree nodes, run a pass
	over the diff tree to propagate the categories to the relevant
	diff tree parent nodes.  Add an overload for corpus_diff_sptr.
	(diff_context::categorizing_redundancy): Remove member function.
	(diff_context::maybe_apply_filters): Define a new overload for
	corpus_diff_sptr
	(struct diff::priv::{finished_, traversing_, children_,
	pretty_representation_}):  New data members.
	(diff::priv::priv): Adjust.
	(diff::{begin_traversing, is_traversing, end_traversing,
	finish_diff_type, children_nodes, append_child_node, traverse,
	set_category, get_pretty_representation, chain_into_hierarchy}):
	Define new member functions.
	(diff::is_filtered_out): Do not refer to NOT_REDUNDANT_CATEGORY
	anymore.  Rather, use the new REDUNDANT_CATEGORY.
	({distinct_diff, var_diff, pointer_diff, array_diff,
	reference_diff, qualified_type_diff, enum_diff, class_diff,
	base_diff, scope_diff, function_decl_diff, type_decl_diff,
	typedef_diff}::{get_pretty_representation, chain_into_hierarchy,
	finish_diff_type}): Define new member functions.
	({distinct_diff, var_diff, pointer_diff, array_diff,
	reference_diff, qualified_type_diff, enum_diff, class_diff,
	base_diff, scope_diff, function_decl_diff, type_decl_diff,
	typedef_diff, translation_unit_diff}::traverse): Remove member
	functions.
	(operator&=, operator<<): Define new operators for diff_category.
	({function_decl_diff, typedef_diff}::priv::priv): Add a new
	constructor.
	(pointer_diff::{priv::priv, pointer_diff})
	(reference_diff::{priv::priv, reference_diff})
	(qualified_type_diff::{priv::priv, qualified_type_diff})
	(enum_diff::{priv::priv, enum_diff}, base_diff::{priv::priv,
	base_diff}, function_decl_diff::function_decl_diff): Take the
	underlying type diff in parameter.
	(compute_diff): Adjust the pointer_diff, reference_diff,
	qualified_type_diff, base_diff, function_decl_diff overloads.
	(class_diff::priv::{count_filtered_bases,
	count_filtered_subtype_changed_dm, count_filtered_changed_dm,
	count_filtered_changed_mem_fns, count_filtered_inserted_mem_fns,
	count_filtered_deleted_mem_fns}): Adjust for the call to
	diff_context::maybe_apply_filters.
	(corpus_diff::priv::{finished_, pretty_representation_}): New data
	member.
	(corpus_diff::priv::priv): New constructor.
	(corpus_diff::priv::clear_redundancy_categorization): Define new
	member function.
	(corpus_diff::priv::apply_filters_and_compute_diff_stats):
	Adjust for call to diff_context::maybe_apply_filters.  Also, call
	clear_redundancy_categorization at the end.
	(corpus_diff::priv::categorize_redundant_changed_sub_nodes):
	Revisit logic.
	(corpus_diff::{chain_into_hierarchy, finish_diff_type,
	children_nodes, append_child_node, changed_variables,
	get_pretty_representation}): Define new member functions.
	(corpus_diff::report): Categorize redundancy for every top level
	function/variable diff.
	(corpus_diff::traverse): Adjust to the new traversing interface.
	(diff_node_visitor::{visit_begin, visit_end}): Define new member
	functions.
	(struct category_propagation_visitor, struct diff_node_printer)
	(struct redundancy_marking_visitor, struct
	redundancy_clearing_visitor): New diff tree node visitors.
	(propagate_categories, print_diff_tree, categorize_redundancy)
	(clear_redundancy_categorization, apply_filters): Define new
	functions.
	* tests/Makefile.am: Add the new tests/print-diff-tree.cc to the
	source distribution.  Build it into a tests/printdifftree binary.
	* tools/abidiff.cc (print_diff_tree): Add debugging functions to
	call from within the debugger.  By default, this function and its
	overloads are not compiled.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-10 13:18:04 +02:00
Dodji Seketeli
5ebc8bf5dd Update copyright notice for tests/test-diff2.cc
* tests/test-diff2.cc: Update copyright year.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-10 13:17:35 +02:00
Dodji Seketeli
d5c4009f23 Do not crash on function_decl_diff for fns that have no symbol
* src/abg-comparison.cc (function_decl_diff::report): If a
	function decl has no associated elf symbol, do not crash while
	trying to report about its elf symbol aliases.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-09 15:31:26 +02:00
Dodji Seketeli
4bed1e9b2c Avoid broken output for virtual member fns w/o symbols
* src/abg-comparison.cc (represent): When a virtual member
	function has no associated elf symbol, do not emit garbage in lieu
	of the linkage name.  Just emit no linkage name;
	* tests/data/test-abidiff/test-struct1-report.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-09 15:31:19 +02:00
Dodji Seketeli
ed57bfdf08 Sort added/removed/changed functions reported by the comparison engine
* src/abg-comparison.cc (struct function_comp, struct
	changed_function_ptr_comp): New comparison functors.
	(sort_string_function_ptr_map)
	(sort_string_changed_function_ptr_map): Define new static
	functions.
	(corpus_diff::report): Sort the added/removed/changed functions
	that are reported.
	* tests/data/test-diff-dwarf/test0-report.txt: Adjust.
	* tests/data/test-diff-filter/test01-report.txt: Adjust.
	* tests/data/test-diff-filter/test2-report.txt: Adjust.
	* tests/data/test-diff-filter/test9-report.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-02 18:15:10 +02:00
Dodji Seketeli
0161504b68 Mention virtual-ness of member function in their pretty representation
* include/abg-fwd.h (get_member_function_is_virtual): Declare new
	overload for pointers.
	* src/abg-ir.cc (get_member_function_is_virtual): Define it.
	(function_decl::get_pretty_representation): Print virtual-ness of
	the function_decl being pretty printed.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-02 12:30:54 +02:00
Dodji Seketeli
5ede56f5f8 Do not crash when reporting diffs about virtual member fns that have no symbol
* src/abg-comparison.cc (represent): If a virtual member function
	has no symbol do not crash.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-02 12:29:02 +02:00
Dodji Seketeli
b9d97f21c3 Fixup member functions which virtual-ness has just been set
* include/abg-ir.h (fixup_virtual_member_function): Declare new
	function.
	(class_decl): Declare fixup_virtual_member_function() as a member.
	* src/abg-ir.cc (set_member_function_is_virtual): Ensure that the
	member function that has seen its virtualness set is also put
	correctly put in the vector of virtual member functions of its
	class.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-02 12:17:48 +02:00
Dodji Seketeli
59a6b48609 Assert that only decls with elf symbols are part of comparison
* src/abg-corpus.cc (corpus::priv::build_public_decl_table): Assert
	that when read from DWARF, only decls with elf symbols are part of
	the public decls table.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-02 10:15:00 +02:00
Dodji Seketeli
d5977429c8 Emit all virtual member functions in group
* src/abg-writer.cc (write_class_decl): Emit virtual member
	functions contiguously.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-02 10:13:47 +02:00
Dodji Seketeli
0c4843bc5c Always emit vtable offset for virtual member function
* src/abg-writer.cc (write_voffset): Emit the vtable offset of
	virtual function even when the offset is zero.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-02 10:12:40 +02:00
Dodji Seketeli
6f50d38c23 Do not forget priv_->in_pub_sym_tab_ when copying decl_base
* src/abg-ir.cc (decl_base::decl_base(const decl_base& d)): Do
	not forget to copy priv_->in_pub_sym_tab_.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-02 10:10:45 +02:00
Dodji Seketeli
cbf1debeab Fix reading several clones of the same member function from DWARF
* include/abg-fwd.h (set_member_function_is_ctor)
	(set_member_function_is_dtor, set_member_function_is_const)
	(set_member_function_vtable_offset): Declare new functions.
	* include/abg-ir.h (class_decl::sort_virtual_mem_fns): Declare new
	member function.
	(mem_fn_context_rel::{vtable_offset, is_constructor is_destructor,
	is_const}): Add these setters.
	(set_member_function_is_ctor, set_member_function_is_dtor)
	(set_member_function_is_static, set_member_function_is_const)
	(set_member_function_vtable_offset)
	(set_member_function_is_virtual): Declare these new friend
	function to class class_decl::method_decl.
	* src/abg-dwarf-reader.cc (finish_member_function_reading): Split
	this out from build_class_type_and_add_to_ir.  Use the new setters
	for member functions properties introduced above.
	(build_class_type_and_add_to_ir): Factorize the creation of member
	function by using build_ir_node_from_die.  Once that function has
	created the member function in a rather generic way, use the new
	finish_member_function_reading to set the remaining specific
	properties for member functions.
	(build_function_decl): When called to read additional properties
	of a function_decl, allow this to read and update the elf symbol
	properties too.  This is useful for building a clone of a function
	that already has an elf symbol.
	(build_ir_node_from_die):  When building a function decl, consider
	the case of a DIE that has both DW_AT_specification and
	DW_AT_abstract_origin set.  That is, DW_AT_abstract_origin is set,
	and the origin has DW_AT_specification set.  This is basically a
	clone of a function that implements an interface (this happens for
	destructors, for instance).  In this case, really do the cloning
	of the interface implementation.  If the cloned function happens
	to be member function, use finish_member_function_reading to read
	the properties relevant to its method-ness.
	* src/abg-ir.cc (set_member_function_is_ctor)
	(set_member_function_is_dtor, set_member_function_is_const)
	(set_member_function_vtable_offset)
	(class_decl::sort_virtual_mem_fns): Define new functions.
	(sort_virtual_member_functions): Define new static function.
	(struct virtual_member_function_less_than): New functor.
	(class_decl::add_member_function): Keep virtual member functions
	vector sorted.
	* data/test-read-dwarf/test1.abi: Adjust.  Now, both the
	cdtor specification and all the clones that implements the
	different are emitted.
	* data/test-read-dwarf/test2.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-02 10:09:23 +02:00
Dodji Seketeli
5616233cf8 Do not crash when comparing functions that have no symbol
* src/abg-comparison.cc
	(class_diff::ensure_lookup_tables_populated): Just skip functions
	that have no ELF symbol.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-01 13:49:32 +02:00
Dodji Seketeli
46dbc9ce41 Rename member_function_is_virtual to get_member_function_is_virtual
* include/abg-fwd.h (get_member_function_is_virtual): Renamed the
	declaration of member_function_is_virtual into this.
	* src/abg-ir.cc (get_member_function_is_virtual): Likewise for its
	definition.
	* include/abg-ir.h (class decl_base): Adjust the friend function
	member_function_is_virtual references.
	* src/abg-comp-filter.cc (has_virtual_mem_fn_change)
	(has_non_virtual_mem_fn_change): Adjust.
	* src/abg-comparison.cc (represent)
	(SKIP_MEM_FN_IF_VIRTUALITY_DISALLOWED, class_diff::report):
	Likewise.
	* src/abg-hash.cc (class_decl:#️⃣:operator()): Likewise.
	(function_decl::clone, class_decl::add_member_function): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-30 18:16:03 +02:00
Dodji Seketeli
4e44ee383c Factorize a no-op deleter for shared pointer
* include/abg-sptr-utils.h (struct noop_deleter): Move this here
	from ...
	* src/abg-comparison.cc (struct noop_deleter): ... here.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-30 18:04:14 +02:00
Dodji Seketeli
56ee6cdcc5 Link manuals from the main web page
* doc/website/mainpage.txt: Add a link to the manuals.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-30 17:53:35 +02:00
Dodji Seketeli
2f296a7846 Initial documentation for libabigail
* doc/manuals/Makefile: New file, generated by sphinx-quickstart.
	* doc/manuals/abidiff.rst: New manual for abidiff.
	* doc/manuals/abidw.rst: New manual for abidw.
	* doc/manuals/abilint.rst: New manual for abilint.
	* doc/manuals/conf.py: New configuration file generated by sphinx-quickstart.
	* doc/manuals/index.rst: The root of the this documentation.
	* doc/manuals/libabigail-overview.rst: The overview of libabigail.
	* doc/manuals/tools.rst: The root of the tools manuals.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-26 17:06:12 +02:00
Dodji Seketeli
e807eb86e6 Do not install the abisym program
* tools/Makefile.am: Do not install abisym.  It's really there
	just for testing purposes and is of almost no use for generic
	users.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-26 16:14:18 +02:00
Dodji Seketeli
d041c1f5dd Rename bi* tools to abi* tools
* tests/data/test-bidiff: Rename this directory to
	tests/data/test-abidiff.
	* tests/test-bidiff.cc: Renamed this to tests/test-abidiff.cc.
	* tools/biar.cc: Renamed to tools/abiar.cc
	* tools/bidiff.cc: Renamed to tools/abidiff.cc
	* tools/bidw.cc: Renamed to tools/abidw.cc
	* tools/bilint.cc: Renamed to tools/abilint.cc
	* tools/bisym.cc: Renamed to tools/abisym.cc
	* tests/test-alt-dwarf-file.cc: Renamed references to bidw* to abidw*.
	* tests/test-diff-filter.cc: Renamed references to bidiff to abidiff.
	* tests/test-lookup-syms.cc: Renamed references to bisym to abisym.
	* tools/Makefile.am: Adjust.
	* tests/Makefile.am: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-26 10:58:16 +02:00
Dodji Seketeli
a18fd928df Light cleanup in abg-corpus.cc
* src/abg-corpus.cc
	(symtab_build_visitor_type::regex_fns_suppress): use
	sptr_utils::build_sptr, rather than building the shared_ptr of
	regex_t by hand.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-19 12:31:01 +02:00
Dodji Seketeli
368d192deb Pimplify abigail::comparison::diff type
* include/abg-comparison.h (diff::{priv, sptr}): New types.
	(diff::priv_): New member.
	(diff::*): Remove all the other previous data members and
	transform the inline member function definition into declarations
	only.
	* src/abg-comparison.cc (class diff::priv): New private data type.
	(diff::*): Define the previous inline member functions as
	out-of-line here.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-19 12:28:18 +02:00
Dodji Seketeli
6a3156b5d0 Rename shared_ptr<regex_t> into regex_t_sptr
* include/abg-sptr-utils.h (build_sptr()): Rename the return type
	from shared_ptr<regex_t> to regex_t_sptr.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-19 12:27:45 +02:00
Dodji Seketeli
2ed4525f93 Fix a comment in abg-comparison.h
* include/abg-comparison.h (class base_diff): Fix comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-19 12:26:25 +02:00
Dodji Seketeli
edd8a04291 Light style cleanup in tools/bidiff.cc
* tools/bidiff.cc (display_usage): Remove useless space before '&'.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-19 12:25:44 +02:00
Dodji Seketeli
c08108669b src/Makefile.am cleanup
* src/Makefile.am: Remove the unused 'headers' variable.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-19 12:23:33 +02:00
Dodji Seketeli
5bce089f23 Emit reports about not-yet categorized diff nodes
* include/abg-comparison.h (NO_CHANGE_CATEGORY): Better comment
	this enumerator.
	* src/abg-comparison.cc (diff::is_filtered_out): Not-yet
	categorized changes are not filtered out anymore.
	(distinct_diff::report): Avoid extraneous new line here.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-16 15:14:35 +02:00
Dodji Seketeli
fde3436568 Better support for inline related diffs
* include/abg-comparison.h
	(diff_category::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY): New
	enumerator.
	(diff_category::EVERYTHING_CATEGORY): Adjust.
	* include/abg-ir.h (elf_symbol::get_aliases_id_string)
	(elf_symbol::does_alias, elf_symbols_alias)
	(compute_aliases_for_elf_symbol): Declare new functions ...
	* src/abg-ir.cc (elf_symbol::get_aliases_id_string)
	(elf_symbol::does_alias, elf_symbols_alias)
	(compute_aliases_for_elf_symbol): ... and define them.
	(function_decl::operator==): Take in account elf symbol aliases.
	* src/abg-comp-filter.cc (function_name_changed_but_not_symbol):
	Define new static functions.
	(harmless_filter::visit): Categorize function name changes that
n	doesn't impact underlying elf symbols (or the fact that two
	symbols were aliases and are not anymore) as harmless.
	* src/abg-comparison.cc (function_decl_diff::report): Properly
	report function name changes, or symbol aliases changes for that
	matter.  Also report inline-ness declaration changes.
	* src/abg-dwarf-reader.cc (die_is_declared_inline): New static
	function.
	(build_function_decl): Use the above.
	* tools/bidiff.cc (set_diff_context_from_opts): Add
	abigail::comparison::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY into the
	harmless change camp.
	* tests/data/test-diff-dwarf/test14-inline-report.txt: New test
	input.
	* tests/data/test-diff-dwarf/test14-inline-v0.o: Likewise.
	* tests/data/test-diff-dwarf/test14-inline-v1.o: Likewise.
	* tests/data/test-diff-dwarf/test14-inline-v0.cc: Source code for
	test input.
	* tests/data/test-diff-dwarf/test14-inline-v1.cc: Source code for
	test input.
	* tests/test-diff-dwarf.cc: Run this test harness over the new
	input above.
	* tests/data/test-diff-filter/test20-inline-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test20-inline-report-1.txt:
	Likewise.
	* tests/data/test-diff-filter/test20-inline-v0.o: New test input.
	* tests/data/test-diff-filter/test20-inline-v1.o: New test input.
	* tests/data/test-diff-filter/test20-inline-v0.cc: Source code for
	test input.
	* tests/data/test-diff-filter/test20-inline-v1.cc: Likewise.
	* tests/test-diff-filter.cc: Run this test harness over the new
	input above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-16 15:10:41 +02:00
Dodji Seketeli
ba487a2cd9 Better support for enum diffs
* include/abg-comparison.h (changed_enumerator_type): New typedef.
	(diff_category::{HARMLESS_ENUM_CHANGE_CATEGORY}): New enumerator.
	* src/abg-comp-filter.cc (has_type_size_change)
	(has_enumerator_insertion, has_enumerator_removal_or_change)
	(has_harmful_enum_change): New functions.
	(harmless_filter::visit): Categorize enumerator insertions that
	don't change the size of the type into HARMLESS_ENUM_CHANGE_CATEGORY.
	(harmful_filter::visit): Categorize enumerator removal or any enum
	change that changes the size of the type into
	SIZE_OR_OFFSET_CHANGE_CATEGORY.
	* src/abg-comparison.cc (enumerator_value_comp)
	(changed_enumerator_comp): New types.
	(sort_enumerators, sort_changed_enumerators): New static
	functions.
	(enum_diff::report): Sort enum related reports by the value of the
	enumerators.
	* src/abg-dwarf-reader.cc (build_enum_type): Name anonymous enums
	as __anonymous_enum__.
 	* tools/bidiff.cc (set_diff_context_from_opts): Add
	abigail::comparison::HARMLESS_ENUM_CHANGE_CATEGORY into the harmless
	stuff camp.
	* tests/data/test-diff-dwarf/test15-enum-report.txt: New test
	input.
	* tests/data/test-diff-dwarf/test15-enum-v1.o: Likewise.
	* tests/data/test-diff-dwarf/test15-enum-v0.o: Likewise.
	* tests/data/test-diff-dwarf/test15-enum-v0.cc: Source code for
	test input.
	* tests/data/test-diff-dwarf/test15-enum-v1.cc: Likewise.

	* tests/data/test-diff-filter/test19-enum-report-0.txt: New test input.
	* tests/data/test-diff-filter/test19-enum-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test19-enum-v0.o: Likewise.
	* tests/data/test-diff-filter/test19-enum-v1.o: Likewise.
	* tests/data/test-diff-filter/test19-enum-v0.cc: Source code for
	test input.
	* tests/data/test-diff-filter/test19-enum-v1.cc: Likewise.
	* tests/test-diff-dwarf.cc: Run this test harness on the new test
	inputs above.
	* tests/test-diff-filter.cc: Likewise.
	* tests/Makefile.am: Add the new files above to the source distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-16 14:02:27 +02:00
Dodji Seketeli
41cfd5a82b Add constness to elf_symbol::operator==
* include/abg-ir.h (elf_symbol::operator==): Add a const to the
	declaration ...
	* src/abg-ir.cc (elf_symbol::operator==): ... and to the definition.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-16 11:21:47 +02:00
Dodji Seketeli
474b1c0e77 Misc style cleanups
* src/abg-comparison.cc (ChangedDataMemberComp): Rename this to
	changed_data_member_comp
	(sort_changed_data_members): Adjust.
	(DataMemberComp): Rename this to data_member_comp.
	(sort_data_members): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-15 12:48:52 +02:00
Dodji Seketeli
85dd6d116b Constify some function parameters in abg-comp-filter.cc
* src/abg-comp-filter.cc (type_size_changed): Now take const
          parameters.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-15 12:44:24 +02:00
Jan Engelhardt
650c77bb7e Add .gitignore files.
* .gitignore: Add new file.
	* m4/.gitignore: Likewise.
	* tools/.gitignore: Likewise.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:05:01 +02:00
Jan Engelhardt
4e32504064 Place -L/-l flags into *_LIBADD/*_LDADD
* src/Makefile.am: -L and -l ought to be in LIBADD/LDADD because
	that is the only place guaranteed to be in the right spot.  So add
	Them to libabigail_la_LIBADD.
	* tools/Makefile.am: Likewise.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:59 +02:00
Jan Engelhardt
f505d05b3c Add libelf to libabigail.la's linker line
* configure.ac: Check for the existence of libelf at configure
	time by looking at the presence of the elf_end symbol.  Add the
	libelf to the link command line.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:57 +02:00
Jan Engelhardt
b24a8127cb Drop hardcoded substitutions
* doc/Makefile.am: Do not use @docdir@.  It's indeed replaced at
	configure time. But there is no need for this limitation with
	automake, as $(docdir) is available and replaceable anytime.
	* src/Makefile.am: Likewise for @DEPS_LIBS@ and @DEPS_CFLAGS@.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:56 +02:00
Jan Engelhardt
1708e39fe7 Replace indirect variable assignments
* configure.ac(DEVEL_CFLAGS, DEVEL_CXXFLAGS):  Remove these
	useless variables.
	(CFLAGS, CXXFLAGS): Set these variables directly.
	* include/Makefile.am (pkginclude_HEADERS): Use this predefined
	variable.
	(publicheaders_DATA, publicheadersdir): Remove these.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:54 +02:00
Jan Engelhardt
e66eda9fe7 Remove empty and autogenerated files from git repository
* ChangeLog: Remove this empty file for now.  It'll be added back
	right before the first release by automatic generation from the
	commit logs.
	* INSTALL: Remove this empty file for now.
	* NEWS: Remove this empty file for now.  It'll be added back right
	before the first release.
	* configure.ac (AM_INIT_AUTOMAKE): As the mandatory but empty
	files above are being removed for now, let's put in the 'foreign'
	mode of automake for the moment.  We'll likely remove it at
	release time.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:48 +02:00
Jan Engelhardt
aa7fc67119 Set automake options globally
* configure.ac(AM_INIT_AUTOMAKE): Set the subdir-object option
	here ..
	* src/Makefile.am: ... not here.
	* tests/Makefile.am: Likewise.
	* tools/Makefile.am: Likewise.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:45 +02:00
Jan Engelhardt
0b1224faf1 Stash some autogenerated tools in build-aux/
* configure.ac: Reduce the pollution in the top-level directory a
	bit.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:42 +02:00
Dodji Seketeli
5f9a3bf4dd Fix memory leaks due to cycles in types ownership
* include/abg-fwd.h (std::tr1::weak_ptr): Inject this type in the
	abigail namespace.
	* include/abg-ir.h: Write a memory management guideline for the IR
	artifacts.
	(Type_base_wptr, function_type_wptr)
	(class_decl_wptr): New typedefs.
	(translation_unit::get_canonical_function_type): Declare new
	member function.
	(qualified_type_def::underlying_type_)
	(reference_type_def::pointed_to_type_)
	(typedef_decl::underlying_type_, function_decl::parameter::type_)
	(function_type::return_type_, method_type::class_type_)
	(non_type_tparameter::type_, type_composition::type_): Make this a
	weak pointer.
	(qualified_type_def::get_pointed_to_type)
	(reference_type_def::get_pointed_to_type)
	(array_type::get_element_type, typedef_decl::get_underlying_type)
	(var_decl::get_type, function_decl::parameter::get_type)
	(function_type::get_return_type, method_type::get_class_type)
	(non_type_tparameter::get_type)
	(type_composition::get_composed_type): Adjust to make this return
	a shared pointer initialized with the content of the weak pointer.
	(function_decl::function_decl, method_decl::method_decl): Remove
	the overload that doesn't take a type.  This is because now,
	function types need to be registered to their containing
	translation unit.
	(struct function_type::hash): Declare here.
	* src/abg-hash.cc (struct function_type::hash): Declare this in
	abg-ir.h and just define the methods here.
	* src/abg-ir.cc (fn_type_ptr_map): New typedef.
	(translation_unit::priv::canonical_types_): Remove this unused
	member.
	(translation_unit::priv::canonical_function_types_): New member.
	(translation_unit::get_canonical_function_type): Define this
	function.
	(array_type_def::priv::element_type_, var_decl::priv::type_)
	(function_decl::priv::type_): Make this a weak pointer.
	(qualified_type_def::get_underlying_type)
	(pointer_type_def::get_pointed_to_type)
	(reference_type_def::get_pointed_to_type)
	(array_type_def::get_element_type)
	(typedef_decl::get_underlying_type, var_decl::get_type)
	(function_decl::get_type): Adjust to make this return a shared
	pointer initialized with the content of the weak pointer.
	(qualified_type_def::build_name)
	(pointer_type_def::get_qualified_name)
	(reference_type_def::get_qualified_name): Adjust.
	(method_type::set_class_type): Cleanup the logic.
	(function_decl::priv::priv): Remove the overload that takes a bare
	pointer to a type.  This should not be used now that we need the
	function type to registered with the translation unit.
	(function_decl::function_decl): Remove the overload that doesn't
	take a type.  This is because now, function types need to be
	registered to their containing translation unit.
	* src/abg-dwarf-reader.cc (build_function_decl): Register the
	function type within its translation type and use its canonical
	version.  This complies with the new memory management rules.
	* src/abg-reader.cc (build_function_decl): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-10 18:08:41 +02:00
Dodji Seketeli
bcbb58d53a Compare class names when comparing methods
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-10 18:08:41 +02:00
Dodji Seketeli
8f6ef2e763 Slight white space fix
* src/abg-hash.cc (method_type:#️⃣:operator()(const
	method_type&)): White space fix.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-10 18:08:41 +02:00
Dodji Seketeli
a2f1adb617 Update copyright notice
* include/abg-ir.h: Update year of copyright notice.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-10 17:19:36 +02:00
Ondrej Oprala
bdac9d6631 Unite help output for tools
* tools/biar.cc (std::ostream): Add a using directive.
	(display_usage): Make it take a string reference and an ostream
	as parameters. Use the ostream argument as an output stream
	instead of a hard-coded cout.
	Prettify output.
	(main): Call display_usage with new parameters.
	* tools/bidiff.cc (display_usage): Declare it static.
	Prettify output.
	* tools/bidw.cc (display_usage): Prettify output.
	* tools/bilint.cc (display_usage): Declare it static.
	Prettify output.
	* tools/bisym.cc (std::cerr): Add a using directive.
	(prog_name): Rename progname into this.
	(display_usage): Rename show_help into this.
	Add an ostream as a parameter. Use the ostream argument
	as output stream insted of a hard-coded cout.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-09 18:14:35 +02:00