* include/abg-diff-utils.h (compute_middle_snake): After the
overlap determination happened, finding the middle snake can
require keep on building the current path until the "end". The
end meaning reaching the max of D. And that max is (M + N)/2 + 1.
In the extreme cases were middle snake was on the very last step
(M + N) + 1, we were not finding the middle snake. Fix this.
(compute_diff): When d == 1 and the first edge on the edit graph
is a non-diagonal edge and when a_base != a_begin, we were failing
to properly initialize x,y to find that non-diagonal edge. Also
we were failing to correctly compute the size of the sequence.
Fix these.
* tests/test-core-diff.cc: Add a new regression test for the two
cases above.
* tests/data/test-core-diff/report7.txt: New reference data for
the new regression test.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h (class scope_diff): New type.
(compute_diff(scope_decl_sptr, scope_decl_sptr, scope_diff)): New
declaration.
(report_changes): New declaration.
* src/abg-comparison.cc (struct scope_diff::priv): Define.
(scope_diff::{clear_lookup_tables, lookup_tables_empty,
ensure_lookup_tables_populated, scope_diff, member_changes,
deleted_member_at, inserted_member_at, changed_types,
changed_decls}): Define these new member functions.
(compute_diff): Define.
* include/abg-ir.h (decl_base_sptr): New typedef.
(operator==(decl_base_sptr, decl_base_sptr)): Declare new
operator.
* src/abg-ir.cc (operator==(decl_base_sptr, decl_base_sptr)):
Define.
(scope_decl::{operator==, traverse}): Adjust for using vectors to
store scope members now, rather than lists.
(scope_decl::{declarations, scopes}): Make these types be vector.
This makes the members of a scopes be vector, rather than lists.
This enables them to be diffed.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-diff-utils.h (insertion::inserted_): Changed the
type of this from vector<int> to vector<unsigned>.
(insertion::{insertion, inserted_indexes}): Adjust.
(compute_diff): Add two new simpler overloads. Implement them in
term of the former more complex overload.
(compute_lcs): Adjust for the vector<int> -> vector<unsigned>
change.
* src/abg-diff-utils.cc (compute_lcs, compute_ses): Adjust for the
compute_diff change above.
* src/abg-comparison.cc (compute_diff, report_changes): Adjust for
the compute_diff & vector<unsigned> changes above..
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (class scope_decl): Add end of class comment.
(class type_base): Add a _sptr typedef and end of class comment.
* src/abg-ir.cc (operator==(class_decl_sptr, class_decl_sptr)):
Fix comment.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (decl_base::get_qualified_name): New
declaration.
(class_decl::{base_specs, member_types, data_members,
member_functions, member_function_templates,
member_class_templates}): Make all these containers be vectors,
rather than list. This makes these containers (like
class_decl::base_specs, class_decl::member_types, etc) be suitable
to be used by the core diffing algorithms to diff their content.
(operator==(class_decl_sptr, class_decl_sptr))
(operator==(class_decl::member_type_sptr, class_decl::member_type_sptr))
(operator==(class_decl::base_spec_sptr,
class_decl::base_spec_sptr))
(operator==(class_decl::data_member_sptr,
class_decl::data_member_sptr))
(operator==(class_decl::member_function_sptr,
class_decl::member_function_sptr))
(operator==(class_decl::member_function_template_sptr,
class_decl::member_function_template_sptr))
(operator==(class_decl::member_class_template_sptr,
class_decl::member_class_template_sptr)): Declare
these new equality operators. These are to be used by the core
diffing algorithms when comparing two vectors of shared pointers
of members of class_decls.
* src/abg-ir.cc (decl_base::get_qualified_name): Define.
(class_decl::class_decl, class_decl::operator==(class_decl&)): Adjust for the
containers type change to a vector.
(operator==(class_decl_sptr, class_decl_sptr))
(operator==(class_decl::member_type_sptr, class_decl::member_type_sptr))
(operator==(class_decl::base_spec_sptr,
class_decl::base_spec_sptr))
(operator==(class_decl::data_member_sptr,
class_decl::data_member_sptr))
(operator==(class_decl::member_function_sptr,
class_decl::member_function_sptr))
(operator==(class_decl::member_function_template_sptr,
class_decl::member_function_template_sptr))
(operator==(class_decl::member_class_template_sptr,
class_decl::member_class_template_sptr)): Define
these.
* include/abg-comparison.h (diff::scope_): Remove
(diff::{first_scope_, second_scope_}): New members.
(class_decl_diff::class_decl_diff): Pass the new scopes to this
constructor.
(class_decl_diff::{first_class_decl, second_class_decl})
(report_changes): New declarations.
* src/abg-comparison.cc (class_decl_diff::class_decl_diff): Update
as per the declaration.
(class_decl_diff::{first_class_decl, second_class_decl}): Define
as per the declaration.
(compute_diff): Initial implementation for this.
(report_changes): Define.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h (diff::changes_type):
Remove this typedef.
(class_decl_diff::data_members_changes): Rename
class_decl_diff::data_member_changes into this.
(class_decl_diff::member_fn_tmpls_changes): Renamed
class_decl_diff::member_fn_tmpl_changes into this.
(class_decl_diff::member_class_tmpls_changes): Renamed
class_decl_diff::member_class_tmpl_changes into this.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these declarations for the use of edit_script.
* src/abg-comparison.cc (class_decl_diff::priv::*): Likewise.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these definitions for the above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h: Lots of useless white space removals and
comments adding.
(class class_decl::member_base): Fix comment.
* src/abg-hash.cc: Lots of useless white space removals too.
* src/abg-ir.cc: Remove useless white space too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-diff-utils.h (point::{operator!=,operator==}): New
operators.
(end_of_fr_d_path_in_k, end_of_frr_d_path_in_k_plus_delta): Allow
the initial point (-1,-1) that is not a point addressing elements
of the input sequences, but that is the starting point of the
forward paths and the ending point of reverse paths in the "Linear
Refinement" of the algorithm.
(is_match_point, maybe_record_match_point)
(find_snake_start_point): New functions.
(find_last_snake_in_path): Remove this. It's not used anymore.
(compute_middle_snake): Allow checking for overlapping paths even
on points that are outside of the edit graph boundaries. Once the
overlap is detected, if a non-empty snake has been seen already,
report it as the middle snake. Otherwise, keep building the path
until the end and report the last snake encountered as the middle
snake. Add comments.
(compute_diff): For the d == 1 case, fix the logic of the finding
the non-diagonal edge. Fix typos. Add comments.
(display_edit_script): Fix report glitches.
* tests/data/test-core-diff/report3.txt: Update as per the report
glitch above.
* tests/data/test-core-diff/report4.txt: Likewise.
* tests/data/test-core-diff/report5.txt: Likewise.
* tests/data/test-core-diff/report6.txt: New reference report for
a new test.
* tests/test-core-diff.cc: Add a new test for negative delta.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tests/test-diff2.cc: New command line testing facility.
* tests/Makefile.am: Add this to the build system.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* diff2.h (point::point): New copy constructor.
(point::{operator+=, operator=}): Use point::set.
(point::{operator--, operator++,}): New operators.
(d_path_vec::{a_size_, b_size_}): New members.
(d_path_vec::max_d_): Remove this member.
(d_path_vec::max_d): Compute this, now that max_d_ was removed.
(point_is_valid_in_graph): Declare this new function.
(end_of_fr_d_path_in_k, ): Return
a bool when the end of furthest reaching past found is within the
bounds of the edit graph. Add comments.
(end_of_frr_d_path_in_k_plus_delta): Likewise. Also, delta can be
negative; support that. Do not cross the boundaries of the edit
graph when following a diagonal edge.
(find_last_snake_in_path): New function.
(compute_middle_snake): Make forward/reverse d_path_vec be big
enough to hold paths for M+N differences. Normally M+N/2 should
be enough, but we were getting weird out of bound errors. Let's
handle it this way for now. Do not require that we check for
overlap only when we are on a diagonal edge. Once we detected an
overlap, use the new find_last_snake_in_path to find the
boundaries of the snake.
(ses_len): Delta can be negative.
(display_edit): Small minor English nit.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-diff-utils.h: New file.
* src/abg-diff-utils.cc: Likewise. Implement the code diffing
algorithms from Eugene Myers.
* include/abg-comparison.h: New file. First short at defining the
basic APIs to compute the diff of two classes.
* src/abg-comparison.cc: New file. Start the implementation of
the above header.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (node_visitor_base): Renamed ir_node_visitor
into this.
* include/abg-traverse.h (struct node_visitor_base): New base for
the visitors.
(struct traversable_base): Update comments.
(traversable_base::traverse): Change this into non-pure virtual.
Make it take a reference to node_visitor_base, rather than a
reference to ir_node_visitor.
* src/abg-traverse.cc (traversable_base::traverse): New empty
default implementation.
* include/abg-ir.h: Make ir_node_visitor inherit from new
node_visitor_base.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tests/test-utils.h (is_dir, ensure_dir_path_created)
(ensure_parent_dir_created): Move these directories manipulation
utilities from here to ...
* tools/abg-tools-utils.h (is_dir, ensure_dir_path_created)
(ensure_parent_dir_created): ... here in this new file.
(dir_name, base_name): Declare these new functions.
* tests/test-utils.cc (is_dir, ensure_dir_path_created)
(ensure_parent_dir_created): Likewise, move these to ...
* tools/abg-tools-utils.cc (is_dir, ensure_dir_path_created)
(ensure_parent_dir_created): ... here in this new file.
(dir_name, base_name): Define these.
* tools/Makefile.am: New file. Create a new libtoolsutils.la
static library with stuff from tools/abg-tools-utils.cc in it.
Also create a new 'biar' program with the stuff from the new
tools/biar.cc in it.
* tools/biar.cc: New file. Contains the code for the new "biar"
archive manipulation command line utility.
* tests/test-read-write.cc (main): Adjust for the change about
ensure_parent_dir_created above.
* tests/test-write-read-archive.cc (main): Likewise.
* Makefile.am (SUBDIRS): Add the new tools/ sub-directory to the
build system.
* configure.ac (AC_CONFIG_FILES): Generate tools/Makefile.
* tests/Makefile.am: Make libtestutils.la link with the new
libtoolsutils.la. Make sure to express the dependencies between
libtestutils.la and the binaries that depend on it. Otherwise
parallel builds can go awry.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-corpus.h (abigail::corpus::{translation_unit_sptr,
translation_units): Do not define these typedefs here. Rather)
(define them ...
* include/abg-ir.h
(abigail::{translation_units,translation_unit_sptr): ... here.
This is because a translation unit can be manipulated
independently from an abi corpus.
* src/abg-corpus.cc (corpus::get_translation_units): Adjust return
type to comply with the change above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-corpus.h: Drop incomplete abg-traverse.h and
abg-fwd.h. Use abg-ir.h proper and be done with it. Users of the
library will just have to use abg-corpus.h to manipulate and the
archives and the IR they contain.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-writer.cc (translation_unit::write): Add an error
message to stderr if something ultimately went wrong.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-corpus.h (corpus::{get_path, set_path): Renamed
corpus::get_file_path and corpus::set_file_path into these as
get_path/set_path is what is used elsewhere as well.
* src/abg-corpus.cc (corpus::{get_path, set_path}): Likewise.
* tests/test-write-read-archive.cc (main): Adjust for the change
above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* configure.ac: Support detection of libzip dependency. Define
new DEPS_CFLAGS and DEPS_LIBS variables for use in
Makefile.am to refer to the dependency headers and
libraries.
* doc/website/mainpage.txt: Update this to talk about the new
libzip dependency.
* include/Makefile.am: Add abg-libzip-utils.h to the build system.
* include/abg-corpus.h (corps): Hide abigail::corpus's private behind a
pimpl idiom.
(corpus::{drop_translation_units, get_file_path, set_file_path,
write, read}): New methods.
* include/abg-libxml-utils.h (new_reader_from_buffer): Declare new
function.
* include/abg-libzip-utils.h: New file.
* src/Makefile.am: Add abg-corpus.cc and abg-libzip-utils.cc to
the build system. Refer to the library and headers dependencies
via the new DEPS_LIBS and DEPS_CFLAGS variables.
* src/abg-corpus.cc: New file.
* src/abg-ir.cc (translation::set_path): New method.
* src/abg-libxml-utils.cc (new_reader_from_buffer): Define new
function.
* src/abg-libzip-utils.cc: New file.
* src/abg-reader.cc (translation_unit::read): New overload.
* src/abg-writer.cc: Inject the names from the std namespace into
the abigail namespace, rather than into abigail::writer.
(abigail::translation_unit::write): New overload. This can now
use ofstream and the other stuff from std that are injected in the
abigail:: namespace.
* tests/Makefile.am: Add tests/test-write-read-archive.cc to the
build system; use that to build runtestwritereadarchive. Also add
the input test data from
tests/data/test-write-read-archive/test[0-4].xml.
* /tests/data/test-write-read-archive/test[0-4].xml: New test
input data files.
* tests/test-write-read-archive.cc: New test for this archive
write/read support.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/Makefile.am: Pass absolute file paths to the compiler during
the build. This helps in e.g in emacs' compilation mode, when the
output shows an error reported by GCC's diagnostics, setting point
to the error line and hitting 'enter' transports the user to the
file location where the error happened; as the file path is nows
absolute, emacs can always find it. Otherwise, finding it depends
on $PWD and whatnot.
* tests/Makefile.am: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h: Move location, location_manager and
translation_unit in the ir section. Remove stuff that was
commented out anyway.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-corpus.h: Move location location_manager,
translation_unit from here ...
* include/abg-ir.h: ... to here. The reason being that these are
really constructs of the Internal Representation of the ABI/API of
a translation unit. What is left in abg-corpus is really
exclusively related to an ABI Corpus, which I see more as a
"packaging" construct that abstracts the bundling of several
translation units together. Also, I fixed some comments about the
location/location_manger types; now a location is made specific to
a translation unit; to an abi corpus. A location of a given
translation unit has to be decoded by the location manager of that
same translation unit.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/Makefile.am: Add abg-version.h.in to the source
distribution.
* configure.ac: Generate abg-version.h in using the existing
AC_CONFIG_FILES macro call.
* libabigail.pc.in: New pkgconfig file.
* configure.ac: Define the LIBXML2_VERSION variable that is used
in the libabigail.pc.in file. Generate the libabigail.pc file
from its libabigail.pc.in template.
* Makefile.am: Add libabigail.pc.in to the source distribution.
Install the generated libabigail.pc to the right destination.
* doc/website/mainpage.txt: New file representing the input for
the website.
* doc/website/libabigail-website.doxy: New file representing the
doxygen configuration for the website generation.
* doc/api/libabigail.doxy: Output doxygen generation warnings into
a file.
* doc/Makefile.am: Support generating the website from doxygen.
Update the api generation relevant macros names for better
consistency. Make "make html" generate the website too. Make
"make clean" erase the website bits too. Add a 'website'
target to make the website.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* Makefile.in: Remove this autotools-generated file. I know that
people in the GCC-realm like storing these autotools-generated
files into the source control system, but I believe in this day
and age, this is annoying (to say the least) for the project
developers for no good reason. Requiring (the ubiquitous)
autoconf for building from source is no big deal today, and typing
"autoreconf" is not hard to do, really. And it saves the
developers for having to update a bunch of boilerplate
automatically generated files into the source control system; this
is really unnecessary noise and it is a commonly accepted good
practice to avoid doing it these days. To help people who do not
know how to handle this, there is a COMPILING file in the source
tree that explains how to build the project from sources.
* aclocal.m4: Likewise.
* configure: Likewise.
* include/Makefile.in: Likewise.
* src/Makefile.in: Likewise.
* doc/Makefile.in: Likewise.
* tests/Makefile.in: Likewise.
* include/abg-ir.h (traversable): To traversable_base.
(decl_base): Inherit from traversable_base.
(decl_base::traverse): Null definition.
(function_decl, etc.): Remove traversable_base as base class.