Commit Graph

874 Commits

Author SHA1 Message Date
Dodji Seketeli
f2175b70cc Adjust some tests for output changes
After commit "8a4b0c9 Fix missing newlines in diff report", I forgot
to adjust some test reference outputs, leading to some test failures.

Fixed thus.

	* tests/data/test-abidiff/test-struct1-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test10-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test11-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test13-report.txt: Likewise.
	* tests/data/test-diff-filter/test2-report.txt: Likewise.
	* tests/data/test-diff-filter/test26-qualified-redundant-node-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test26-qualified-redundant-node-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-2.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-09 00:10:33 +02:00
Dodji Seketeli
8a4b0c93ba Fix missing newlines in diff report
It appears there are some missing new lines in the diff report.

Fixed thus.

	* src/abg-comparison.cc (class_diff::report): The overload of
	represent() for instances of var_decl does not emit new lines.  So
	the caller must ensure a new line is emitted.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-06 14:06:31 +02:00
Dodji Seketeli
fe9fa7a05f Support filtering out just one alias of a function
Suppose a function private_foo() has a symbol private_foo and also a
another one (an alias) named public_foo.  Then suppose we want to
filter out sub-type changes to private_foo().  But then we still want
to see changes to public_foo.

This patch does add this feature.  The [suppress_function] directive
now has a new (hidden) boolean 'allow_other_aliases' property.  When
set to 'yes' or 'true', if the function being looked at has an alias
symbol that does *NOT* match the other properties of the directive,
then the directive doesn't suppress reports for the function.  This
new  property is set to yes by default.

This means that when a function has got multiple aliases, to suppress
the function, one needs to write a regular expression that matches the
names of aliases.  Otherwise the function will not be suppressed.

	* include/abg-comparison.h (function_suppression::{get,
	set}_allow_other_aliases): Declare new member functions.
	* src/abg-comparison.cc
	(function_suppression::priv::allow_other_aliases_): New data
	member.
	(function_suppression::priv::priv): Initialize it to 'true'.
	(function_suppression::{get, set}_allow_other_aliases): Define new
	member functions.
	(read_function_suppression): Parse the new "allow_other_aliases"
	property.
	(function_suppression::suppresses_function): Update to evaluate
	the new 'allow_other_aliases' property when there is a property to
	match against some a symbol name of the function.
	(corpus_diff::report): Fix the printing of function aliases when
	printing sub-type changes to properly emit the plural of the word
	'symbol' when the function has several aliases.
	* include/abg-ir.h (elf_symbol::get_number_of_aliases): Declare
	new member function.
	* src/abg-ir.cc (elf_symbol::get_number_of_aliases): Define new
	member function.
	* doc/manuals/libabigail-concepts.rst: Update manual.
	* tests/data/test-diff-dwarf/test5-report.txt: Adjust.
	* tests/data/test-diff-suppr/libtest23-alias-filter-v0.so: New
	test input.
	* tests/data/test-diff-suppr/libtest23-alias-filter-v1.so: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-0.suppr: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-1.suppr: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-2.suppr: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-3.suppr: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-4.suppr: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-report-2.txt: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-report-3.txt: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-report-4.txt: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-report-5.txt: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-v0.c: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-v1.c: Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-version-script: Likewise.
	* tests/data/Makefile.am: Add the new test stuff to source
	distribution.
	* tests/test-diff-suppr.cc (in_out_spec): Add the tests inputs
	above to the list of input to run over.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-02 17:15:35 +02:00
Dodji Seketeli
51fbc04638 Complete apidoc
* src/abg-ir.cc (elf_symbol::get_aliases_id_string): Finish the
	incomplete apidoc for this member function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-01 11:13:39 +02:00
Dodji Seketeli
25dc383b40 Show aliases of functions with changed sub-types
The report emitted by abidiff now tells the user about the aliases of
the current function, when that function has some sub-type changes.

	* include/abg-ir.h (elf_symbol::get_aliases_id_string): Declare
	new overload.
	* src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define new
	overload.
	* src/abg-comparison.cc (corpus_diff::report): For functions with
	sub-type changes report their aliases.  Do not do this if the
	function is a constructor or destructor because these almost
	always have aliases, at least with GCC and the developer most
	certainly has not done anything special for that; she would thus
	be uselessly surprised by that remote implementation detail.
	* tests/data/test-diff-dwarf/test5-report.txt: Adjust test.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-01 11:03:16 +02:00
Dodji Seketeli
43c06a8746 Update ChangeLog file
* ChangeLog: Update automatically using 'make update-changelog'.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-25 08:13:21 +02:00
Dodji Seketeli
4bc7b5bbea Misc typo fixes
* src/abg-comparison.cc
	(corpus_diff::priv::{deleted, added}n_variable_is_suppressed): Fix
	a typo.
	* tests/data/test-diff-dwarf/test16-syms-only-v0.cc: Fix a typo in
	the comments.
	* tests/data/test-diff-dwarf/test16-syms-only-v1.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-24 12:12:47 +02:00
Dodji Seketeli
79383f937c Apply suppression specifications to added and removed functions and variables
Until now, specifications for suppressing change reports were applied
only to functions and variables that have sub-type changes.  Change
reports about function and variables that were added or removed could
not be suppressed.

This patch makes suppression specifications to apply to added and
removed functions and variables too.  They can also apply to function
and variable symbols that are not referenced by any debug info.

The patch also fixes some typo and formatting glitches and updates
some existing tests accordingly.

	* include/abg-comparison.h (is_type_suppression)
	(is_function_suppression): Declare new functions.
	({function, variable}_suppression::change_kind): Declare new enum.
	(function_suppression::{parse_change_kind, get_change_kind,
	set_change_kind, suppresses_function,
	suppresses_function_symbol}): Declare new member functions.
	(variable_suppression::{parse_change_kind, get_change_kind,
	set_change_kind, suppresses_variable, suppresses_variable,
	suppresses_variable_symbol}): Declare new member functions.
	(operator{&,|}): Declare new operators for
	function_suppression::change_kind and
	variable_suppression::change_kind enums.
	(corpus_diff::diff_stats::{num_removed_func_filtered_out,
	net_num_func_removed, num_added_func_filtered_out,
	net_num_func_added, num_removed_vars_filtered_out,
	net_num_vars_removed, num_added_vars_filtered_out,
	net_num_vars_added, num_removed_func_syms_filtered_out,
	num_added_func_syms_filtered_out, net_num_removed_func_syms,
	net_num_added_func_syms, num_added_var_syms_filtered_out,
	num_removed_vars_filtered_out, net_num_removed_var_syms,
	net_num_added_var_syms}): Declare new member functions.
	(corpus_diff::diff_stats::num_changed_vars_filtered_out): Renamed
	corpus_diff::diff_stats::num_vars_filtered_out into this.
	(corpus_diff::diff_stats::num_changed_func_filtered_out): Renamed
	corpus_diff::diff_stats::num_func_filtered_out into this.
	* src/abg-comparison.cc (is_type_suppression)
	(is_function_suppression): Define new
	function.
	(function_suppression::priv::change_kind): New data member.
	(function_suppression::priv): Initialize it.
	(function_suppression::{parse_change_kind, get_change_kind,
	set_change_kind, suppresses_function,
	suppresses_function_symbol}): Define new member functions.
	(operator{&,|}): Define new operators for the new
	function_suppression::change_kind enum.
	(function_suppression::suppresses_diff): Re-write this in terms of
	the new function_suppression::suppresses_function() function.
	(read_function_suppression): Support reading the new "change_kind"
	property.
	(variable_suppression::priv::change_kind_): New data member.
	(variable_suppression::priv::priv): Initialize it.
	(variable_suppression::{parse_change_kind, get_change_kind,
	set_change_kind, suppresses_variable,
	suppresses_variable_symbol}): Define new member functions.
	(is_variable_suppression): Define new function.
	(operator{&,|}): Define new operators for
	variable_suppression::change_kind enum.
	(variable_suppression::suppresses_diff): Re-write in terms of the
	new variable_suppression::suppresses_variable function.
	(read_variable_suppression): Support reading the new "change_kind"
	property.
	(corpus_diff::diff_stats::priv::{num_removed_func_filtered_out,
	num_added_func_filtered_out, num_removed_vars_filtered_out,
	num_added_vars_filtered_out, num_removed_func_syms_filtered_out,
	num_added_func_syms_filtered_out,
	num_removed_var_syms_filtered_out,
	num_added_var_syms_filtered_out}): New data members.
	(corpus_diff::diff_stats::priv::num_changed_func_filtered_out):
	Renamed the data member num_func_filtered_out into this.
	(corpus_diff::diff_stats::priv::num_changed_vars_filtered_out):
	Renamed data member num_vars_filtered_out into this.
	(corpus_diff::diff_stats::priv::priv): Initialize the new data
	members.
	(corpus_diff::diff_stats::{num_removed_func_filtered_out,
	num_removed_func_filtered_out, net_num_func_removed,
	net_num_func_added, num_added_func_filtered_out,
	net_num_func_added, num_removed_vars_filtered_out,
	num_removed_vars_filtered_out, net_num_vars_removed,
	num_added_vars_filtered_out, net_num_vars_added,
	num_removed_func_syms_filtered_out,
	num_added_func_syms_filtered_out, net_num_removed_func_syms,
	net_num_added_func_syms, num_added_var_syms_filtered_out,
	num_removed_vars_filtered_out, net_num_removed_var_syms,
	net_num_added_var_syms}): Define new member functions.
	(corpus_diff::diff_stats::num_changed_func_filtered_out): Renamed
	corpus_diff::diff_stats::num_func_filtered_out into this.
	(corpus_diff::diff_stats::num_changed_vars_filtered_out): Renamed
	corpus_diff::diff_stats::num_vars_filtered_out into this.
	(corpus_diff::diff_stats::{net_num_func_changed,
	net_num_vars_changed}): Adjust.
	(corpus_diff::priv::{suppressed_deleted_fns_,
	suppressed_added_fns_, suppressed_deleted_vars_,
	suppressed_added_vars_, suppressed_added_unrefed_fn_syms_,
	suppressed_deleted_unrefed_fn_syms_,
	suppressed_added_unrefed_var_syms_,
	suppressed_deleted_unrefed_fn_syms_}): New data members.
	(corpus_diff::priv::{apply_suppressions_to_added_removed_fns_vars,
	deleted_function_is_suppressed, added_function_is_suppressed,
	deleted_variable_is_suppressed, added_variable_is_suppressed,
	added_unrefed_fn_sym_is_suppressed,
	deleted_unrefed_fn_sym_is_suppressed,
	added_unrefed_var_sym_is_suppressed,
	deleted_unrefed_var_sym_is_suppressed}): Define member functions.
	(function_is_suppressed, variable_is_suppressed): Define new
	functions.
	(corpus_diff::priv::apply_filters_and_compute_diff_stats): Compute
	stats for filtered added or removed functions, variables and their
	symbols.
	(corpus_diff::priv::emit_diff_stats): Emit diff stats for filtered
	added or removed functions, variables and symbols.
	(corpus_diff::report): Support suppressed reports about added or
	removed functions, variables and symbols.  Fixed a typo that was
	in there for a while.  Note that that fix requires updating some
	regression tests, and the part of this patch that touches
	regression tests does that.
	(apply_suppressions):  In the overload for corpus_diff, apply the
	suppression to added or removed functions and variables.
	* doc/manuals/libabigail-concepts.rst: Update this manual to
	reflect the changes above.  Also, perform an extensive cleanup of
	the manual to introduce more section titles to make it easier to
	navigate the document using the table of content.
	* tests/data/test-abicompat/test2-var-removed-report-0.txt:
	Adjust.
	* tests/data/test-diff-dwarf/test0-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test12-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test19-soname-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test7-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test8-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test9-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test16-syms-only-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test17-non-refed-syms-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt:
	Likewise.
	* tests/data/test-diff-filter/test0-report.txt: Likewise.
	* tests/data/test-diff-filter/test01-report.txt: Likewise.
	* tests/data/test-diff-filter/test13-report.txt: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-v0.o: Add new test
	material.
	* tests/data/test-diff-filter/test15-0-report.txt: Likewise.
	* tests/data/test-diff-filter/test2-report.txt: Likewise.
	* tests/data/test-diff-filter/test21-compatible-vars-report-0.txt:
	Likewise.
	* tests/data/test-diff-filter/test24-compatible-vars-report-1.txt:
	Likewise.
	* test-diff-suppr/test15-suppr-added-fn-v1.o: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-0.suppr: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-1.suppr: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-2.suppr: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-3.suppr: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-4.suppr: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-report-0.txt: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-report-1.txt: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-report-2.txt: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-report-3.txt: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-report-4.txt: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-report-5.txt: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-v0.cc: Likewise.
	* test-diff-suppr/test15-suppr-added-fn-v1.cc: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-v0.o: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-v1.o: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-0.suppr: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-1.suppr: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-2.suppr: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-3.suppr: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-4.suppr: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-report-0.txt: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-report-1.txt: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-report-2.txt: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-report-3.txt: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-report-4.txt: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-report-5.txt: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-v0.cc: Likewise.
	* test-diff-suppr/test16-suppr-removed-fn-v1.cc: Likewise.
	* test-diff-suppr/test17-suppr-added-var-v0.o: Likewise.
	* test-diff-suppr/test17-suppr-added-var-v1.o: Likewise.
	* test-diff-suppr/test17-suppr-added-var-0.suppr: Likewise.
	* test-diff-suppr/test17-suppr-added-var-1.suppr: Likewise.
	* test-diff-suppr/test17-suppr-added-var-2.suppr: Likewise.
	* test-diff-suppr/test17-suppr-added-var-3.suppr: Likewise.
	* test-diff-suppr/test17-suppr-added-var-4.suppr: Likewise.
	* test-diff-suppr/test17-suppr-added-var-report-0.txt: Likewise.
	* test-diff-suppr/test17-suppr-added-var-report-1.txt: Likewise.
	* test-diff-suppr/test17-suppr-added-var-report-2.txt: Likewise.
	* test-diff-suppr/test17-suppr-added-var-report-3.txt: Likewise.
	* test-diff-suppr/test17-suppr-added-var-report-4.txt: Likewise.
	* test-diff-suppr/test17-suppr-added-var-report-5.txt: Likewise.
	* test-diff-suppr/test17-suppr-added-var-v0.cc: Likewise.
	* test-diff-suppr/test17-suppr-added-var-v1.cc: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-v0.o: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-v1.o: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-0.suppr: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-1.suppr: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-2.suppr: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-3.suppr: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-4.suppr: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-report-0.txt: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-report-1.txt: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-report-2.txt: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-report-3.txt: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-report-4.txt: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-report-5.txt: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-v0.cc: Likewise.
	* test-diff-suppr/test18-suppr-removed-var-v1.cc: Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-v0.o: New
	test input.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-v1.o:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-0.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-1.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-2.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-3.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-4.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-0.txt:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-1.txt:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-2.txt:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-3.txt:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-4.txt:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-5.txt:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-v0.cc:
	Likewise.
	* tests/data/test-diff-suppr/test19-suppr-added-fn-sym-v1.cc:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-v0.o:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-v1.o:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-1.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-2.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-0.txt:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-1.txt:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-2.txt:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-3.txt:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-4.txt:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-5.txt:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-v0.cc:
	Likewise.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-v1.cc:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-v0.o:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-v1.o:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-0.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-1.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-2.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-3.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-4.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-0.txt:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-1.txt:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-2.txt:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-3.txt:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-4.txt:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-5.txt:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-v0.cc:
	Likewise.
	* tests/data/test-diff-suppr/test21-suppr-added-var-sym-v1.cc:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-v0.o:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-v1.o:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-0.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-1.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-2.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-3.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-4.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-0.txt:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-1.txt:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-2.txt:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-3.txt:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-4.txt:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-5.txt:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-v0.cc:
	Likewise.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-v1.cc:
	Likewise.
	* tests/data/Makefile.am: Add the new test materials above to source
	distribution.
	* tests/test-diff-suppr.cc (in_out_specs): Add the new tests
	material above to the list of test inputs this harness has to run
	over.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-24 12:09:53 +02:00
