New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Name "%s::%s" used only once" warnings are not fatalized #13814
Comments
From @karenetheridgeCreated by @karenetheridgeThis code: use strict; Should be fatal. Instead, it prints: Name "Foo::bar" used only once: possible typo at foo.pl line 3. still alive (Behaviour is the same with "use warnings FATAL => 'all'".) Perl Info
|
From @tonycozOn Fri May 09 14:25:09 2014, ether@cpan.org wrote:
The cause I think is that the checks for WARN_ONCE aren't done until after compilation is complete and before execution starts, so PL_curcop isn't the cop where the global is being referenced. The warning itself is suppressed as the code is compiled by Perl_gv_fetchpvn_flags() which sets GvMULTI_on() on the gv if WARN_ONCE isn't set. I don't see a simple way to fix it. Tony |
The RT System itself - Status changed from 'new' to 'open' |
@tonycoz , @karenetheridge , is this ticket closable? |
I think it's fixable by adding a GV flag to indicate warnings were fatal when the name was seen. I've added this to my assigned list, though if anyone else wants to look at it they're welcome to try. |
"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 Perl#13814
"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 Perl#13814
"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 Perl#13814
"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
Migrated from rt.perl.org#121834 (status was 'open')
Searchable as RT121834$
The text was updated successfully, but these errors were encountered: