Commit Graph

115 Commits

Author SHA1 Message Date
Dodji Seketeli
d78ad0e349 Add --verbose to abidw
* doc/manuals/abidw.rst: Update the manual for the new --verbose
	option.
	* tools/abidw.cc (options::do_log): New data member.
	(options::options): Initialize it.
	(display_usage): New string for --verbose.
	(parse_command_line): Parse the --verbose option.
	(main): Set the the logging option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-25 16:49:38 +01:00
Dodji Seketeli
f48c0ef201 Update mentions to the build dependencies in the doc
There are holes in the list of dependencies mentioned in the
document.  This patch plugs some of them.

Many thanks to Michi Henning for raising this.

	* COMPILING: Mention elfutils, libtool, autoconf, automake and
	libtool.
	* doc/website/mainpage.txt: Mention automake and libtool.  Fix a typo.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-24 21:53:03 +01:00
Dodji Seketeli
9cef1838c9 Add --verbose option to abidiff
This is useful to see the progress of e.g type canonicalization and
visually spot where it takes times on some big binaries.

To do this, this patch enables logging in libabigail itself too.

	* doc/manuals/abidiff.rst: Add documentation for new --verbose
	option.
	* include/abg-dwarf-reader.h (set_do_log): Declare new function.
	* src/abg-dwarf-reader.cc (read_context::do_log_): New data
	member.
	(read_context::read_context): Initialize the new data member.
	(read_context::do_log): Define accessors.
	(set_do_log): Define new function;
	(read_context::canonicalize_types_scheduled)
	(read_debug_info_into_corpus): Add logs.
	* tools/abidiff.cc (options::do_log): New data member.
	(options::options): Initialize it.
	(display_usage): Add an usage string for --verbose.
	(parse_command_line): Parse the new --verbose option.
	(main): Set the dwarf reader's context wrt presence of the
	--verbose option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-18 16:06:13 +01:00
Dodji Seketeli
0cb928083d Talk about mandatory properties in suppress_* directives
The documentation doesn't talk about the mandatory properties in the
suppress_type, suppress_function and suppress_variable sections.

Fixed thus.

	* doc/manuals/libabigail-concepts.rst: Talk about the mandatory
	properties for suppress_type, suppress_function and
	suppress_variable directives.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-11 11:41:42 +01:00
Dodji Seketeli
b618da3869 Upate build instructions on the website
Now that we release tarballs, this patch updates the website for
instructions about how to compile them.

	* doc/website/mainpage.txt: Add instruction about how to build
	tarballs.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-01-08 10:02:51 +01:00
Dodji Seketeli
c573e59372 Update website link for 1.0.rc2
* doc/website/mainpage.txt: Update tarball link for 1.0.rc2

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-01-07 16:25:29 +01:00
Dodji Seketeli
79c1e30855 Update link to the 1.0.rc1 tarball
* doc/website/mainpage.txt: Update the "Getting source code"
	section.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-01-05 16:48:34 +01:00