Dodji Seketeli
9e64891731 Do not compare static data members when comparing types
The comparison code was too eager in comparing class types because it
was comparing static data members in the process.  This was causing
some spurious false positives about functions or variables sub-type
changes.  This patch fixes that by not comparing static data members
when comparing class types.

	* include/abg-ir.h (class_decl::get_non_static_data_members):
	Declare new data members.
	* src/abg-comparison.cc
	(class_diff::ensure_lookup_tables_populated): Only look at
	non-static data members.
	(compute_diff): In the overload for class_decl, only compare
	non-static data members.
	* src/abg-hash.cc (class_decl:#️⃣:operator()): Do not hash
	static data members members hashing a class_decl.
	* src/abg-ir.cc (class_decl::priv::data_members_): New data
	member.
	(class_decl::priv::priv): When initializing data members, store
	the non-static data members on the side, in the new
	class_decl::priv::non_static_data_members_ data member.
	(class_decl::get_non_static_data_members): Define member function.
	(class_decl::add_data_member): Store the non-static data members
	on the side in class_decl::priv::non_static_data_members_.
	(equals): In the overload for class_decl, do not take in account
	static data members when running the comparison.
	* tests/data/test-diff-dwarf/test7-report.txt: Adjust.
	* tests/data/test-diff-filter/test12-report.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-23 13:17:37 +02:00
Dodji Seketeli
bfeec954c6 Add a --suppr short alias to the --suppressions option of abidiff
* tools/abidiff.cc (display_usage): Add a help string for the new
	--suppr option.
	(parse_command_line): Support the --suppr option which is an alias
	for --suppressions.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-23 13:17:37 +02:00
Dodji Seketeli
944025e006 Enable large file support
Mattias Klose reported that building libabigail in the Debian build
system raised an error because the libabigail binaries were built
without the Large File Support (LFS), as described by
https://lintian.debian.org/tags/binary-file-built-without-LFS-support.html.

This just calls the configure macro AC_SYS_LARGEFILE for that.

	* configure.ac: Call the AC_SYS_LARGEFILE autoconf macro.
	* config.h.in: Update.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-23 12:30:27 +02:00
Dodji Seketeli
5b07d709ab Do not build zip archive support by default
Until now, the zip archive support was automatically built if the
libzip dependent library was installed on the system at configure
time.  As we are planning to remove the zip support, let's first
disable the support by default, even if libzip is installed at
configure time.

	* configure.ac: By default, unconditionally disable the
	zip-archive support.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-23 12:21:30 +02:00
Dodji Seketeli
63c5916269 Put the man pages of the binaries in section 1
I was clueless about the right sections for the man pages of the parts
of the libabigail.  But then Matthias Klose of Debian and Ubuntu fame
rightfully suggested that the man pages of the binaries should be in
section 1 (user commands) and the man page of the library should be in
section 7 (Miscellaneous).

This patch does that.

	* doc/manuals/Makefile.am(section1_manpages, section7_manpages):
	Two new variables to contain the man page names per section.
	(manpages): Set this variable to $section1_manpages and $section7_manpages.
	(install-man-and-info-doc): In this rule, create the destination
	directories for section 1 and 7 and copy the right man pages in
	their right directory.
	* doc/manuals/conf.py (man_pages): Generate the binary man pages
	into section 1 and the libabigail man page into section 7.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-23 12:06:54 +02:00
Dodji Seketeli
1f751bfc46 Sort deleted/added variables and symbols before emitting report
Reports about added/deleted variables and symbols changes were still
not sorted, causing differences in output for abidiff depending on the
platform it's run on.

This patch fixes that.

	* src/abg-comparison.cc (sort_string_var_ptr_map)
	(sort_string_elf_symbol_map): Define new static functions.
	(var_comp, elf_symbol_comp): Define new comparison functors.
	(corpus_diff::report): Sort the deleted variables, added
	variables, deleted function symbols, added function symbols,
	deleted variable symbols, and added variable symbols before
	walking them to emit reports.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-23 11:42:54 +02:00
Dodji Seketeli
68f4f35246 Remove useless white space
* src/abg-comparison.cc (sort_string_parm_map): Remove trailing
	white space from comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-23 11:42:54 +02:00
Dodji Seketeli
6c1e7da30d Bug 18580 - abidw ignores --out-file
So I forgot to finish the implementation of the --out-file option.
This patchlet addresses that.

	* tools/abidw.cc (main): Take the argument of --out-file into
	account when emitting the serialized form of the ABI.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-23 01:15:01 +02:00
Dodji Seketeli
0425b0f566 Fix a thinko in the comparison code
When a member function is wrongly considered as being added, then
either the new member function doesn't have a symbol name (linkage
name) or it has one, and it was already present in the first version
of the binary.

What was I thinking ... so I hope this shot is better.

	* src/abg-comparison.cc
	(class_diff::ensure_lookup_tables_populated): Ensure that when a
	member function is wrongly considered as being added, then either
	the new member function doesn't have a symbol name (linkage name)
	or it has one, and it was already present in the first version of
	the binary.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>

	# Veuillez saisir le message de validation pour vos
	modifications. Les lignes # commençant par '#' seront ignorées, et
	un message vide abandonne la validation.  # Sur la branche
	fix-master # Votre branche est à jour avec 'origin/master'.  # #
	Modifications qui seront validées : # modified:
	src/abg-comparison.cc # # Modifications qui ne seront pas validées
	: # modified: tools/abidw.cc # # Fichiers non suivis: # abidw.abi
	# build/ # depcomp # missing # patch-edited.txt # patch.txt #
	prtests/ # test-driver # # ------------------------ >8
	------------------------ # Ne touchez pas à la ligne ci-dessus #
	Tout se qui suit sera éliminé.
diff --git a/src/abg-comparison.cc b/src/abg-comparison.cc
index 14208f5..ef7c6c9 100644
--- a/src/abg-comparison.cc
+++ b/src/abg-comparison.cc
@@ -7419,8 +7419,8 @@ class_diff::ensure_lookup_tables_populated(void) const
 	     inserted_member_fns().begin();
 	   i != inserted_member_fns().end();
 	   ++i)
