gnu/texinfo/c7f833350aa1b68cab6db6e1790b06bbe436e9cf Register error messages during destruction, for refcounts warnings
* tta/perl/Texinfo/Convert/Converter.pm (destroy),
tta/perl/Texinfo/Document.pm (destroy_document): do not undef
the reference when destroying some data and removing cycles to prepare
for full removal, as the caller may still have some use for the
remaining data and methods. In practice to be able to call the
method to retrieve error messages messages registered during
converter or document destruction after calling the method doing the
destruction.
* tta/perl/Texinfo/Convert/Converter.pm (reset_converter): pass
a debugging warning message when the refcounts are not correct,
such that this is visible in the tests.
* tta/perl/Texinfo/Convert/HTML.pm (converter_destroy),
tta/perl/Texinfo/Document.pm (remove_document_references),
tta/perl/Texinfo/ManipulateTree.pm (tree_remove_references):
pass a document as check_refcount tree_remove_references argument, and
use it to pass a debugging warning message when the refcounts are not
correct, such that this is visible in the tests.
* tta/C/main/build_perl_info.c (pass_errors_to_hv): add an optional
key argument. Update callers. Allow the error messages argument to
be NULL.
* tta/perl/XSTexinfo/convert/ConvertXS.xs (destroy)
(get_converter_errors): if there are still error messages in the
C converter data when destroy is called, pass the messages to
the Perl converter. Register/reuse the Perl messages lists in
get_converter_errors and pass the messages stored in Perl even if the
C converter is not found.
* tta/perl/XSTexinfo/parser_document/DocumentXS.xs (destroy_document)
(document_errors): if there are still error messages in the C document
data when destroy_document is called, pass the messages to the Perl
Document. Register/reuse the Perl messages lists in document_errors
and pass the messages stored in Perl even if the C document is not
found.
* tta/perl/t/test_utils.pl (convert_to_*, test): do not set the
converter errors in convert_to_* functions, call get_converter_errors
in test after conversion.
* tta/perl/t/test_utils.pl (test): get converter errors after
destroying the converter. This is possible thanks to the changes
in ConverterXS.xs above.
* tta/perl/t/test_utils.pl (test): add a variable to store whether the
parsing was successful or not instead of using the tree, such that the
tree can be undefined. Convert the tree back to Texinfo earlier on,
after the conversions by the other converters. Destroy the document
before doing the comparisons and get the errors in document after
destroying the document, which is possible thanks to the changes in
DocumentXS.xs above. That way, all the errors are gathered and
code that does conversion and comparisons are well separated.
* tta/C/main/utils.c (interpreter_refcount_error_messages)
(set_check_element_interpreter_refcount)
(get_check_element_interpreter_refcount), tta/C/main/output_unit.c
(destroy_output_unit), tta/C/main/tree.c (destroy_element): add an
error messages list to be used with
*_check_element_interpreter_refcount, pass it to code setting
check_element_interpreter_refcount and codes checking
get_check_element_interpreter_refcount. Add warning messages in the
error message lists in destroy_element and destroy_output_unit. A
separate error messages list is handy because, in general, the
refcounts are checked when the structure that unregister the
references that could hold the error messages is being destroyed.
* tta/C/convert/converter.c (reset_generic_converter),
tta/C/convert/texinfo.c (txi_destroy_document),
tta/perl/XSTexinfo/parser_document/DocumentXS.xs (destroy_document):
handle error messages on refcounts gathered during document
destruction and converter reset. Pass to the converter in converter
reset, discard in txi_destroy_document, and pass to Perl Document
error messages list array in XS destroy_document.
18 files changed