develooper Front page | perl.perl5.changes | Postings from December 2023

[Perl/perl5] 01b600: allow "used only once" warnings to be fatal

From:
Tony Cook via perl5-changes
Date:
December 7, 2023 23:03
Subject:
[Perl/perl5] 01b600: allow "used only once" warnings to be fatal
Message ID:
Perl/perl5/push/refs/heads/blead/93f4c2-01b600@github.com
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 01b60077c5188e465b1b2eeb5d24b79ed1e4cb95
      https://github.com/Perl/perl5/commit/01b60077c5188e465b1b2eeb5d24b79ed1e4cb95
  Author: Tony Cook <tony@develop-help.com>
  Date:   2023-12-08 (Fri, 08 Dec 2023)

  Changed paths:
    M embed.fnc
    M embed.h
    M gv.c
    M gv.h
    M proto.h
    M t/lib/warnings/gv
    M util.c

  Log Message:
  -----------
  allow "used only once" warnings to be fatal

"used only once" warnings are special, instead of being emitted at
the code where the name in question is used, they are emitted during
a scan of the symbol table done after parsing has finished.

This meant that any FATAL flags set in the COP for the parse point of
the name is no longer in scope, so the warnings we emit can't be
treated as fatal.

To make them behave as FATAL set a new flag on the name if fatal
WARN_ONCE warnings are enabled and use that to dispatch the warnings
as normal or fatally when we do the symbol table scan.

I originally approached the dispatch as fatal or non-fatal by messing
around with cop_warnings, but that was dumb, and I went for a much
simpler change.

Fixes #13814





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About