-	if (i->second->get_symbol()
-	    && f->lookup_function_symbol(i->second->get_symbol()->get_name(),
+	if (!i->second->get_symbol()
+	    || f->lookup_function_symbol(i->second->get_symbol()->get_name(),
 					 i->second->get_symbol()->get_version().str()))
 	  to_delete.push_back(i->first);
2015-06-23 01:09:53 +02:00
Dodji Seketeli
088f0778bc Build libabigail tests with position-independent code
Like what we just did for libabigail tools, build the non-regression
tests with the -fPIC option to please the Fedora Rawhide builds.

	* tests/Makefile.am: Add -fPIC to the compile flags.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-07 17:01:52 +02:00
Dodji Seketeli
96eb3a5698 Build libabigail tools as position-independent code
It turned out the hardened Rawhide build is failing if I don't this.

	* tools/Makefile.am: Compile the binaries here with -fPIC.  Note
	that the library libabigail.la is built with libtool which already
	takes care of this, so no need to worry about this for
	libabigail.la.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-07 16:55:29 +02:00
Dodji Seketeli
616d9af751 Update ChangeLog file
* ChangeLog: Update this automatically by typing make
	update-changelog.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-07 14:34:25 +02:00
Dodji Seketeli
aac76addef Avoid infinite loop in elf_symbol::get_alias_from_name()
It turns out we forget to test for the right exit condition while looping
over symbol aliases, leading to an infinite loop.

	* src/abg-ir.cc (elf_symbol::get_alias_from_name)
	(elf_symbol::get_alias_which_equals): Test for the next alias
	pointing to the main symbol, in the loop exit condition.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-07 14:30:49 +02:00
Dodji Seketeli
723222568e Change the linkage name only when necessary
Up to now the linkage name of a declaration was set to the name of
it's underlying symbol.  This patch changes that to instead honour
what the DW_AT_linkage_name DWARF property says, unless the value of
that property is either missing or wrong.

	* include/abg-ir.h (elf_symbol::get_alias_from_name): Declare new
	member function.
	* src/abg-ir.cc (elf_symbol::get_alias_from_name): Define it.
	* src/abg-dwarf-reader.cc (build_var_decl, build_function_decl):
	Once the linkage name is supposed to contain the value of the
	DW_AT_linkage_name attribute, set it the name of the underlying
	symbol only if value of DW_At_linkage_name is missing or different
	from the names of all the aliases of the underlying symbol.
	* tests/data/test-read-dwarf/test2.so.abi: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-04 13:30:16 +02:00
Dodji Seketeli
afd0411b64 Various white space cleanups
* include/abg-comparison.h: Remove various useless vertical white
	spaces.
	* tests/test-diff-dwarf.cc (in_out_spec): Fix indentation of some
	entries.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-04 13:30:16 +02:00
Dodji Seketeli
5b2e05a283 Fix various comments here and there
* src/abg-comparison.cc
	(diff_context::set_or_get_canonical_diff_for, compute_diff)
	(redundancy_marking_visitor::visit_begin): Fix comment in these
	functions.
	* src/abg-ir.cc (elf_symbol::is_variable): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-04 13:30:16 +02:00
Dodji Seketeli
eb765b5993 Add missing apidoc to elf_symbol type
* src/abg-ir.cc (elf_symbol::{elf_symbol, get_name, set_name,
	get_type, set_type, get_binding, set_binding, get_version,
	is_defined, is_public, is_function, is_variable}): Add missing
	apidoc to these member functions.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-04 13:30:16 +02:00
Dodji Seketeli
ca079ced94 Cleanup logic in class_diff::ensure_lookup_tables_populated()
At some point, it appeared that some bogus DWARF wouldn't tie a
function decl with its underlying symbol, but subsequent version of
the DWARF emitter (in the second subject of the diff) would correctly
link the function decl with its underlying symbol.

Comparing the two versions of function decl could then wrongly make
the class_diff code think that the function decl was added to the
binary.  I later added code that checks that for every supposedly
added function, its symbol must *NOT* have been present in the first
version of the binary.  I added some similar code for the removed
symbols case.  And that added code seems to work OK.

But then there is an even more ancient hacky attempt at handling the
same case that is no more warranted.  This patch removes it.

	* src/abg-comparison.cc
	(class_diff::ensure_lookup_tables_populated): Remove the code that
	tries to lookup allegedly added functions from the set of deleted
	ones, by using the pretty printed name of the function.  Handling
	the case of a function decl not correctly tied to it symbol is
	handled my generically a bit later in this function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-04 13:30:16 +02:00
Dodji Seketeli
dad6ad7bce Report possible changes in the set of aliases of a symbol.
* src/abg-comparison.cc (function_decl_diff::report): Report
	a change in the aliases of the symbols of a function; note that
	everything else but have stayed equal in the function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-04 13:30:16 +02:00
Dodji Seketeli
ad0ec3fd20 Report vtable changes in top-level function change reports
Up to know we were not reporting vtable changes on top-level function
change reports.  This patch adds that feature.

	* src/abg-comparison.cc (function_decl_diff::report): Report about
	virtual-ness and vtable offset changes.
	* tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt:
	New test input file.
	* tests/data/test-diff-dwarf/test28-vtable-changes-v{0,1}.o: New
	test input binaries.
	* tests/data/test-diff-dwarf/test28-vtable-changes-v{0,1}.cc:
	Source code of the input binaries above.
	* tests/data/Makefile.am: Add the new test input above to source
	distribution.
	* tests/test-diff-dwarf.cc (in_out_specs): Add the new test input
	above to the list of input this test harness has to run over.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-04 13:30:16 +02:00
Dodji Seketeli
0cd814766b Support new 'accessed_through' suppression property
It turned out it's important to be able to suppress changes about
types that are reachable from a function parameter only through e.g, a
pointer or a reference, so that only changes types that are reachable
directly from a function parameter are emitted.

This patch adds that feature.

While doing this, I noticed this: Suppose a diff node D2 is marked as
being redundant with a diff node D1 seen previously.  So only D1 is
reported; D2 is not, because it's been filtered out, because it's
redundant with D1.  But then suppose D1 is filtered out, due to a
suppression specification.  At that point, D2 should not be marked
redundant anymore, and should be reported.

Of course, the code before this patch was wrongly filtering D2 *and*
D1 out.  So this patch fixes that.

	* include/abg-comparison.h (enum type_suppression::reach_kind):
	Define new enum.
	(type_suppression::{get_consider_reach_kind,
	set_consider_reach_kind, get_reach_kind,
	mark_last_diff_visited_per_class_of_equivalence,
	clear_last_diffs_visited_per_class_of_equivalence,
	get_last_visited_diff_of_class_of_equivalence}): Declare new
	member functions.
	* src/abg-comparison.cc (diff_has_ancestor_filtered_out)
	(read_suppression_reach_kind): Define static function.
	(type_suppression::priv::{consider_reach_kind_, reach_kind_}):
	Define new data members.
	(type_suppression::priv::priv): Take a new reach_kind parameter.
	(type_suppression::type_suppression): Adjust to new prototype of
	priv constructor.
	(type_suppression::{get_consider_reach_kind,
	set_consider_reach_kind, get_reach_kind, set_reach_kind}): Define
	new member functions.
	(type_suppression::suppresses_diff): Interpret the result of
	type_suppression::get_reach_kind() to determine if the suppression
	specification suppresses a given diff node.
	(read_type_suppression): Support reading the content of the
	"accessed_through" property.
	(diff_context::priv::last_visited_diff_node_): New data member.
	(diff_context::{mark_last_diff_visited_per_class_of_equivalence,
	clear_last_diffs_visited_per_class_of_equivalence,
	get_last_visited_diff_of_class_of_equivalence}): Define new data
	members.
	(redundancy_marking_visitor::visit_begin): So if the current diff
	node has already been visited, but if the previously visited node
	has been filtered out, then do not mark this node as being
	redundant.  And mark the current diff node as being the last
	visited one in its class of equivalence.
	(categorize_redundancy): Clear the map of diff nodes visited per
	class of equivalence.
	* doc/manuals/libabigail-concepts.rst: Document the new
	'accessed_through' property.
	* tests/data/test-diff-suppr/test13-suppr-through-pointer-0.suppr:
	New test input data.
	* tests/data/test-diff-suppr/test13-suppr-through-pointer-report-{0,1}.txt:
	Likewise.
	* tests/data/test-diff-suppr/libtest13-suppr-through-pointer-v{0,1}.so:
	New test input binaries.
	* tests/data/test-diff-suppr/test13-suppr-through-pointer-v{0,1}.cc:
	Source code of the test input binaries above.
	* tests/data/test-diff-suppr/test14-suppr-non-redundant-0.suppr:
	New test input data.
	* tests/data/test-diff-suppr/test14-suppr-non-redundant-report-0.txt:
	Likewise.
	* tests/data/test-diff-suppr/test14-suppr-non-redundant-v{0,1}.o:
	New test input binaries.
	* tests/data/test-diff-suppr/test14-suppr-non-redundant-v{0,1}.cc:
	Source code of the binaries above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-04 13:29:32 +02:00
Dodji Seketeli
85929105f5 Fix redundancy marking for change of types used directly
If a type T is used directly (i.e, not through a pointer or reference)
as a function parameter or as a base class, a change in T should never
be marked as redundant in that context.  Otherwise, the change in that
context might be filtered out, possibly hiding real ABI incompatible
changes.

This patch implements this policy.

Also, it turned out in some circumstances, we where marking the first
visited diff node of a given class of equivalence of nodes as being
redundant, while we should only mark the *subsequently* visited nodes
of that class of equivalence as visited.  The patch also fixes that.

	* include/abg-comparison.h (pointer_map): Make this be a map of
	{size_t, size_t} pairs, rather than {size_t, bool}, so that each
	pointer in the map can be associated to another one.
	(diff_context::diff_has_been_visited): Return the pointer to the
	first diff node of the equivalence class that has been visited.
	* src/abg-comparison.cc (is_pointer_diff, is_reference_diff)
	(is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff)
	(is_child_node_of_function_parm_diff, is_child_node_of_base_diff):
	Define new static functions.
	(diff_context::diff_has_been_visited): Return the pointer to the
	first diff node of the equivalence class that has been visited.
	(diff_context::mark_diff_as_visited): Save the pointer to the
	first diff node of a given class of equivalence that has been
	visited.
	(redundancy_marking_visitor::visit_begin): If a diff node is a
	child node of a function parameter diff or base diff node and if
	it's not a pointer or reference diff node, then do not mark it as
	redundant.  Also, make sure to not mark the first diff node of a
	given class of equivalence that has been visited, as redundant;
	only the other subsequent nodes should be marked redundant; we
	were hitting this case because of an optimization that makes
	equivalent class diff nodes to share their private (pimpl) data.
	* tests/data/test-diff-filter/test29-finer-redundancy-marking-v{0,1}.o:
	New test input binaries.
	* tests/data/test-diff-filter/test29-finer-redundancy-marking-v{0,1}.cc:
	Source code of the new test input binaries above.
	* tests/data/test-diff-filter/test29-finer-redundancy-marking-report-0.txt:
	New test input.
	* tests/data/Makefile.am: Add the new test material above to the
	source distribution.
	* tests/test-diff-filter.cc (in_out_specs): Make this test harness
	run over the additional test input above.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-03 12:13:54 +02:00
Dodji Seketeli
318b31db5d Fix detection of local changes in base classes
It appears we were flagging too many base class changes as local.
That was preventing some change category propagation through base
class diff nodes.  This patch fixes that.

	* abg-ir.cc (equals): In the overload of class_decl::base_spec, if
	the underlying class carries changes, then do not flag these
	changes as local for the class_decl::base_spec.
	* tests/data/test-diff-dwarf/test27-local-base-diff-v{0,1}.o: New
	test input binaries.
	* tests/data/test-diff-dwarf/test27-local-base-diff-v{0,1}.cc: Source
	code for the test input binaries above.
	* tests/data/test-diff-dwarf/test27-local-base-diff-report.txt:
	New test input.
	* tests/data/Makefile.am: Add the test inputs above to source
	distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-02 12:34:02 +02:00
Dodji Seketeli
41d0ad035f Fix symbols comparison
While working on something else, I noticed that the code for handling
copying symbols (and their aliases) was broken, and so comparing two
symbols which main name were different by which had aliases that were
equal was wrongly resulting in the two symbol being different. I think
we shouldn't actually copy symbols and their aliases.  Once a symbol
is allocated, interested code should just manipulate that symbol by
address rather than by value an thus do away with the copying.

The patch does that, essentially.  In the implementation of a symbol,
the aliases as well as the main symbol are now weak pointers, rather
than naked pointers.  Numerous API entry points that were taking
containers of elf_symbol (and were copying elf_symbols over) are not
taking containers of smart pointers to elf_symbol.  Copying of
instances of elf_symbol is now thus disabled.

As a result many tests that were exercising elf_symbols (with alias)
comparison have been updated.

As a result, many empty sub-result of PR libabigail/PR17948 are now
fixed.

	* include/abg-ir.h (elf_symbol_wptr): New typedef.
	(elf_symbol): Make the constructors and assignment operator
	private.  The type can neither be copied nor created with the new
	operator.
	(elf_symbol::create): New static member function.
	(elf_symbol::{get_main_symbol, get_next_alias, add_alias}):
	Adjust.
	( compute_aliases_for_elf_symbol): Likewise.
	(elf_symbol::operator=): Make this private.
	(elf_symbol::get_alias_which_equals): Declare new member function.
	* src/abg-comp-filter.cc (function_name_changed_but_not_symbol):
	Adjust.
	* src/abg-comparison.cc
	(class_diff::ensure_lookup_tables_populated): Adjust.
	* src/abg-corpus.cc
	(corpus::priv::build_unreferenced_symbols_tables): Likewise.
	* include/abg-dwarf-reader.h (lookup_symbol_from_elf)
	(lookup_public_function_symbol_from_elf): Adjust.
	* src/abg-dwarf-reader.cc (lookup_symbol_from_sysv_hash_tab)
	(lookup_symbol_from_gnu_hash_tab, lookup_symbol_from_elf_hash_tab)
	(lookup_symbol_from_symtab, lookup_symbol_from_elf)
	(lookup_public_function_symbol_from_elf)
	(lookup_public_variable_symbol_from_elf): Adjust.
	(read_context::lookup_elf_symbol_from_index): Likewise.
	(read_context::lookup_elf_fn_symbol_from_address): Likewise.
	(read_context::lookup_elf_var_symbol_from_address): Likewise.
	(read_context::lookup_public_function_symbol_from_elf): Likewise.
	(read_context::lookup_public_variable_symbol_from_elf): Likewise.
	(read_context::load_symbol_maps): Likewise.
	(build_var_decl, build_function_decl): Likewise.
	* src/abg-ir.cc (elf_symbol::priv::{main_symbol_, next_alias_}):
	Change the type of these from elf_symbol* to elf_symbol_wptr.
	(elf_symbol::priv::priv): Adjust.
	(elf_symbol::{create, get_alias_which_equals}): Define new functions.
	(textually_equals): Likewise.
	(elf_symbol::{get_main_symbol, is_main_symbol, get_next_alias,
	add_alias}): Adjust to return or take elf_symbol_sptr type, rather
	than a elf_symbol* one.
	(elf_symbol::{get_aliases_id_string, does_alias}): Adjust.
	(compute_alias_for_elf_symbol): Likewise.
	(elf_symbol::operator==): Two symbols A and B are now equal if A
	has at least one alias that is textually equal to B.
	(equals): In the overload for function_decls, in the part where we
	compare the decl_base part of the functions without considering
	their decl names, we now also omit considering their linkage
	names, because we compared they symbols before.
	* tools/abisym.cc (main): Adjust.
	* tests/data/test-diff-dwarf/test12-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test12-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Adjust.
	* tests/data/test-diff-dwarf/test8-report.txt: Adjust.
	* tests/data/test-diff-filter/test10-report.txt: Adjust.
	* tests/data/test-diff-filter/test13-report.txt: Adjust.
	* tests/data/test-diff-filter/test2-report.txt: Adjust.
	* tests/data/test-diff-filter/test20-inline-report-0.txt: Adjust.
	* tests/data/test-diff-filter/test20-inline-report-1.txt: Adjust.
	* tests/data/test-diff-filter/test9-report.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-02 00:07:02 +02:00
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
8cc7a3e8ef Make indexes of function parameters start at 1
This patch make indexes of a function parameters start at 1, rather at
0 like they used to be.  Actually, for member functions, the
artificial implicit 'this' pointer parameter starts at 0.  In that
case, the first non-implicit parameter starts at 1 too, then.

The biggest part of the patch adjusts the numerous test cases that are
impacted.

	* src/abg-ir.cc (function_type::function_type): Starts the index
	of the parameters at 1, unless the firs parameter is an artificial
	one, in which case it starts at 0.
	* tests/data/test-abicompat/test5-fn-changed-report-0.txt: Adjust.
	* tests/data/test-diff-dwarf/test0-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test1-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test10-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test11-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test13-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test15-enum-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test2-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test20-add-fn-parm-report-0.txt: Adjust.
	* tests/data/test-diff-dwarf/test21-redundant-fn-report-0.txt: Adjust.
	* tests/data/test-diff-dwarf/test22-changed-parm-c-report-0.txt: Adjust.
	* tests/data/test-diff-dwarf/test24-added-fn-parms-report-0.txt: Adjust.
	* tests/data/test-diff-dwarf/test25-removed-fn-parms-report-0.txt: Adjust.
	* tests/data/test-diff-dwarf/test26-added-parms-before-variadic-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test4-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test6-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test7-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test8-report.txt: Adjust.
	* tests/data/test-diff-filter/test0-report.txt: Adjust.
	* tests/data/test-diff-filter/test01-report.txt: Adjust.
	* tests/data/test-diff-filter/test1-report.txt: Adjust.
	* tests/data/test-diff-filter/test10-report.txt: Adjust.
	* tests/data/test-diff-filter/test13-report.txt: Adjust.
	* tests/data/test-diff-filter/test14-0-report.txt: Adjust.
	* tests/data/test-diff-filter/test14-1-report.txt: Adjust.
	* tests/data/test-diff-filter/test16-report-2.txt: Adjust.
	* tests/data/test-diff-filter/test16-report.txt: Adjust.
	* tests/data/test-diff-filter/test17-0-report.txt: Adjust.
	* tests/data/test-diff-filter/test17-1-report.txt: Adjust.
	* tests/data/test-diff-filter/test18-report.txt: Adjust.
	* tests/data/test-diff-filter/test19-enum-report-1.txt: Adjust.
	* tests/data/test-diff-filter/test2-report.txt: Adjust.
	* tests/data/test-diff-filter/test22-compatible-fns-report-0.txt: Adjust.
	* tests/data/test-diff-filter/test23-redundant-fn-parm-change-report-0.txt: Adjust.
	* tests/data/test-diff-filter/test25-cyclic-type-report-0.txt: Adjust.
	* tests/data/test-diff-filter/test25-cyclic-type-report-1.txt: Adjust.
	* tests/data/test-diff-filter/test26-qualified-redundant-node-report-0.txt: Adjust.
	* tests/data/test-diff-filter/test26-qualified-redundant-node-report-1.txt: Adjust.
	* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt: Adjust.
	* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-2.txt: Adjust.
	* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-0.txt: Adjust.
	* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-1.txt: Adjust.
	* tests/data/test-diff-filter/test3-report.txt: Adjust.
	* tests/data/test-diff-filter/test9-report.txt: Adjust.
	* tests/data/test-diff-suppr/test0-type-suppr-report-0.txt: Adjust.
	* tests/data/test-diff-suppr/test0-type-suppr-report-3.txt: Adjust.
	* tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Adjust.
	* tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Adjust.
	* tests/data/test-diff-suppr/test10-changed-parm-c-report-0.txt: Adjust.
	* tests/data/test-diff-suppr/test2-struct-suppr-report-0.txt: Adjust.
	* tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Adjust.
	* tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Adjust.
	* tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Adjust.
	* tests/data/test-diff-suppr/test4-local-suppr-report-0.txt: Adjust.
	* tests/data/test-diff-suppr/test4-local-suppr-report-1.txt: Adjust.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Adjust.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: Adjust.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: Adjust.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: Adjust.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: Adjust.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: Adjust.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: Adjust.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: Adjust.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: Adjust.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: Adjust.
	* tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: Adjust.
	* tests/data/test-diff-suppr/test8-redundant-fn-report-1.txt: Adjust.
	* tests/data/test-diff-suppr/test9-changed-parm-c-report-0.txt: Adjust.
	* tests/data/test-diff-suppr/test9-changed-parm-c-report-1.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-05-24 23:33:49 +02:00
Dodji Seketeli
a32b5a3891 Some wording fixes to doc/manuals/libabigail-concepts.rst
* doc/manuals/libabigail-concepts.rst: Some light wording fixes.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-05-24 17:37:33 +02:00
Dodji Seketeli
a05384675c Type read from DWARF don't have alignment information
Types read from DWARF don't have any alignment information so we
shouldn't try to guess it, especially for structures.  So this patch
sets the alignment to zero in that case.  This helps remove some
spurious alignment changes detected by abidiff just because in some
cases we fail to guess that.

In the process, I noticed that when calculating the hash value of a
given data member, we were not including the hash value of its
context.  This led to mistakenly considering some data member changes
as redundant.  So the patch fixes that too.

	* src/abg-dwarf-reader.cc (build_type_decl)
	(build_class_type_and_add_to_ir, build_pointer_type_def)
	(build_reference_type, build_function_decl): Set the alignment for
	native types, class, reference and function type to zero,
	effectively meaning that they don't have alignment information.
	* src/abg-hash.cc (var_decl:#️⃣:operator): Take the hash value
	of the data member context in account when computing the hash
	value of a given data member.
	* tests/data/test-diff-dwarf/test-23-diff-arch-report-0.txt:
	Adjust.
	* tests/data/test-diff-dwarf/test10-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test13-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test22-changed-parm-c-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test26-added-parms-before-variadic-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test8-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test9-report.txt: Likewise.
	* tests/data/test-diff-filter/test13-report.txt: Likewise.
	* tests/data/test-diff-filter/test6-report.txt: Likewise.
	* tests/data/test-diff-suppr/test9-changed-parm-c-report-0.txt: Likewise.
	* tests/data/test-read-dwarf/test0.abi: Likewise.
	* tests/data/test-read-dwarf/test1.abi: Likewise.
	* tests/data/test-read-dwarf/test2.so.abi: Likewise.
	* tests/data/test-read-dwarf/test3.so.abi: Likewise.
	* tests/data/test-read-dwarf/test4.so.abi: Likewise.
	* tests/data/test-read-dwarf/test5.o.abi: Likewise.
	* tests/data/test-read-dwarf/test6.so.abi: Likewise.
	* tests/data/test-read-dwarf/test7.so.abi: Likewise.
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-05-24 17:16:41 +02:00
Dodji Seketeli
770858ba69 Better name ID function parameters
Now the name ID of a function parameter is going to be
"parameter-<index>".  I think it's clearer an simpler.

	* src/abg-ir.cc (function_decl::parameter::get_name_id): Make this
	be "parameter-<index>".

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-05-06 10:33:39 +02:00
Dodji Seketeli
6ce6f160b5 Better detection of parameter sub-type changes
Just looking at if the name of the changed type hasn't changed is not
enough for detecting a sub-type change; that will be fooled by
compatible changes (changes involving typedefs).  So this patch looks
through compatible changes for that matter.

	* include/abg-fwd.h (type_has_sub_type_changes): Declare new
	function.
	* src/abg-ir.cc (type_has_sub_type_changes): Define it.
	* src/abg-comparison.cc (fn_parm_diff::report): Use the new
	function type_has_sub_type_changes() instead of just looking at
	name changes.
	* tests/data/test-diff-dwarf/test4-report.txt: Adjust this
	reference test output.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-05-06 10:20:15 +02:00
Dodji Seketeli
61939fd07e Fix a potential crash when comparing variadic parameters again
* src/abg-comparison.cc (redundancy_marking_visitor::visit_begin):
	Avoid flagging diffs of variadic parameter *types* as redundant as
	well.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-05-06 10:16:38 +02:00
Dodji Seketeli
5c08779f5d Add debugging function for function parameters
* include/abg-ir.h
	(function_decl::parameter::get_pretty_representation): Declare new
	virtual member function.
	* src/abg-ir.cc
	(function_decl::parameter::get_pretty_representation): Define it.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-05-06 10:13:02 +02:00
Dodji Seketeli
006d5a9971 Add comments
* src/abg-dwarf-reader.cc (build_function_decl): Add comments when
	building the function parameters.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-05-06 10:10:48 +02:00
Dodji Seketeli
13424c9412 Add a debugging function for type_or_decl_base*
* include/abg-fwd.h (get_pretty_representation): Declare new
	overload for type_or_decl_base*.
	* src/abg-ir.cc (get_pretty_representation): Define it and express
	the previous overload for type_or_decl_base_sptr in terms of this
	new one.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-05-06 09:49:00 +02:00
Dodji Seketeli
5852910238 Return a reference to smart pointer for the void type node
This is just a small optimization in the passing

	* src/abg-ir.h (type_decl::get_void_type_decl): Return a reference
	to the smart pointer initially returned.
	* src/abg-ir.cc (type_decl::get_void_type_decl): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-05-05 10:45:15 +02:00
Dodji Seketeli
9b4d20db90 Bug 18342 - Segmentation fault while comparing functions with variadic parameters
In the IR built from DWARF, a variadic variadic parameter has an empty
type.  Later during type comparison, comparing an empty (NULL) type
with other types proves to be troublesome.

This patch handles the issue by creating a new kind of
abigail::type_decl type specifically for variadic parameters.  This is
like what is done for void types.

After that it appears that the categorizing sub-system flags a change
of variadic type to non-variadic type as redundant if that change
appears several times on different functions.  We don't want that
because it can hide important changes we want to see.  The patch fixes
that too.

	* include/abg-fwd.h (is_array_type): New overload for a naked
	pointer.
	* include/abg-ir.h (type_decl::get_variadic_parameter_type_decl): Declare new
	static function.
	* src/abg-ir.cc (is_array_type): Define new function overload for
	naked pointers
	(type_decl::get_variadic_parameter_type_decl): Define new static
	function.
	* src/abg-dwarf-reader.cc (build_function_decl): The type of
	variadic parameter is now a special type_decl.
	* include/abg-comparison.h (is_diff_of_variadic_parameter_type)
	(is_diff_of_variadic_parameter): New function declarations.
	* src/abg-comparison.cc (is_diff_of_variadic_parameter_type)
	(is_diff_of_variadic_parameter): Define new functions.
	(compute_diff): Refuse to return a NULL
	diff for types.  Assert that the parameters are non-NULL.
	(report_size_and_alignment_changes): We are comparing arrays only
	if the two parameters are arrays.
	(fn_parm_diff::fn_parm_diff): Refuse that type diff for this diff
	node is non empty.
	(fn_parm_diff::report): Strengthen an assert.  Cleanup a comment.
	(redundancy_marking_visitor::visit_begin): Do not mark function
	type and variadic parms diff nodes as redundant for local changes.
	* tests/data/test-diff-dwarf/libtest26-added-parms-before-variadic-v{0,1}.so:
	New test input binaries.
	* tests/data/test-diff-dwarf/test26-added-parms-before-variadic-report.txt:
	New test output reference.
	* tests/data/test-diff-dwarf/test26-added-parms-before-variadic-v{0,1}.c:
	Source code of the new test input binaries above.
	* tests/data/Makefile.am: Add the new test stuff to source
	distribution.
	* tests/test-diff-dwarf.cc (in_out_specs): Add the new test inputs
	above to the set of input to run this test harness over.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-05-05 10:45:06 +02:00
Dodji Seketeli
18bbfb5ec3 Fix archive writing support
The runtestwritereadarchive test is failing on Rawhide (Fedora 23) for
me now.  It appears it was because the content to write to the zip
archive is in a buffer which is stored in a vector of buffers.

When the vector grows, the buffers are potentially copied over, and
the old buffers are destroyed, making the address of the old buffers
being stalled.  But then those old address are used by the code that
write stuff in the zip archive.  Ooops.

This patch essentially replaces the vector of buffer with a list, so
that growing the list doesn't invalidate the buffers.  The patch also
does away with using deprecated APIs of libzip.

	* configure.ac: Require libzip 0.10.1 at least.
	* src/abg-writer.cc (archive_write_ctxt::serialized_tus): Make
	this be a list<string>, rather than a vector<string>.
	(create_archive_write_context): Truncate the archive if it exists
	already.
	(write_translation_unit_to_archive): Do not use the deprecated
	zip_add() function anymore.  Rather, use zip_file_add().
	* tests/test-write-read-archive.cc (main): Double check if the
	translation unit we read is empty or not.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-24 19:59:19 +02:00
Dodji Seketeli
a9582d8799 Use a better wording for the COPYING file
The library is distributed under the terms of LGPLV3+.  We shouldn't
forget the '+' in the COPYING file.

	* COPYING: Update to a more complete description.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-22 09:53:18 +02:00
Dodji Seketeli
3d8eccf9dc Update licence texts
* COPYING: Of course we know the licence we want to use now :-)
	* COPYING-GPLV3: Add the text of GPLv3.
	* Makefile.am: Add the file COPYING-GPLV3 above to source
	distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-20 13:51:21 +02:00
Dodji Seketeli
6baecca506 18252 - Added parameters are not properly sorted
In the changed functions/variables section of the abidiff report, when
function parameters were added or removed, they were not properly
sorted.  This patch fixes that.

	* src/abg-comparison.cc (sort_string_parm_map): Define new static
	function.
	(struct parm_comp): Define new type.
	(function_type_diff::priv::{sorted_deleted_parms_,
	sorted_added_parms_}): New data members that hold sorted
	deleted/added parameters.
	(function_type_diff::ensure_lookup_tables_populated): Initialize
	the two new data members above.
	(function_type_diff::report): For the report of parameters that
	got added/removed, use the sorted set of added/removed parameters
	above.
	* tests/data/test-diff-dwarf/test24-added-fn-parms-report-0.txt:
	New test input.
	* tests/data/test-diff-dwarf/libtest24-added-fn-parms-v{0,1}.so:
	Likewise.
	* tests/data/test-diff-dwarf/test25-removed-fn-parms-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/libtest25-removed-fn-parms-v{0,1}.so:
	Likewise.
	* tests/data/test-diff-dwarf/test24-added-fn-parms-v{0,1}.c:
	Likewise.
	* tests/data/test-diff-dwarf/test25-removed-fn-parms-v{0,1}.c:
	Likewise.
	* tests/data/Makefile.am: Add the new test material above to the
	source distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-15 15:21:56 +02:00
Dodji Seketeli
21adfb066f Misc reporting fixes/improvements
This patch contains various reporting improvement about how variables
and data member changes are represented, as well as how type changes
are represented.  The number changes itself is not that big, but the
number of adjustments to regression test is.

	* src/abg-comparison.cc (distinct_diff::report): Remove spurious
	vertical space before reporting size and alignment changes here.
	(represent): In the variables/data member overload, report type
	changes first.  Then the other changes.
	(report_size_and_alignment_changes): Make this report array size
	changes too.  Also, make some small adjustments about how type
	size/alignment changes are introduced.
	(array_diff::report): Now that report_size_and_alignment_changes()
	supports size change reporting, just use that function rather than
	doing it here.
	(corpus_diff::report): Consistently add a space between each
	changed function report.  Prefix changed variables with a [C],
	just like for functions.
	* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Adjust.
	* tests/data/test-abicompat/test5-fn-changed-report-0.txt: Likewise.
	* tests/data/test-abicompat/test6-var-changed-report-0.txt: Likewise.
	* tests/data/test-abidiff/test-qual-type0-report.txt: Likewise.
	* tests/data/test-abidiff/test-struct0-report.txt: Likewise.
	* tests/data/test-abidiff/test-struct1-report.txt: Likewise.
	* tests/data/test-abidiff/test-var0-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test-23-diff-arch-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test0-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test1-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test10-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test11-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test13-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test15-enum-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test2-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test20-add-fn-parm-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test21-redundant-fn-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test22-changed-parm-c-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test3-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test6-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test7-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test8-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test9-report.txt: Likewise.
	* tests/data/test-diff-filter/test0-report.txt: Likewise.
	* tests/data/test-diff-filter/test01-report.txt: Likewise.
	* tests/data/test-diff-filter/test1-report.txt: Likewise.
	* tests/data/test-diff-filter/test10-report.txt: Likewise.
	* tests/data/test-diff-filter/test11-report.txt: Likewise.
	* tests/data/test-diff-filter/test13-report.txt: Likewise.
	* tests/data/test-diff-filter/test14-0-report.txt: Likewise.
	* tests/data/test-diff-filter/test14-1-report.txt: Likewise.
	* tests/data/test-diff-filter/test15-0-report.txt: Likewise.
	* tests/data/test-diff-filter/test15-1-report.txt: Likewise.
	* tests/data/test-diff-filter/test16-report-2.txt: Likewise.
	* tests/data/test-diff-filter/test16-report.txt: Likewise.
	* tests/data/test-diff-filter/test17-0-report.txt: Likewise.
	* tests/data/test-diff-filter/test17-1-report.txt: Likewise.
	* tests/data/test-diff-filter/test18-report.txt: Likewise.
	* tests/data/test-diff-filter/test19-enum-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test2-report.txt: Likewise.
	* tests/data/test-diff-filter/test20-inline-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test21-compatible-vars-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test22-compatible-fns-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test23-redundant-fn-parm-change-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test24-compatible-vars-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test25-cyclic-type-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test25-cyclic-type-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test26-qualified-redundant-node-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test26-qualified-redundant-node-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-2.txt: Likewise.
	* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test3-report.txt: Likewise.
	* tests/data/test-diff-filter/test6-report.txt: Likewise.
	* tests/data/test-diff-filter/test9-report.txt: Likewise.
	* tests/data/test-diff-suppr/test0-type-suppr-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test0-type-suppr-report-3.txt: Likewise.
	* tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise.
	* tests/data/test-diff-suppr/test10-changed-parm-c-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test2-struct-suppr-report-0.txt: 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/test4-local-suppr-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test4-local-suppr-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: Likewise.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: Likewise.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: Likewise.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: Likewise.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: Likewise.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: Likewise.
	* tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test7-var-suppr-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test7-var-suppr-report-2.txt: Likewise.
	* tests/data/test-diff-suppr/test7-var-suppr-report-3.txt: Likewise.
	* tests/data/test-diff-suppr/test7-var-suppr-report-4.txt: Likewise.
	* tests/data/test-diff-suppr/test7-var-suppr-report-7.txt: Likewise.
	* tests/data/test-diff-suppr/test7-var-suppr-report-8.txt: Likewise.
	* tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test8-redundant-fn-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test9-changed-parm-c-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test9-changed-parm-c-report-1.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-14 06:16:00 +02:00
Dodji Seketeli
fc55e7f343 Make abidiff and abicompat return meaningful exit codes
As per https://sourceware.org/bugzilla/show_bug.cgi?id=18146, abidiff
the exit code of abidiff and abicompat is now a bit field that can be
inspected to know if the ABI change reported is incompatible for sure,
or if it needs user review of the output to decide.

This patch also updates the documentation.

	* doc/manuals/abicompat.rst: Update documentation for abicompat
	exit codes.
	* doc/manuals/abidiff.rst: Likewise for abidiff exit codes.
	* include/abg-tools-utils.h (enum abidiff_status): Declare new
	enum.
	(operator{|,&,|=}): Declare new operators for the new enum
	abidiff_status.
	(abidiff_status_has_error, abidiff_status_has_abi_change)
	(abidiff_status_has_incompatible_abi_change): Declare new
	functions.
	* src/abg-tools-utils.cc (operator{|,&,|=}): Define these new
	operators.
	(abidiff_status_has_error, abidiff_status_has_abi_change)
	(abidiff_status_has_incompatible_abi_change): Define new
	functions.
	* tests/test-diff-filter.cc (main): Adjust for the new exit code
	of abidiff.
	* tests/test-diff-suppr.cc (main): Likewise.
	* tests/test-abicompat.cc (main): Likewise.
	* tools/abicompat.cc (enum abicompat_status): Remove.
	(operator{|,&,|=}): Remove these operators for enum
	abicompat_status.
	(perform_compat_check_in_normal_mode)
	(perform_compat_check_in_weak_mode): Return abidiff_status instead
	of abicompat_status.  Adjust therefore.
	(main): Adjust to return abidiff_status now, instead of a just
	zero for all non-error cases.
	* tools/abidiff.cc (main): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-10 16:26:36 +02:00