Ondrej Oprala
6a7566d513 Add the option of printing the file, line and column information about a type being reported.
* bash-completion/abicompat: Complete the new "--no-show-locs" option.
	* bash-completion/abidiff: Likewise.
	* bash-completion/abidw: Likewise.
	* bash-completion/abipkgdiff: Likewise.
	* doc/manuals/abicompat.rst: Mention the new "--no-show-locs" option.
	* doc/manuals/abidiff.rst: Likewise.
	* doc/manuals/abidw.rst: Likewise.
	* doc/manuals/abipkgdiff.rst: Likewise.
	* include/abg-comparison.h (show_locs): Add declarations.
	* src/abg-comparison.cc: (diff_context::priv): Add a new switch
	called "show_locs_" and set its default value to false.
	(report_loc_info): New function. Outputting the extra information
	is conditionalized based on the associated diff contexts settings.
	(show_locs): define a getter/setter for
	diff_context::priv::show_locs_.
	({distinct,pointer,reference,qualified_type,enum,class,scope,fn_parm,
	typedef,corpus}_diff::report): Call report_loc_info when
	appropriate.
	(maybe_report_diff_for_member): Likewise.
	(represent): Accept a const reference to a diff_context_sptr as a first
	argument and call report_loc_info on its second argument.
	* src/abg-dwarf-reader.cc:
	* tests/data/Makefile.am: Add the new test reference files.
	* tests/data/test-abicompat/test0-fn-changed-report-2.txt: New test
	reference output.
	* tests/data/test-abicompat/test5-fn-changed-report-1.txt: Likewise.
	* tests/data/test-abicompat/test6-var-changed-report-1.txt: Likewise.
	* tests/data/test-abicompat/test7-fn-changed-report-2.txt: Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
	Likewise.
	* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt:
	Likewise.
	* tests/data/test-diff-pkg/dirpkg-3-report-2.txt: Likewise.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-0-1.txt: Likewise.
	* tests/test-abidiff.cc: Explicitly create a diff context and turn off
	location emitting.
	* tests/test-diff-dwarf.cc: Likewise.
	* tests/test-abicompat.cc: Add --no-show-locs to all existing test
	arguments. Run a few of the existing tests again, but without this
	option.
	* tests/test-diff-filter.cc: Likewise.
	* tests/test-diff-pkg.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tools/abicompat.cc: Handle the new "--no-show-locs" option.
	* tools/abidiff.cc: Likewise.
	* tools/abidw.cc: Likewise.
	* tools/abipkgdiff.cc: Likewise.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2015-12-15 12:32:55 +01:00
Ondrej Oprala
c738b5c311 Add bash-completion scripts for the libabigail tools
* Makefile.am: include bash-completion/Makefile.am
	* bash-completion/Makefile.am: New makefile for the bash-completion
	directory.
	* bash-completion/abicompat: New completion script.
	* bash-completion/abidiff: Likewise.
	* bash-completion/abidw: Likewise.
	* bash-completion/abilint: Likewise.
	* bash-completion/abinilint: Likewise.
	* bash-completion/abipkgdiff: Likewise.
	* bash-completion/abisym: Likewise.
	* configure.ac: Check for the bash-completion package. Handle
	the new --enable-bash-completion[=WHEN] configure option.
	* manuals/libabigail-tools.rst: Mention the scripts.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2015-11-23 08:18:48 +01:00
Dodji Seketeli
de49538b6d Fix doxygen configuration file paths in doc/Makefile.am
* doc/Makefile.am: There was an extra "/doc" in the path.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-11-16 16:20:36 +01:00
Dodji Seketeli
266fa9288e Add --version option to several libabigail tools
This patch changed the revision number of the libabigail library to
make it reflect the fact that we are not in "release candidate" mode,
before the first 1.0 release.  So the revision number is now "rc0".

The configuration manager has been updated to support version numbers
that are strings, so that it can supports things like "rc0".

Then, several libabigail tools have been modified to support the
--version option to display their version number.

	* configure.ac: Set the version revision to "rc0".
	* doc/manuals/abicompat.rst: Adjust manual for new --version
	option.
	* doc/manuals/abidiff.rst: Likewise.
	* doc/manuals/abidw.rst: Likewise.
	* doc/manuals/abilint.rst: Likewise.
	* doc/manuals/abipkgdiff.rst: Likewise.
	* include/abg-config.h (config::{m_format_minor, m_format_major}):
	Make these be strings.
	(config::{get,set}_format_minor_version_number): Make these return
	strings.
	(config::{get,set}_format_major_version_number): Make these return
	or take strings.
	(abigail_get_library_version): Make this take strings.
	* src/abg-config.cc (config::config): Adjust.
	(config::{get,set}_format_major_version_number): Make these return
	or take strings.
	(config::{get,set}_format_minor_version_number): Make these return
	strings.
	(abigail_get_library_version): Make this take strings.
	* include/abg-version.h.in: Make the version variables be strings.
	* src/abg-writer.cc (write_translation_unit): The version numbers
	are now strings so adjust.
	* tools/{abicompat,abidiff,abidw,abilint,abipkgdiff,abisym}.cc
	(options::display_version): New data member.
	(options::options): Initialize it.
	(display_usage): Add documentation for new --version option.
	(parse_command_line): Parse new --version option.
	(main): Support --version.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-11-16 12:54:10 +01:00
Ondrej Oprala
17b04f2e04 Bug 19081 - abipkgdiff parallelization
Abipkgdiff now attempts to extract packages and compare the resulting
ELF pairs in parallel. First off, a thread is spawned to extract each
package and each debuginfo package. After the ELF files are extracted,
mapped and the threads are successfully collected, the resulting
ELF vectors are traversed to identify existing pairs and a list of
arguments for future comparison is made. This list is then sorted
by size from largest to smallest. Unless --no-parallel is
specified on the command line, MIN(pairs,active_processors) threads
are spawned, sharing a single list of arguments. This list is
processed and a map of (ELF_PATH,DIFF_CORPUS) is created. Meanwhile,
the main thread checks this same map for results in the original order
of the ELF pairs, ensuring sequential output. After all the diffing
and reporting is done, the threads are collected again.

	* doc/manuals/abipkgdiff.rst: Mention the new --no-parallel option.
	* tools/Makefile.am: Add -pthread to abipkgdiffs link options.
	* tools/abipkgdiff.cc (elf_file_paths_tls_key): New key for the
	thread-local vector of ELF filepaths.
	(reports_map): A map of the path of the first ELF of a compared pair
	and a corpus representing the difference.
	(env_map): A map of the corpus difference and a corresponding
	environment needed to be kept alive until the diff is reported.
	({arg,map}_lock): mutexes to control access to the comparison argument
	list and the {reports,env}_map respectively.
	(options): Add a new member "parallel" and set it to true in the ctor.
	(elf_file): Add a new "size" member and set it in the ctor.
	(package descriptor): Arguments passed to extract_package_set.
	(compare_args): Arguments passed to the ELF comparison function.
	(display_usage): Mention the new "--no-parallel" option.
	(pthread_routine_extract_package): A wrapper function around
	extract_package to be used in a multi-threaded environment.
	({first_second}_package_tree_walker_callback_fn): Add the new ELF file
	paths to a thread-specific vector.
	(compare): In an overload of compare, verbose output is updated to
	always mention the ELF files being compared for each reported stage.
	Reporting is no longer done in this function, the resulting difference
	is instead passed back to the calling function for reporting in the
	main thread, along with a corresponding environment.
	(pthread_routine_compare): Accept a pointer to a vector of comparison
	arguments. This function is to be called NTHREAD times and share the
	vector passed to it with its other invocations. Create the environment
	for compare() and store its output in a map if there is a difference.
	(create_maps_of_package_content): Allocate memory for a thread local
	vector of ELF paths and dispose of it before returning.
	(pthread_routine_extract_pkg_and_map_its_content): Renamed from
	extract_package_and_map_its_content. Extract the debuginfo as well as
	the regular package in this function. Spawn a separate thread for the
	extraction of the debug package.
	(pthread_join): A function handling thread joining throughout package
	extractions.
	(prepare_packages): Spawn a thread to extract each set of packages.
	(elf_size_is_greater): New comparison function used to order ELF pairs
	by size.
	(compare): In the overload of compare, pass through the ELF path
	vectors and identify pairs to be diffed. Put them in a vector and sort
	it by the summed ELF pair size. Spawn comparison threads and safely
	check for results in the proper order of the ELF pairs. Report any
	differences ASAP and collect the threads after all the reporting is
	done, checking their return status.
	(parse_command_line): Check for the "--no-parallel" option.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2015-11-10 16:04:39 +01:00
Ondrej Oprala
c05a02573f Document abipkgdiff's option --no-abignore
* doc/manuals/abipkgdiff.rst: Mention the new option.
	* tools/abipkgdiff.cc: Likewise.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2015-11-10 09:50:45 +01:00
Ondrej Oprala
5115d16241 Fix minor warnings when building documentation.
* manuals/abilint.rst: Fix the "Literal block expected" warning.
	* manuals/abipkgdiff.rst: Fix the "Title underline too short" warning.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2015-10-05 09:27:16 +02:00
