On Fri, Oct 30, 2026 at 11:13:00PM +0000, Gavin Smith wrote:
> Even if we don't aim for such old manuals to build error-free, reducing
> the number of warnings from over 1000 to only a few makes it feasible to
> manually fix the input so it can be built.
Good idea.
> The main thing I wasn't sure about is whether %parsing_state_initialization
> is the right place for this hash.
%parser_document_state_initialization would be better. Currently there
is no practical difference, but I think that it helps for clearer code
since %parsing_state_initialization should be reset at the end of
parsing a file, while %parser_document_state_initialization should not.
Currently, there is no difference between a document and an input
source, but conceptually, %parser_document_state_initialization is for
a document that could theoretically come from more than one input
source, while %parsing_state_initialization is for each of such
input source.
> If this looks good I can try to do the corresponding C code (I'm happy for
> somebody else to do it, though). I imagine we would keep an array of
> warned-about commands and each time check through the array to see if the
> command has already been warned about.
We already have 7 obsoleted commands, so I think that a hash would be
better and as easy, or even easier to use in C too.
I too can work on that over the weekend.
> diff --git a/tta/perl/Texinfo/ParserNonXS.pm b/tta/perl/Texinfo/ParserNonXS.pm
> index bb10054534..22463d1246 100644
> --- a/tta/perl/Texinfo/ParserNonXS.pm
> +++ b/tta/perl/Texinfo/ParserNonXS.pm
> @@ -214,6 +214,7 @@ my %parsing_state_initialization = (
> # be added each time a context is pushed on
> # 'context_stack'. Could be undef if there
> # is no @-command associated with the context.
> + 'warned_deprecated_commands' => {},
> );
>
> my %parser_state_initialization = (%parser_document_state_initialization,
> @@ -7741,9 +7742,15 @@ sub _process_remaining_on_line($$$$) {
> # goto funexit; # used in XS code
> }
>
> - if (defined($deprecated_commands{$command})) {
> + if (defined($deprecated_commands{$command})
> + and (!defined($self->{'warned_deprecated_commands'}->{$command})
> + or ($self->{'warned_deprecated_commands'}->{$command} < 2))) {
> _line_warn($self, sprintf(__("\@%s is obsolete"),
> $command), $source_info);
> + if (++($self->{'warned_deprecated_commands'}->{$command}) == 2) {
> + _line_warn($self, sprintf(__("further warnings for @%s suppressed"),
> $command),
> + $source_info, 1);
> + }
> }
>
> # special case with @ followed by a newline protecting end of lines
>
>