Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: e2f38762229a1fa23d4b6154ad2c9b4d80bb3993
      
https://github.com/Perl/perl5/commit/e2f38762229a1fa23d4b6154ad2c9b4d80bb3993
  Author: Lukas Mai <lukasmai....@gmail.com>
  Date:   2023-11-20 (Mon, 20 Nov 2023)

  Changed paths:
    M op.c
    M t/lib/warnings/op

  Log Message:
  -----------
  extend "Possible precedence issue" warning, cover more cases

Previously, code like

    return $a or $b;

would emit a warning of the form "Possible precedence issue with control
flow operator" because it parses as (return $a) or $b.

However, the equally misleading

    exit $a != 0;      # exit($a) != 0
    exit $a ? 0 : $b;  # exit($a) ? 0 : $b

were not diagnosed.

This patch moves the check higher up in the compiler: Now any binary or
ternary operator (not just logical operators) warns if its first operand
is an unparenthesized control flow operator that does not terminate
normally (i.e. next, last, redo, goto, exit, return, die).


Reply via email to