Ondrej Oprala
99cc564fe1 Fix an "Unknown target name" error during make info.
* doc/manuals/libabigail-overview.rst: Fix the reference to
	"ELF symbols".

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2015-10-05 08:35:57 +02:00
Ondrej Oprala
9e0bc5e617 Fix a path in doc/Makefile.am
* doc/Makefile.am: Prefix the path for DOXY_WEBSITE_SRC_CFG and
	DOXY_WEBSITE_BLD_{CFG,DIR} with "/doc" to protect it against make
	clean.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2015-10-05 08:03:35 +02:00
Dodji Seketeli
bd0926a2b5 Add a new --abidiff option to abidw
This is a debugging and sanity check option.  It saves the abi of the
ELF binary to a temporary file, reads it back and compares the abis of
the temporary file against the abi of the input ELF binary.

	* tools/abidw.cc (options::abidiff): New data member.
	(options::options): Initialize it.
	(display_usage): Add a usage string for the new --abidiff option.
	(parse_command): Parse the new --abidiff options.
	(main): Save the abi of the input elf in a temporary abixml file;
	read it back and compare both.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-09-21 15:14:26 +02:00
Dodji Seketeli
16299395d7 Support source_location_not_in and source_location_not_regexp suppressions
This patch adds support for properties source_location_not_in and
source_location_not_regexp in the [suppress_type] section of
suppression specifications.  So the suppression specification:

  [suppress_type]
    source_location_not_in = foo1.h, foo2.h bar1.h bar2.h

suppresses ABI change reports about types that are *NOT* defined in
files foo{1,2}.h and bar{1,2}.h.  The intended use of this construct is to
constrain abi change reports to types that are part of the API of a
given shared library.  The API of the library is supposed to be
defined in foo.h and bar.h only.

Similarly, the suppression specification:

  [suppress_type]
    source_location_not_regexp = (foo|bar){1,2}\\.h

suppresses ABI change reports about types that are not defined in the
same set of files foo1.h, foo2.h, bar1.h and bar2.h.

	* include/abg-ini.h (enum property_value::value_kind): Add a
	LIST_PROPERTY_VALUE kind.
	(class {list_property_value, list_property}): Declare new types.
	(is_list_property, is_list_property_value): Declare new functions.
	* src/abg-ini.cc (struct list_property_value::priv): Define new
	type.
	(list_property_value::{list_property_value, get_content,
	set_content, as_string}): Define new member functions.
	(is_list_property_value): Define new function.
	(struct list_property::priv): Define new type.
	(list_property::{list_property, get_value, set_value,
	handle_escape}): Define new member functions.
	(is_list_property): Define new function.
	(read_context::buf_): New data member.
	(read_context::{peek, get, put_back, good, eof, read_string,
	read_list_property_value}): New member functions.
	(read_context::read_next_char): Use the new read_context::{get,
	good, eof} member function, rather than using the input stream
	directly.
	(read_context::{skip_white_spaces, skip_comments,
	skip_white_spaces_or_comments, read_property_name,
	read_function_name, read_function_argument,
	read_function_call_expr, read_property_value,
	read_tuple_property_value, read_section_name, read_section}):
	Adjust to use the new member functions of read_context rather than
	using the input stream directly.
	(read_context::read_string_property_value): Likewise.  Use the new
	read_context::read_string() method.
	(read_context::{read, write}_property): Support reading list_property.
	* include/abg-comparison.h
	(type_suppression::{get_source_locations_to_keep,
	set_source_locations_to_keep,
	set_source_location_to_keep_regex_str,
	get_source_location_to_keep_regex_str}): Add new member functions.
	* src/abg-comparison.cc
	(type_suppression::priv::{source_location_to_keep_,
	source_location_to_keep_regex_str_,
	source_location_to_keep_regex_}): Add new data members.
	(type_suppression::priv::{g,s}et_source_location_to_keep_regex):
	Define new member functions.
	(type_suppression::{g,s}et_source_locations_to_keep): Define new
	member functions.
	(type_suppression::{g,s}et_source_location_to_keep_regex_str):
	Likewise.
	(type_suppression::suppresses_type): Support
	"source_location_not_regexp" and "source_location_not_in"
	properties of suppression specifications.
	(read_type_suppression): Likewise. Also adjust to the fact that
	ta tuple property value that is a list of strings is not a list
	property value.
	* doc/manuals/libabigail-concepts.rst: Add documentation for
	source_location_not_in and source_location_not_regexp.
	* tests/data/test-diff-suppr/libtest26-loc-suppr-v{0,1}.so: New
	binary test inputs.
	* tests/data/test-diff-suppr/test26-loc-suppr-{0,1,2}.suppr: New
	suppression specification test inputs.
	* tests/data/test-diff-suppr/test26-loc-suppr-report-{0,1,2,3}.txt:
	New test reference reports.
	* tests/data/test-diff-suppr/test26-loc-suppr-v{0,1}.cc: Source
	code of the test binary input above.
	* tests/data/test-diff-suppr/test26-loc-suppr.h: Likewise.
	* tests/data/Makefile.am: Add the new test material to source
	distribution.
	* tests/test-diff-suppr.cc (in_out_specs): Add the new test inputs above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-09-16 20:54:40 +02:00
