When reporting declaration-only type changes, the size is reported as
changing to or from 0, which is not correct. The declaration type is
of unknown size. This patch eliminates such size reports.
* src/abg-reporter-priv.cc (report_size_and_alignment_changes):
Filter out declaration-only / defined type size changes
unconditionally.
* tests/data/test-abidiff-exit/test-decl-struct-report.txt:
Update test.
Signed-off-by: Giuliano Procida <gprocida@google.com>
In the case where a type change is summarised as declaration-only to
defined or vice versa, the trailing new line was missing.
* src/abg-default-reporter.cc (default_reporter::report): In
the class_or_union_diff overload, emit a new line at the end
of the declaration-only reporting path.
* tests/data/test-abidiff-exit/test-decl-struct-report.txt:
Add missing blank lines.
Signed-off-by: Giuliano Procida <gprocida@google.com>
There were no tests exercising this reporting path. The new test is
run with --harmless as these changes are considered harmless.
* tests/data/Makefile.am: Add new test case files.
* tests/data/test-abidiff-exit/test-decl-struct-report.txt:
New test case generating "declaration-only" output.
* tests/data/test-abidiff-exit/test-decl-struct-v0.c: Ditto.
* tests/data/test-abidiff-exit/test-decl-struct-v0.o: Ditto.
* tests/data/test-abidiff-exit/test-decl-struct-v1.c: Ditto.
* tests/data/test-abidiff-exit/test-decl-struct-v1.o: Ditto.
* tests/test-abidiff-exit.cc: Run new test case.
Signed-off-by: Giuliano Procida <gprocida@google.com>
The elf-needed list is not relevant for the exported ABI of a library
so provide an option to drop it.
* doc/manuals/abidw.rst: Document --no-elf-needed.
* include/abg-writer.h (set_write_elf_needed): New function.
(set_common_options): Call it.
* src/abg-writer.cc (write_context::m_write_elf_needed): New data
member.
(write_context::{g,s}et_write_elf_needed): Add new accessors.
(set_write_elf_needed): New function.
(write_context::write_corpus): Check write_elf_needed.
* tools/abidw.cc (options): Add write_elf_needed bool.
(display_usage): Describe --no-elf-needed.
(parse_command_line): Parse --no-elf-needed.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The function parameter names are not relevant for the (exported)
ABI. So provide an option to simply drop them from the corpus.
* doc/manuals/abidw.rst: Add documentation for --no-parameter-names.
* include/abg-writer.h (set_write_parameter_names): New function.
(set_write_parameter_names): Call it.
* src/abg-writer.cc (write_context): Add m_write_parameter_names
bool, get_write_parameter_names and set_write_parameter_names
functions.
(write_context::write_function_decl): Check write_parameter_names.
* tools/abidw.cc (options): Add write_parameter_names.
(display_usage): Describe --no-parameter-names.
(parse_command_line): Parse --no-parameter-names.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When comparing two packages, abipkgdiff potentially spawns one thread
per pair of binaries to compare. The suppression specifications
generated for the private types of the package are shared among those
threads. As some internals of the suppression specifications are
constructed lazily, that can lead do some data races when more than
two threads access one of those internals.
One effective way to handle that is to make sure each thread has its
own copy of suppression specifications.
That's what this patch does.
* tools/abipkgdiff.cc (compare_args::private_types_suppr{1,2}):
Make these data member *not* be a reference anymore.
(maybe_create_private_types_suppressions): Rename this into ...
(create_private_types_suppressions): ... this. Also, make this
function return a copy of the vector of suppression specifications
for private types created.
(compare_prepared_userspace_packages): Use the new
create_private_types_suppressions to create a copy of private
types suppression specifications, rather than sharing it from
package::private_types_suppressions_.
(extract_package_and_map_its_content): Adjust to avoid creating
the shared suppression specifications for private types.
(package::private_types_suppressions_): Remove this data member
that was holding the shared suppressions for private types.
(package::private_types_suppressions): Remove these accessors.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The property name "reached_through" should have been
"accessed_through" and the property value "reference_or_pointer"
should have been "reference-or-pointer".
This patch fixes these issues.
* tests/data/test-diff-suppr/test24-soname-suppr-0.txt: Fix
typo, change "reached_through" to "accessed_through".
* tests/data/test-diff-suppr/test24-soname-suppr-1.txt: Ditto.
* tests/data/test-diff-suppr/test24-soname-suppr-2.txt: Ditto.
* tests/data/test-diff-suppr/test24-soname-suppr-3.txt: Ditto.
* tests/data/test-diff-suppr/test24-soname-suppr-4.txt: Ditto.
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Bad regexes are silently ignored. This will be fixed in a later
commit.
* tests/data/test-diff-suppr/test35-leaf.suppr: Fix typo in
regex, "*." -> ".*".
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Move maybe_adjust_et_rel_sym_addr_to_abs_addr to the elf-helpers.
This function had two overloads
GElf_Addr
maybe_adjust_et_rel_sym_addr_to_abs_addr(GElf_Addr addr, Elf_Scn *section);
GElf_Addr
maybe_adjust_et_rel_sym_addr_to_abs_addr(GElf_Sym *sym);
The former one is only ever called by the latter. Hence consolidate them
into
GElf_Addr
maybe_adjust_et_rel_sym_addr_to_abs_addr(Elf* elf_handle, GElf_Sym* sym);
to combine their functionality and preserve the outer interface. We
just add the Elf* handle argument as usual as we are out of
read_context now.
* src/abg-dwarf-reader.cc
(maybe_adjust_et_rel_sym_addr_to_abs_addr)
(drop the wrapped overload completely): Move out functions.
* src/abg-elf-helpers.cc
(maybe_adjust_et_rel_sym_addr_to_abs_addr): New function.
* src/abg-elf-helpers.h
(maybe_adjust_et_rel_sym_addr_to_abs_addr): New function
declaration.
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This change migrates all ELF helpers related to section lookup to
abg-elf-helpers.{cc,h}. It also homogenizes the interface of those to
always return Elf_Scn* and NULL in case that section can't be found.
Though this smells like a functional change, this latter change is
purely cosmetic.
* src/abg-dwarf-reader.cc (read_context::{opd_section_,
ksymtab_section_, ksymtab_reloc_section_, ksymtab_gpl_section_,
ksymtab_gpl_reloc_section_, ksymtab_strings_section_}): Make these
data members mutable as they are set by their getter member
functions, as an implementation detail.
(read_context::find_symbol_table_section):
adjust to new interface of elf_helpers::find_symbol_table_section.
(find_opd_section): use elf_helpers::find_opd_section for lookup.
(find_ksymtab_section): use elf_helpers::find_ksymtab_section.
(find_ksymtab_gpl_section): use elf_helpers::find_ksymtab_gpl_section.
(find_relocation_section): Move out function.
(get_binary_load_address): Move out function.
(find_ksymtab_reloc_section): use elf_helpers::find_relocation_section
(find_ksymtab_gpl_reloc_section): use
elf_helpers::find_relocation_section
* src/elf-helpers.cc (find_symbol_table_section): change
interface to match other find_*_section functions.
(find_symbol_table_section_index): Adjust for the new interface of
find_symbol_table_section.
(find_opd_section): New function.
(find_ksymtab_section): New function.
(find_ksymtab_gpl_section): New function.
(find_relocation_section): New function.
(get_binary_load_address): New function.
* src/elf-helpers.h (find_symbol_table_section): Change declaration.
(find_opd_section): New function declaration.
(find_ksymtab_section): New function declaration.
(find_ksymtab_gpl_section): New function declaration.
(find_relocation_section): New function declaration.
(get_binary_load_address): New function declaration.
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This consistently names the is_linux_kernel* helpers and keeps only the
copy in the elf-helpers. All users are adjusted.
* src/abg-dwarf-reader.cc
(read_context::function_symbol_is_exported): use is_linux_kernel
from elf_helpers.
(read_context::variable_is_exported): Likewise.
(read_context::get_symtab_format): Likewise.
(read_context::load_symbol_maps): Likewise.
(read_debug_info_into_corpus): Likewise.
(read_context::is_linux_kernel_binary): Drop function.
(read_context::is_linux_kernel_module): Drop function.
* src/abg-elf-helpers.cc (binary_is_linux_kernel): rename to
is_linux_kernel
(binary_is_linux_kernel_module): rename to is_linux_kernel_module
(find_ksymtab_strings_section): Adjust to function renames.
* src/abg-elf-helpers.h (binary_is_linux_kernel): rename to
is_linux_kernel
(binary_is_linux_kernel_module): rename to is_linux_kernel_module
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Move some definitions from abg-dwarf-reader to abg-elf-helpers that are
strictly only related to ELF.
* abg-dwarf-reader.cc (binary_is_linux_kernel): Move function out.
(binary_is_linux_kernel_module): Likewise.
(find_ksymtab_strings_section): Likewise.
* abg-elf-helpers.cc (binary_is_linux_kernel): Move function in.
(binary_is_linux_kernel_module): Likewise.
(find_ksymtab_strings_section): Likewise.
* abg-elf-helpers.h (binary_is_linux_kernel): Add declaration.
(binary_is_linux_kernel_module): Likewise.
(find_ksymtab_strings_section): Likewise.
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
abg-elf-helpers.{h,cc} shall contain the ELF related parts of the
abg-dwarf-reader. Create the stub files, an empty unit test and hook
everything up in the make system.
* src/Makefile.am: Add new source files abg-elf-helpers.{h,cc}.
* src/abg-elf-helpers.cc: New source file.
* src/abg-elf-helpers.h: New header file.
* tests/.gitignore: Exclude runtestelfhelpers from being committed.
* tests/Makefile.am: Add new test case runtestelfhelpers.
* tests/test-elf-helpers.cc: New test source file.
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Parallelize test execution for diff-suppr test by using abigail's multi
threaded worker queue. To accomplish that, follow a similar pattern like
other tests: Add a test_task struct with some precomputed values and
chunk up the work in main().
The test cases needed to be adjusted to allow parallel execution. In
particular the output files can't be shared anymore. To ensure this, a
small tests has been added that checks for unique output paths.
Finally, one redundant test case has been dropped.
This reduces the test time on my machine from ~31s to ~14s. There are
still two test cases that dominate the overall runtime. Since this test
is on the critical path for 'distcheck' (it is the test with the longest
runtime), this is effectively chopped off the overal make distcheck
time.
* tests/test-diff-suppr.cc(main): parallelize test execution.
(test_task) new abigail::workers::task implementation to run
test cases in this test as separate worker tasks.
Signed-off-by: Matthias Maennich <maennich@google.com>
For the update of fun_syms_, undefined_fun_syms_, var_syms_,
undefined_var_syms_, there is a pattern in
read_context::load_symbol_maps_from_symtab_section that can be
simplified: We try to find the correct entry and keep the iterator. If
we do not find it, we construct the value vector, find it again and
update the iterator. Eventually we push_back the symbol. That can be
simplified to looking up the value with operator[], which either returns
the existing value or default constructs it. The reference returned is
good for the push_back in any case.
* src/abg-dwarf-reader.cc
(read_context::load_symbol_maps_from_symtab_section): simplify
symbol map update for fun_syms_, undefined_fun_syms_, var_syms_,
undefined_var_syms_.
Signed-off-by: Matthias Maennich <maennich@google.com>
The default compression flag defined by automake via GZIP_ENV is --best.
That is pretty expensive for when you just want to make sure your change
is done properly to pass 'make distcheck'.
Hence add a convenience target 'make distcheck-fast' that sets GZIP_ENV
to --fast and runs distcheck with that.
On my machine, this almost cuts the 'make distcheck' time in half:
distcheck 4min 40s
distcheck-fast 2min 32s
This is not invasive as it does not change the existing distcheck
target.
* Makefile.am: add distcheck-fast make target
Signed-off-by: Matthias Maennich <maennich@google.com>
Kernel symbol whitelisting symbol is implemented using a regex to
suppress all function and variable names that don't match the given
list. This was completely broken for variables, resulting in all
variables being filtered out if a kernel whitelist was specified.
* src/abg-suppression-priv.h: In get_symbol_name_not_regex
method of variable_suppression::priv, fix typo causing
miscompilation of regex.
Signed-off-by: Giuliano Procida <gprocida@google.com>
Add a drop_undefined_syms properties to the read_context that
indicates the reader wants to drop any undefined symbols (which don't
have associated addresses in the corpus). Implement this for the
dwarf_reader and abidw (when using the --drop-undefined-syms option).
* include/abg-dwarf-reader.h (set_drop_undefined_syms):
New declaration.
* src/abg-dwarf-reader.cc (class read_context): Add private
bool drop_undefined_syms_.
(drop_undefined_syms): New getter and setter method.
(set_drop_undefined_syms): New function.
(function_is_suppressed): Check drop_undefined_syms on
read_context.
(variable_is_suppressed): Likewise.
* src/abg-reader.cc (read_context): Add private bool
m_drop_undefined_syms.
(drop_undefined_syms): New getter and setter method.
* tools/abidw.cc (struct options): Add drop_undefined_syms.
(display_usage): Print --drop-undefined-syms.
(parse_command_line): Parse --drop-undefined-syms.
(main): Call set_drop_undefined_syms.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
To create smaller abi XML files it is useful to be able to drop
the private types from the representation.
* tools/abidw.cc (options): Add drop_private_types bool.
(display_usage): Add --drop-private-types.
(parse_command_line): Parse --drop-private-types, set opts.
(set_suppressions): Call set_drops_artifact_from_ir when
drop_private_types set.
* doc/manuals/abidw.rst: Document --drop-private-types.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Sometimes public header files are in the same directory as private
header files. In such cases --headers-dir cannot be used. Add
--header-file to add individual public header files.
* include/abg-tools-utils.h (gen_suppr_spec_from_headers): Add
hdr_files string vector argument.
* src/abg-tools-utils.cc (handle_file_entry): New function that
adds one specific file to the type_suppression. Implementation
lifted from...
(handle_fts_entry): ...here. Call handle_file_entry for each file.
(gen_suppr_spec_from_headers): Also takes a header_files string
vector as argument. Call handle_file_entry for each file entry.
* tools/abidiff.cc (options): Add header_files1 and header_files2
string vectors.
(display_usage): Print --header-file1 and --header-file2 usage.
(parse_command_line): Handle --header-file1, --hf1 and
--header-file2, --hf2.
(set_diff_context_from_opts): Call gen_suppr_spec_from_headers
with header_files1 and header_files2.
(set_suppressions): Likewise.
* tools/abidw.cc (options): Add header_files string vector.
(display_usage): Print --header-file usage.
(parse_command_line): Handle --header-file1, --hf1.
(maybe_check_header_files): New function.
(set_suppressions): Call gen_suppr_spec_from_headers with
header_files.
(main): Call maybe_check_header_files.
* tools/abilint.cc (options): Add header_files string vector.
(display_usage): Print --header-file usage.
(parse_command_line): Handle --header-file1, --hf1.
(set_suppressions): Call gen_suppr_spec_from_headers with
header_files.
* doc/manuals/abidiff.rst: Document --header-file1, --hf1 and
--header-file2, --hf2. Add new options to documentation of
--drop-private-types.
* doc/manuals/abidw.rst: Document --header-file, --hf.
* doc/manuals/abilint.rst: Likewise.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Following on from giving some test file more descriptive names, this
patch actually documents in brief the purpose of these recently added
tests.
It also improves the coverage of the test-leaf-cxx-members test to
include deletion and insertion report text as well.
* tests/data/test-abidiff-exit/test-leaf-cxx-members-v1.cc:
Comment test. Reorder members of ops to get better coverage.
* tests/data/test-abidiff-exit/test-leaf-fun-type-v1.cc:
Comment test.
* tests/data/test-abidiff-exit/test-leaf-more-v1.cc: Ditto.
* tests/data/test-abidiff-exit/test-leaf-peeling-v1.cc:
Comment test. Update comment on ops2.
* tests/data/test-abidiff-exit/test-leaf-redundant-v1.c:
Comment test.
* tests/data/test-abidiff-exit/test-leaf-stats-v1.cc: Ditto.
* tests/data/test-abidiff-exit/test-leaf-cxx-members-report.txt:
Update locations. Update report to reflect deletion,
insertion and changed members (was previously changed only).:
* tests/data/test-abidiff-exit/test-leaf-peeling-report.txt:
Update locations.
* tests/data/test-abidiff-exit/test-leaf-redundant-report.txt:
Ditto.:
* tests/data/test-abidiff-exit/test-leaf-cxx-members-v0.cc:
Added one line comment referring to -v1 source file.
* tests/data/test-abidiff-exit/test-leaf-fun-type-v0.cc: Ditto.
* tests/data/test-abidiff-exit/test-leaf-more-v0.cc: Ditto.
* tests/data/test-abidiff-exit/test-leaf-peeling-v0.cc: Ditto.
* tests/data/test-abidiff-exit/test-leaf-redundant-v0.c: Ditto.
* tests/data/test-abidiff-exit/test-leaf-stats-v0.cc: Ditto.
* tests/data/test-abidiff-exit/test-leaf-cxx-members-v0.o: Recompiled.
* tests/data/test-abidiff-exit/test-leaf-cxx-members-v1.o: Ditto.
* tests/data/test-abidiff-exit/test-leaf-fun-type-v0.o: Ditto.
* tests/data/test-abidiff-exit/test-leaf-fun-type-v1.o: Ditto.
* tests/data/test-abidiff-exit/test-leaf-more-v0.o: Ditto.
* tests/data/test-abidiff-exit/test-leaf-more-v1.o: Ditto.
* tests/data/test-abidiff-exit/test-leaf-peeling-v0.o: Ditto.
* tests/data/test-abidiff-exit/test-leaf-peeling-v1.o: Ditto.
* tests/data/test-abidiff-exit/test-leaf-redundant-v0.o: Ditto.
* tests/data/test-abidiff-exit/test-leaf-redundant-v1.o: Ditto.
* tests/data/test-abidiff-exit/test-leaf-stats-v0.o: Ditto.
* tests/data/test-abidiff-exit/test-leaf-stats-v1.o: Ditto.
Signed-off-by: Giuliano Procida <gprocida@google.com>
This change:
- makes local variables const where possible
- gives local variables more descriptive names
- factors out some more expressions as local variables
- simplifies the logic around anonymous data members
There are no behavioural changes.
* src/abg-reporter-priv.cc (represent): In the var_diff_sptr
overload, rename pretty_representation to o_pretty_representation,
introduce n_pretty_representation where needed and replace the
duplicate tr1 and tr2 with these; rename all other variables foo1
and foo2 to o_foo and n_foo respectively, using _type instead of
_t; introduce o_anon and n_anon and use them to make the local
variable is_strict_anonymous_data_member_change const, make
ABG_ASSERT in anonymous data member handling more obvious in the
case where anonymity has changed and allow simplification of
formatting in this case; move declarations of const local
variables above those of the non-const, state-tracking, variables.
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Data members have names (unless anonymous), types, sizes and
offsets (if a member of a class or struct). It is the responsibility
of the represent function to detail all differences of a changed
member. The size of a member is the same as the size of its type.
A recent change to the function focused on cleaning up the formatting
logic and added a catch-all case to the end of it in case no diff
information had been emitted by then.
This catch-all triggered for anonymous structs and union diffs under
certain circumstances when these anonymous members had changed in
size.
This patch ensures size change information for a member is emitted
exactly once (unless the type change has been or is being reported
already). It also ensures anonymous members are identified
appropriately and includes a test case would otherwise reach the
catch-all case in both default and --leaf-changes-only modes.
* src/abg-reporter-priv.cc (represent): In the var_diff_sptr
overload, factor out some expressions as local variables, rely
on diff_to_be_reported to decide whether to emit a change,
fold together local/non-local change reporting using
local_changes to preserve current name formatting differences,
keep track explicitly of whether size information has been
emitted and ensure it happens if needed, make offset and size
change reporting for anonymous data members more meaningful.
* tests/test-abidiff-exit.cc: Run new test cases.
* tests/data/Makefile.am: Add new test files.
* tests/data/test-abidiff-exit/test-member-size-v0.cc: New
test.
* tests/data/test-abidiff-exit/test-member-size-v0.o: Ditto.
* tests/data/test-abidiff-exit/test-member-size-v1.cc: Ditto.
* tests/data/test-abidiff-exit/test-member-size-v1.o: Ditto.
* tests/data/test-abidiff-exit/test-member-size-report0.txt:
New test, default mode.
* tests/data/test-abidiff-exit/test-member-size-report1.txt:
New test, --leaf-changes-only mode.
* tests/data/test-abidiff-exit/test-leaf-cxx-members-report.txt:
Eliminate duplicate reporting of member sizes.
* tests/data/test-abidiff-exit/test-leaf-more-report.txt: Ditto.
* tests/data/test-abidiff-exit/test-leaf-peeling-report.txt:
Ditto.
* tests/data/test-abidiff-exit/test-no-stray-comma-report.txt:
Ditto.
* tests/data/test-diff-dwarf/test45-anon-dm-change-report-0.txt:
Add size report for anonymous data member.
* tests/data/test-diff-filter/test44-anonymous-data-member-report-0.txt:
Ditto.
* tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt:
Add missing size change report.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: Remove
size change report for previously reported type.
* tests/data/test-diff-suppr/test46-PR25128-report-1.txt:
Eliminate duplicate reporting of member size change.
* tests/data/test-diff-suppr/test46-PR25128-report-2.txt:
Ditto.
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In both the default and leaf reporting modes, when there is a repeated
or circular reference to a type difference of a member variable, some
placeholder text is emitted instead.
In the leaf reporter:
type 'struct S' of 'foo::bar' changed as reported earlier
In the default reporter, this spans two lines:
type of 'S foo::bar' changed:
details were reported earlier
This patch changes the latter to the more compact:
type of 'S foo::bar' changed, as reported earlier
More generally, this patch makes the punctuation of such placeholder
text more consistent with a comma separating the phrases in all cases.
It doesn't attempt to reconcile the different formatting of member
variable declarations between the two modes.
* src/abg-reporter-priv.cc (represent): In the var_diff_sptr
overload, use consistent punctuation and keep to a single line
of output when referring back to an existing type diff report.
Remove unnecessary braces around single line conditional
blocks.
* src/abg-reporter-priv.h: In the macro
RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER, use
consistent punctuation when referring back to an existing type
diff report.
* tests/data/test-abidiff/test-PR18791-report0.txt: Adjust
formatting of back references to existing type diff reports.
* tests/data/test-diff-dwarf/PR25058-liblttng-ctl-report-1.txt:
Ditto.
* tests/data/test-diff-filter/test16-report-2.txt: Ditto.
* tests/data/test-diff-filter/test17-1-report.txt: Ditto.
* tests/data/test-diff-filter/test25-cyclic-type-report-1.txt:
Ditto.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt:
Ditto.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: Ditto.
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tests/test-abidiff-exit.cc: Drop obsolete --redundant flag
and comment as --redundant is now implied by
--leaf-changes-only.
Signed-off-by: Giuliano Procida <gprocida@google.com>
The files tests/data/test-abidiff-exit/test-leaf[0-3]-* were
introduced in a series of changes. Numbering rather than naming the
tests turned out to be a bad choice: it caused confusion when
dealing with merge conflicts due to reordering of commits.
This patch renames the tests to give them more descriptive names,
which is good practice anyway.
* tests/data/Makefile.am: Rename test files.
* tests/test-abidiff-exit.cc: Rename test files.
* tests/data/test-abidiff-exit/test-leaf-fun-type-report.txt:
Renamed from test-leaf2-report.txt.
* tests/data/test-abidiff-exit/test-leaf-fun-type-v0.cc:
Renamed from test-leaf2-v0.cc.
* tests/data/test-abidiff-exit/test-leaf-fun-type-v0.o:
Renamed from test-leaf2-v0.o.
* tests/data/test-abidiff-exit/test-leaf-fun-type-v1.cc:
Renamed from test-leaf2-v1.cc.
* tests/data/test-abidiff-exit/test-leaf-fun-type-v1.o:
Renamed from test-leaf2-v1.o.
* tests/data/test-abidiff-exit/test-leaf-more-report.txt:
Renamed from test-leaf1-report.txt.
* tests/data/test-abidiff-exit/test-leaf-more-v0.cc: Renamed
from test-leaf1-v0.cc.
* tests/data/test-abidiff-exit/test-leaf-more-v0.o: Renamed
from test-leaf1-v0.o.
* tests/data/test-abidiff-exit/test-leaf-more-v1.cc: Renamed
from test-leaf1-v1.cc.
* tests/data/test-abidiff-exit/test-leaf-more-v1.o: Renamed
from test-leaf1-v1.o.
* tests/data/test-abidiff-exit/test-leaf-redundant-report.txt:
Renamed from test-leaf3-report.txt.
* tests/data/test-abidiff-exit/test-leaf-redundant-v0.c:
Renamed from test-leaf3-v0.c.
* tests/data/test-abidiff-exit/test-leaf-redundant-v0.o:
Renamed from test-leaf3-v0.o.
* tests/data/test-abidiff-exit/test-leaf-redundant-v1.c:
Renamed from test-leaf3-v1.c.
* tests/data/test-abidiff-exit/test-leaf-redundant-v1.o:
Renamed from test-leaf3-v1.o.
* tests/data/test-abidiff-exit/test-leaf-stats-report.txt:
Renamed from test-leaf0-report.txt.
* tests/data/test-abidiff-exit/test-leaf-stats-v0.cc: Renamed
from test-leaf0-v0.cc.
* tests/data/test-abidiff-exit/test-leaf-stats-v0.o: Renamed
from test-leaf0-v0.o.
* tests/data/test-abidiff-exit/test-leaf-stats-v1.cc: Renamed
from test-leaf0-v1.cc.
* tests/data/test-abidiff-exit/test-leaf-stats-v1.o: Renamed
from test-leaf0-v1.o.
Signed-off-by: Giuliano Procida <gprocida@google.com>
Since the recent sourceware infrastructure refresh the management of
the mailing list moved to mailman. So the form we use to register to
the mailing list changed as well. I have updated the information on
the web page to reflect that.
* doc/website/mainpage.txt: Use the form at
https://sourceware.org/mailman/listinfo/libabigail to register to
the mailing list.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The DWARF reader could divide by zero when emitting statistics about
late canonicalisation of types. This is undefined behaviour but
typically results in process termination.
* src/abg-dwarf-reader.cc (perform_late_type_canonicalizing):
If total is zero, don't try to output percentages using it as
a divisor.
Signed-off-by: Giuliano Procida <gprocida@google.com>
The file tests/data/test-diff-pkg/dirpkg-2-report-1.txt looks like it
was committed in error. It's not used, its contents don't match the
implied directories being compared and there are other tests that
cover the same functionality, with or without --no-abignore, anyway.
* tests/data/Makefile.am: Removed
tests/data/test-diff-pkg/dirpkg-2-report-1.txt.
* tests/data/test-diff-pkg/dirpkg-2-report-1.txt: Removed.
Signed-off-by: Giuliano Procida <gprocida@google.com>
Commit 79383f937c added many tests but
didn't actually execute three of them.
Commit fe9fa7a05f added many tests but
didn't actually execute one of them.
This patch corrects these issues.
* tests/test-diff-suppr.cc: Add stanzas for
test6-fn-suppr-report-4, test16-suppr-removed-fn-report-5 and
test22-suppr-removed-var-sym-report-5 and
test23-alias-filter-report-4 tests.
* tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt:
Number parameters from 1 and update expected output to current
formatting.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-5.txt:
Update expected output to current formatting.
* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-5.txt:
Update expected output to current formatting.
Signed-off-by: Giuliano Procida <gprocida@google.com>
This patch removes perhaps the last remaining cause of double blank
lines in output.
The state variable emit_nl was being set to true just after emitting a
new line which resulted in a blank line after every local typedef
change report.
* include/abg-reporter.h
(default_reporter::report_local_typedef_changes): Change
return type to void.
* src/abg-default-reporter.cc:
(default_reporter::report_local_typedef_changes): Change
return type to void, remove emit_nl state variable and logic.
* tests/data/test-abidiff/test-PR18791-report0.txt: Remove
blank lines.
* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt:
Ditto.
* tests/data/test-diff-suppr/test39-opaque-type-report-0.txt:
Ditto.
Signed-off-by: Giuliano Procida <gprocida@google.com>
The code in abg-ir.cc that calculated the memory size of an array
summed, rather than multiplied, the dimensions. It also did duplicate
work for each dimension after the first.
Existing code in abg-reader.cc asserted that array size information
read from XML match freshly calculated values.
This patch corrects the calculation, eliminates the duplicate work and
updates the XML reader validation to just emit a warning if old bad
array size information is found.
* include/abg-ir.h (array_type_def::append_subrange): Remove
this function.
* src/abg-ir.cc (array_type_def::set_element_type): Add a note
about safe usage.
(array_type_def::append_subrange): Inline this function into
its only caller append_subranges and remove it.
(array_type_def::append_subranges): Do correct multiplicative
calculation of multidimensional array sizes.
* src/abg-reader.cc (build_array_type_def): When checking
calculated against read array sizes, warn once if value
matches old behaviour rather than raising an assertion.
Otherwise, before raising an assertion, emit an informative
error message.
* tests/data/test-annotate/test14-pr18893.so.abi: Correct
array sizes.
* tests/data/test-annotate/test17-pr19027.so.abi: Ditto.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Ditto.
* tests/data/test-annotate/test7.so.abi: Ditto.
* tests/data/test-diff-dwarf/test10-report.txt: Ditto.
* tests/data/test-diff-dwarf/test11-report.txt: Ditto.
* tests/data/test-read-write/test25.xml: Ditto.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
These blank lines break up the output unexpectedly and often cause
double blank lines after reporting of function changes.
* src/abg-default-reporter.cc: (report_local_function_type_changes):
Remove unnecessary blank lines after lists of parameter changes.
* tests/data/test-*/test*report*.txt: Remove blank lines after
parameter change lists in 12 files.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
In --leaf-changes-only mode, the report currently has 2 blank lines
after each type-diff section. This patches changes this to 1.
* src/abg-leaf-reporter.cc: (report_diffs) Emit 1 instead of 2
new lines between sections.
* tests/data/test-abidiff-exit/test-leaf-peeling-report.txt:
Replace double blank lines with single ones.
* tests/data/test-diff-filter/libtest45-basic-type-change-report-1.txt:
Ditto.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: Ditto.
* tests/data/test-*/test*report*.txt:: Ditto.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
The represent(var_diff_sptr) function tracks vertical "\n" and
horizontal ", " spacing using two state variables:
- emitted - the main diff text has been emitted
- begin_with_and - main text emitted && new line started, so
any further description must be indented and prefixed "and ".
- if emitted is true and begin_with_and is false, then further
description is prefixed with ", " instead.
There was some inconsistent emission of new lines and maintenance of
the state variables. This patch documents the variables and makes sure
new lines and state variables are kept in sync.
Finally, it is theoretically possible to reach the end of the function
without emitted becoming true. This patch adds a TODO and makes sure
at least something is output should that ever happen.
* src/abg-reporter-priv.cc: (represent) In the var_diff_sptr
overload, make sure the state variables begin_with_and and
emitted are updated consistently; add a TODO for one case
which may result in the end of the function being reached
without having emitted a report; add missing new lines
following reporting of anonymous member changes; only emit a
final new line if begin_with_and hasn't tracked one already;
document state variables.
* tests/data/test-diff-dwarf/test45-anon-dm-change-report-0.txt:
Add missing blank line after anonymous member change text.
* tests/data/test-diff-filter/test44-anonymous-data-member-report-1.txt:
Add missing "and " continuation.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Currently, lists of member function deletions, additions and changes
are each followed by a blank line in abidiff output.
While this formatting works reasonably well in leaf-changes-only mode
for top-level changes to types, it is inconsistent with everthing
else. In particular, when reporting member function diffs in default
mode, or more deeply nested in leaf mode, the blank lines are
jarring.
There was also no test coverage for leaf-changes-only mode.
This change removes these blank lines and associated state variables
and logic. It adds a test case for leaf-changes-only mode.
Note that the patch also modifies default mode reporting of member
types, template member functions and template member classes
analogously, but I wasn't able to exercise those code paths.
* src/abg-default-reporter.cc (report): In the
class_or_union_diff overload, don't emit a new line after each
list of member function, member type, template member
function and template member class changes.
* src/abg-leaf-reporter.cc (report): : In the
class_or_union_diff overload, don't emit a new line after each
list of member function changes.
* tests/data/Makefile.am: Add new test case files.
* tests/data/test-abidiff-exit/test-leaf-cxx-members-v0.cc:
New test case for --leaf-changes-only member function diffs.
* tests/data/test-abidiff-exit/test-leaf-cxx-members-v0.o:
Ditto.
* tests/data/test-abidiff-exit/test-leaf-cxx-members-v1.cc:
Ditto. Also add a TODO regarding a potentially bad diff.
* tests/data/test-abidiff-exit/test-leaf-cxx-members-v1.o:
Ditto.
* tests/data/test-abidiff/test-struct1-report.txt: Remove
blank lines after member function changes lists.
* tests/data/test-diff-dwarf/test41-PR20476-hidden-report-0.txt:
Ditto.
* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt:
Ditto.
* tests/test-abidiff-exit.cc: Add new test case.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
There was a spurious new line at the end of reporting enum diffs,
before reporting impacted interfaces, if requested.
* src/abg-default-reporter.cc (report): In the enum_diff
overload, don't emit a blank line before a possible "impacted
interfaces" stanza. In the class_or_union overload, change a
stray conditional to use the emitted state variable for
consistency.
* tests/data/test*report*.txt: Remove blank lines after enum
diffs in 17 files.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
This patch removes the blank line emitted after base class diffs.
These are jarring, particularly when the diffs are nested.
* src/abg-default-reporter.cc (report): In the class_diff
overload, eliminate the extra blank line after base class
changes and remove unneeded new line logic.
* tests/data/test*report*.txt: Remove blank lines after base
class diffs in 9 files.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Some blank lines were unintentionally removed with a recent patch. The
new line to remove should have been the one after all changed
functions not the one after each one. Changed functions (and
variables) tend to be reported as paragraphs, rather than single
lines, so the extra spacing is useful.
This patch removes the blank line emitted after all changed
functions, variables and unreachable types, and adds back the
missing blank lines between changed functions.
* src/abg-default-reporter.cc (report): In the corpus_diff
override, add back the extra blank line per changed function
but remove the extra one after all changed changed functions
and variables; comment these.
* src/abg-leaf-reporter.cc (report): In the corpus_diff
override, add back the extra blank line per changed function
but remove the extra one after all changed changed functions
and variables; comment these.
* src/abg-reporter-priv.cc
(maybe_report_unreachable_type_changes): Remove extra blank
line emitted after all unreachable type changes; comment
this.
* tests/data/test*report*.txt: Remove/add blank lines.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
This is a follow-up to a recent commit. This patch adds more tests, as
suggested by a reviewer.
* src/abg-ir.cc (types_have_similar_structure): Update TODO
regarding structure of arrays - multidimensional arrays are
the issue.
* tests/data/test-abidiff-exit/test-leaf-peeling-report.txt:
Updated following changes.
* tests/data/test-abidiff-exit/test-leaf-peeling-v0.cc: Add
more cases (see below).
* tests/data/test-abidiff-exit/test-leaf-peeling-v0.o:
Updated.
* tests/data/test-abidiff-exit/test-leaf-peeling-v1.cc: Add
comment about a potential change to local-change semantics;
add test cases to demonstrate that * and & and * and *** are
structurally different; add a TODO regarding multidimensional
arrays where changes are sometimes missed in leaf mode.
* tests/data/test-abidiff-exit/test-leaf-peeling-v1.o
Signed-off-by: Giuliano Procida <gprocida@google.com>
Following commit 474ad38f, we need to update the test reference output
tests/data/test-abidiff-exit/test-leaf-peeling-report.txt.
* tests/data/test-abidiff-exit/test-leaf-peeling-report.txt:
Update output.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This is another round of moving responsibility for generation of new
lines into functions and getting rid of redundant new lines.
* src/abg-default-reporter.cc (report) In the
class_or_union_diff overload, don't emit a new line after
calls to represent. In the union_diff overload, emit a new
line after a from/to change; fix indentation. In the
corpus_diff overload, don't emit an extra new line after
reporting a diff.
* src/abg-leaf-reporter.cc (report_diffs) Don't emit a new
line after reporting a canonical diff. In the
class_or_union_diff overload, don't emit a new line after
calls to represent. In the corpus_diff overload, don't emit an
extra new line after reporting a diff.
* src/abg-reporter-priv.cc (represent): Emit a final new line,
but only if needed.
(maybe_report_interfaces_impacted_by_diff): Emit a new line
after the last impacted interface.
* tests/data/test-*/*report*.txt: Remove blank lines (and add
a missing one) to 77 test cases.
This function is used to determine whether or not type differences are
"local" and is primarily used in --leaf-changes-only mode. The logic
has some issues which are addressed by this patch:
- Any number of points-to (*) and refers-to (& and &&) components
are peeled off the types being compared, rather than checking
these match in number and kind.
- This peeling is done with peel_typedef_pointer_or_reference_type
which also peels any number of CV qualifiers (OK) and
array-of ([N]) type components (not OK).
- The function sets a state variable (was_indirect_type) to modify
the behaviour of downstream comparisons, but this cannot be
passed through recursive calls.
The effect of the indirect_type flag is to switch to comparisons by
name: identically named structs don't get introspected. Arguably, a
more useful behaviour for --leaf-changes-only mode would be to treat
any change to a named type as non-local, except in the context of the
definition of that type itself. This would be a more significant
change in behaviour.
* include/abg-fwd.h (types_have_similar_structure): In both
overloads, add an indirect_type argument, defaulting to
false.
* src/abg-ir.cc (reference_type_def constructor): Tabify.
(types_have_similar_structure): In both overloads, add an
indirect_type argument and update documentation text. In the
type_base_sptr overload, pass indirect_type in the tail
call. In the type_base* overload, replace was_indirect_type
with indirect_type; peel CV qualifiers and typedefs without
testing as the peel function does this; replace the
indiscriminate peeling of qualifier/pointer/reference/array
type components with code that checks the same
pointer/reference/array type component is used on each side
and makes recursive calls with indirect_type set to true; pass
the indirect_type argument recursively when comparing other
subtypes; move the typeid check earlier, document its purpose
and remove unneccessary checks after later dynamic casts;
remove an always-true conditional; add a TODO for comparing
array types more accurately.
* tests/data/Makefile.am: Add new test case files.
* tests/data/test-abidiff-exit/test-leaf-peeling-v0.cc: New
test case.
* tests/data/test-abidiff-exit/test-leaf-peeling-v1.cc: Ditto.
* tests/data/test-abidiff-exit/test-leaf-peeling-report.txt:
Ditto.
* tests/test-abidiff-exit.cc: Run new test case.
Signed-off-by: Giuliano Procida <gprocida@google.com>
There is an instance of a if-statement testing the same variable as
its containing if-statement. The inner test always evaluates to true,
if it is reached.
* src/abg-ir.cc (types_have_similar_structure): Remove
identical nested conditional.
(reference_type_def::reference_type_def): Tabify.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
The various peel_*_type functions are supposed to return either an
underlying type (when something can be "peeled") or the original
type (when not).
This overload of peel_typedef_type currently returns null if the type
isn't a typedef. This patch corrects this.
The bug hasn't bitten as all existing calls are protected by an
is_typedef check. Note that the recursive calls within the function
are to the other (const type_base_sptr&) overload.
* src/abg-ir.cc (peel_typedef_type): In the const type_base*
overload, return the original argument rather than null if the
type isn't actually a typedef.
Signed-off-by: Giuliano Procida <gprocida@google.com>