develooper Front page | perl.perl5.porters | Postings from October 2014

[perl #122966] [PATCH] bogus fatal warnings can hide syntax errors

Thread Previous | Thread Next
From:
l.mai@web.de via RT
Date:
October 13, 2014 20:26
Subject:
[perl #122966] [PATCH] bogus fatal warnings can hide syntax errors
Message ID:
rt-4.0.18-30966-1413232005-1948.122966-15-0@perl.org
On Mon Oct 13 06:12:04 2014, sprout wrote:
> 
> Since the programmer has requested fatal warnings, why not send it to
> qerror instead of simply turning off the fatality?

Because I wasn't aware qerror() exists. :-)

This works:

    if (PL_warnhook == PERL_WARNHOOK_FATAL || ckDEAD(err)) {
        SV * const msv = vmess(pat, args);

        if (PL_parser && PL_parser->error_count) {
            qerror(msv);
        }
        else {
            invoke_exception_hook(msv, FALSE);
            die_unwind(msv);
        }
    }
    else {
        Perl_vwarn(aTHX_ pat, args);
    }

but it changes the order of the output to:

syntax error at foo.pl line 5, near "1 {"
"my" variable $wtf masks earlier declaration in same statement at foo.pl line 7.
syntax error at foo.pl line 8, near "}"
Execution of foo.pl aborted due to compilation errors.

Personally I think this is an improvement (messages are ordered by line number) but it's different from non-fatal warnings now.

(Revised patch attached.)

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=122966

Thread Previous | Thread Next


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