Dodji Seketeli
164d17eefb Fix spurious errors in the install-man-and-info-doc target
* doc/manuals/Makefile.am (install-man-and-info-doc): Don't check
	for abidiff.info, that thing doesn't exist.  Rather, check for
	abigail.info.  Use gzip -f in case the zipped file exists already.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-09-09 09:19:10 +02:00
Dodji Seketeli
a89b0d0569 Update manual for abipkgdiff
* doc/manuals/abipkgdiff.rst: Say we support tarballs and plain
	directories.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-09-08 10:11:34 +02:00
Dodji Seketeli
277e524392 Add a new --noout option to abidw
* tools/abidw.cc (options::noout): New data member.
	(options::options): Initialize it.
	(display_usage): Add a usage string for the new option.
	(parse_command_line): Parse the new option.
	(main): If --noout is provided, do not emit the XML form.
 	* doc/manuals/abidw.rst: Document the new option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-29 16:23:15 +02:00
Dodji Seketeli
e61afa7291 Add a --no-architecture option to abidiff
This new option omits architectures when comparing ABIs.

	* tools/abidiff.cc (options::no_arch): New data member.
	(options::options): Initialize it.
	(display_usage): Display a help string for the new options.
	(parse_command_line): Parse the new options.
	(main): If --no-architecture is provided, set the corpus
	architecture to "".
	* doc/manuals/abidiff.rst: Document the new options.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-29 16:23:15 +02:00
Dodji Seketeli
7bcaf67504 Add a --stats to abidiff and abidw
For now, this new --stats emits diagnostics about the number of types
canonicalized at the very end of building the ABI corpus as well as
the number of types that were scheduled for late canonicalizing and
that couldn't be canonicalized.

	* include/abg-dwarf-reader.h (get_show_stats)
	(set_show_stats): New accessors for a new "show_stats" property of
	the dwarf reader context.
	* src/abg-dwarf-reader.cc: Include iostream to use std::cerr.
	(dwarf_reader::show_stats_): New data member.
	(dwarf_reader::dwarf_reader): Initialize it.
	(dwarf_reader::show_stats)
	(get_show_stats)
	(set_show_stats): Define new accessors.
	(dwarf_reader::die_type_map): Add const overload to this accessor.
	(dwarf_reader::lookup_type_from_die_offset): Make this accessor
	const.
	(dwarf_reader::add_late_canonicalized_types_stats): New member
	function.
	(dwarf_reader::perform_late_type_canonicalizing): Emit the
	statistics about late-canonicalized types if the user asked for
	it.
	* tools/abidiff.cc (options::show_stats): New data member.
	(options::options): Initialize it.
	(display_usage): Document it.
	(parse_command_line): Parse the new --stats option.
	(main): Create a dwarf reader context, set the show_stats to it
	and then use that context to read the corpora before diffing them.
	* tools/abidw.cc (options::show_stats): New data member.
	(options::options): Initialize it.
	(display_usage): Document it.
	(parse_command_line): Parse the new --stats option.
	(main): Set the show_stats to the dwarf reader context before
	using it.
	* doc/manuals/abidiff.rst: Update the manual.
	* doc/manuals/abidw.rst: Update the manual.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-20 13:25:42 +02:00
Dodji Seketeli
f271e4c460 Install the manpage for abipkgdiff
* doc/manuals/Makefile.am (section1_manpages): Add abipkgdiff.1 to
	the set of manpages to be install into section 1.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-14 16:48:35 +02:00
