Branch: refs/heads/yves/fix_20425_warn_fixup
  Home:   https://github.com/Perl/perl5
  Commit: f2a66fd38243d4991d0cd35965328308fcd49d08
      
https://github.com/Perl/perl5/commit/f2a66fd38243d4991d0cd35965328308fcd49d08
  Author: Yves Orton <demer...@gmail.com>
  Date:   2022-10-23 (Sun, 23 Oct 2022)

  Changed paths:
    M t/op/lex.t

  Log Message:
  -----------
  t/op/lex.t - allow it to be run from the root of the repo

This makes:

    ./perl -Ilib t/op/lex.t

work as expected.


  Commit: 85dc9d7f284f843edb9ad14b15edf25c2ea1e7b6
      
https://github.com/Perl/perl5/commit/85dc9d7f284f843edb9ad14b15edf25c2ea1e7b6
  Author: Yves Orton <demer...@gmail.com>
  Date:   2022-10-23 (Sun, 23 Oct 2022)

  Changed paths:
    M t/lib/croak/toke
    M t/lib/feature/bareword_filehandles
    M t/lib/feature/bits
    M t/lib/feature/bundle
    M t/lib/feature/indirect
    M t/lib/feature/say
    M t/lib/subs/subs
    M t/lib/warnings/toke
    M t/op/heredoc.t
    M t/op/hexfp.t
    M t/op/lex.t
    M toke.c

  Log Message:
  -----------
  toke.c - rework "Perl_no_op" warnings so we call Perl_warner() once only

Using multiple calls to Perl_warner() means that fatalized warnings
do not include the full diagnostics. It also means that $SIG{__WARN__}
might get called more than once for a given warning, with parts of the
message in each call. This would affect "missing operator" warnings,
which often come up in the context of barewords and misspelled sub
names.

This patch moves the parenthesized "hint" part of the warning to the
same line as the main warning and ensures the entire message is
dispatched in a single call to Perl_warner(). The result of this is that
the hint is visible even under fatalized warnings and that
$SIG{__WARN__} is called only once for the warning.

At the same time this patch fixes an oversight where we would sometimes
form warning messages with a subject (var name or bareword name) that
was unquoted and sometimes had leading whitespace. This patch changes
this to quote the subject like most of our errors do and to strip the
whitespace when appropriate. (Note this doesn't use the QUOTEDPREFIX
formats, as it didn't seem to be necessary with the type of warnings
this is involved in.) This is not done in a separate patch as it would
mean manually altering all the tests multiple times over multiple
patches.

Note that yywarn() calls Perl_warner(), so even though this patch
does not call it directly it does call it indirectly via yywarn()
via yyerror().

This resolves GH Issue #20425.


Compare: https://github.com/Perl/perl5/compare/e5178b05e1bf...85dc9d7f284f

Reply via email to