Dodji Seketeli
4b680be2a8 Update the abipkgdiff manual to say that .deb files are now supported
* doc/manuals/abipkgdiff.rst: Say that .deb fiel are now supported
	by abipkgdiff.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-14 15:24:59 +02:00
Dodji Seketeli
8798649dbe Do not remove api and website source files by accident
When the root source dir is used as root build dir, make clean can
remove the content of ${abs_builddir}/api which is then equal to
${abs_srcdir}/api.  Oops.  This patch fixes this.

	* doc/Makefile.am: Do not remove the entirety of the build dir of
	doxygen for the apidoc and the website as these can be also the
	source dirs.  Rather, remove that is under the html/ sub-directory
	of the build dir, as this is always generated by doxygen.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-14 13:31:30 +02:00
Dodji Seketeli
56112bae3b Add an abipkgdiff --fail-no-dbg command line option
* tools/abipkgdiff.cc (options::fail_if_no_debug_info): New data
	member.
	(options::options): Initialize it.
	(display_usage): Document it.
	(compare): If the user asked for it, fail if the we couldn't file
	the debug info for the corpus files being compared.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-13 23:26:53 +02:00
Dodji Seketeli
c09bb53ab1 Add -h and -d option shortcuts to abidw
Added a -h option shortcut for the --help option and a -d option
shortcut for the --debug-info-dir option, to the abidw program.

	* tools/abidw.cc (display_usage): Added a documentation string.
	(parse_command_line): Parse the new -h and -d shortcuts.
	* doc/manuals/abidw.rst: Update the manual.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-13 23:26:53 +02:00
Dodji Seketeli
71acc72064 Add a -h option shortcut to abidiff
Added a -h shortcut for --help to the abidiff program.n

	* tools/abidiff.cc (display_usage): Add documentation for the new
	switch.
	(parse_command_line): Parse the -h option.
	* doc/manuals/abidiff.rst: Update the manual.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-13 23:26:53 +02:00
Dodji Seketeli
da870f3598 Add a -h shortcup to abipkgdiff --help
* tools/abipkgdiff.cc (display_usage): Document the -h shortcut.
	(parse_command_line): Parse the -h shortcut to --help.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-13 23:26:52 +02:00
Dodji Seketeli
9f7c07460d Add --no-added-syms to abipkgdiff
With this new option the tool ignores added functions, variables and
their symbols.

	* tools/abipkgdiff.cc (options::show_added_syms): New data member.
	(options::options): Initialize it.
	(parse_command_line): Parse the new --no-added-syms option and set
	the options::show_added_syms flag accordingly.
	(display_usage): Add a help string for the new option.
	(set_diff_context_from_opts): Set the diff context according to
	the state of the new options::show_added_syms flag.
	* doc/manuals/abipkgdiff.rst: Add manual entry for the new
	--no-added-syms options.
	* tests/data/test-diff-pkg/test-rpm-report-5.txt: New test
	reference input file.
	* tests/data/Makefile.am: Add the new file above to source
	distribution.
	* tests/test-diff-pkg.cc (InOutSpec::prog_options): New data
	member.
	(in_out_specs): Adjust.  Add a new input to run the test again
	with --no-added-syms.
	(main): Adjust to pass the program options contained in
	InOutSpec::prog_options to abipkgdiff.

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

fixup! Add --no-added-syms to abipkgdiff

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-06 15:22:38 +02:00
Dodji Seketeli
decf33e847 Add a --keep-tmp-files option to abipkgidff
Sometimes, for debugging purposes it can be very handy to inspect the
content of the packages as seen by the tool.  This patch thus adds a
new --keep-tmp-files options so that users can inspect the content of
packages that were extracted.

	* tools/abipkgdiff.cc (options::keep_tmp_files): New data member.
	(options::options): Initialize it.
	(display_usage): Display a usage string for the new
	--keep-tmp-files option.
	(parse_command_line): Parse the new --keep-tmp-files option.
	(compare): Do not erase temporary directories if the users asked so.
	* doc/manuals/abipkgdiff.rst: Document the new --keep-tmp-files
	options.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-22 15:36:16 +02:00
Dodji Seketeli
819f8941cf Show linkage names in abipkgdiff output
With this patch abipkgdiff now shows the linkage names of
added/removed functions and variables.  In addition, there now is a
--no-linkage-name option to avoid seeing linkage names.

	* doc/manuals/abipkgdiff.rst: Document the new --no-linkage-name
	options.
	* tools/abipkgdiff.cc (options::show_linkage_names): New data
	member.
	(options::options): Initialize it.
	(display_usage): Display a usage string for --no-linkage-name.
	(parse_command_line): Parse the --no-linkage-name option.
	(set_diff_context_from_opts): Set the diff context accordingly.
	* tests/data/test-diff-pkg/test-rpm-report-0.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-21 16:09:53 +02:00
Dodji Seketeli
b638309e48 Add --no-added-binaries to abipkgdiff
* tools/abipkgdiff.cc (options::show_added_binaries): New data
	member.
	(options::options): Initialize it.
	(display_usage): Add a help string for --no-added-binaries.
	(parse_command_line): Parse the new --no-added-binaries option.
	(compare): Do not show added binaries if the user doesn't want to.
	* doc/manuals/abipkgdiff.rst: Document the new --no-added-binaries
	option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-21 14:15:33 +02:00
Dodji Seketeli
96af1baf13 make abipkgdiff return a proper exit code
With this patch, abipkgdiff returns the same exit code as abidiff.
It's zero if there is no ABI change, and non-zero if there are ABI
changes.  The exact value depends on the kind of changes that is
detected.

	* tools/abipkgdiff.cc (compare): Return an instance
	abigail::tools_utils::abidiff_status, just like what we do in
	abidiff.
	* doc/manuals/abipkgdiff.rst: Document the new exit code.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-21 14:11:53 +02:00
Dodji Seketeli
78293108f2 Fix the --suppressions manual doc for abidiff
* doc/manuals/abidiff.rst: Talk about the --suppr shortcut of the
	--suppressions option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-19 19:54:57 +02:00
Dodji Seketeli
80dc31f540 Add --suppressions to abipkgdiff
* tools/abipkgdiff.cc (options::suppressions): New data member.
	(set_diff_context_from_opts): Set the suppression specifications
	provided by the user to the diff context.
	(parse_command_line): Parse the --suppressions and --suppr command
	line options.
	* doc/manuals/abipkgdiff.rst: Document the --suppressions and
	--suppr options.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-19 19:52:01 +02:00
Dodji Seketeli
f3ed9dfa92 Support file_name_regexp and soname_regexp in supp-specs
With this patch it's now possible to express the soname or name of the binary
file that contains the ABI artifacts the suppression specifications
should apply to.

	* include/abg-comparison.h (suppression_base::priv_): Make this
	pimpl member protected.
	(suppression_base::set_file_name_regex_str)
	(get_file_name_regex_str, get_soname_regex_str)
	(set_soname_regex_str): Declare new accessors.
	(function_suppression::{suppresses_function,
	suppresses_function_symbol}): Take a diff_context_sptr.
	(variable_suppression::{suppresses_variable,
	suppresses_variable_symbol}): Take a diff_context_sptr.
	* src/abg-comparison.cc
	(suppression_base::priv::{file_name_regex_str_, file_name_regex_,
	soname_regex_str_, soname_regex_}): Define new data members.
	(suppression_base::priv::get_file_name_regex_str)
	(get_soname_regex_str): Define new member functions.
	(suppression_base::set_file_name_regex_str)
	(get_file_name_regex_str, get_soname_regex_str)
	(set_soname_regex_str): Define new accessors.
	(type_suppression::suppresses_diff): Evaluate file_name_regexp and
	soname_regexp.
	(read_type_suppression): Fix the reading of the "label" property.
	Read the file_name_regexp and soname_regexp properties.
	(function_suppression::{suppresses_function,
	suppresses_function_symbol): Take a diff_context_sptr parameter.
	Evaluate file_name_regexp and soname_regexp properties.
	(function_suppression::suppresses_diff): Adjust for the api change
	of function_suppression::suppresses_function().
	(read_function_suppression): Read the file_name_regexp and
	soname_regexp properties.
	(variable_suppression::suppresses_variable): Take a
	diff_context_sptr parameter and evaluate file_name_regexp and
	soname_regexp properties.
	(variable_suppression::suppresses_variable_symbol): Likewise.
	(variable_suppression::suppresses_diff): Adjust for the api change
	of variable_suppression::suppresses_variable().
	(read_variable_suppression): Read the file_name_regexp and
	soname_regexp properties.
	(function_is_suppressed, variable_is_suppressed): Take a
	diff_context_sptr parameter.
	(corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars):
	Adjust.
	* doc/manuals/libabigail-concepts.rst: Document file_name_regexp
	and soname_regexp in the manual.
	* tests/data/test-diff-suppr/libtest24-soname-v{0,1}.so: New test
	binary input files.
	* tests/data/test-diff-suppr/test24-soname-report-{0,4}.txt: New
	test input files.
	* tests/data/test-diff-suppr/test24-soname-suppr-{0,4}.txt:
	Likewise.
	* tests/data/test-diff-suppr/test24-soname-v{0,1}.cc: Source code
	of the binary test input files above.
	* tests/data/Makefile.am: Add the new test material above to
	source distribution.
	* tests/test-diff-suppr.cc (in_out_spec): Add the new test inputs
	to the set of tests this harness has to run over.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-19 19:48:51 +02:00
Dodji Seketeli
018a9345d6 Fix '--' being rendered as '-' in html manuals
* doc/manuals/abicompat.rst: Quote options as verbatim.
	* doc/manuals/abidiff.rst: Likewise.
	* doc/manuals/abidw.rst: Likewise.
	* doc/manuals/abilint.rst: Likewise.
	* doc/manuals/abipkgdiff.rst: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 11:14:46 +02:00
Dodji Seketeli
3b85f2864d Avoid redundant diff report messages by default.
Just like what abidiff does, this patch avoids emitting redundant diff
report messages unless the user provides the --redundant switch.

	* tools/abipkgdiff.cc (options::show_redundant_changes): New data
	member.
	(options::options): Initialize it.
	(display_usage): Add a help string for the --redundant command
	Line option.
	(set_diff_context_from_opts): New static function.
	(compare): Take the options variable.  Set the diff context from
	the options, especially if we should show redundant changes or
	not.  Use that diff context when comparing ABIs.
	(parse_command_line): Parse the new --redundant command line
	switch.
	* doc/manuals/abipkgdiff.rst: Document the new --redundant option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:11:20 +02:00
Dodji Seketeli
71a5e0762e Support comparing only shared libraries
It turned out on some packages we are interested on comparing shared
libraries only.  This patch adds that functionality by adding a new
--dso-only command line option to abipkgdiff.

	* tools/abipkgdiff.cc (options::compare_dso_only): New data
	member.
	(options::options): Initialize it.
	(display_usage): Display a little help string for it.
	(create_maps_of_package_content): Take the option variable.  Do
	not compare non-dso files if the --dso-only option was provided.
	(extract_package_and_map_its_content, prepare_packages, compare):
	Take the option variable.
	(parse_command_line): Parse the new --dso-only option.
	* doc/manuals/abipkgdiff.rst: Add documentation for the new
	--dso-only option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:11:15 +02:00
Dodji Seketeli
dea76e9f5f Add a manual for abipkgidiff
* doc/manuals/abipkgdiff.rst: New manual file.
	* doc/manuals/libabigail-tools.rst: Refer to the manual for
	abipkgdiff.
	* doc/manuals/Makefile.am: Add the new manual file to source
	distribution.
	* doc/manuals/conf.py: Add the manual for abipkgdiff to section 1.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:10:17 +02:00
Dodji Seketeli
f87d179a01 Add --d{1,2} shortcut options for --debug-info-dir{1,2} in abidiff
It turned out typing --debug-info-dir{1,2} is a tad cumbersome.  So this
patch adds --d1 and --d2 shortcut for these options.

	* tools/abidiff.cc (display_usage): Add the --d{1,2} to the help
	strings.
	(parse_command_line): Parse the new --d1 and --d2 options.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-09 11:11:16 +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
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
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
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
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
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
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