diff options
author | Karl Williamson <public@khwilliamson.com> | 2014-01-25 16:53:24 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2014-01-27 11:07:17 -0700 |
commit | 6c62bf0f1cb868c0614cc03720f3babf46da7e34 (patch) | |
tree | 9956b505f20324980a65a53fac7b67011f4c4083 /regen | |
parent | 8dc14e640ad1bc1149bd130d3fbd52d9306e965b (diff) | |
download | perl-6c62bf0f1cb868c0614cc03720f3babf46da7e34.tar.gz |
regen/regcharclass.pl: Don't test UV >= 0
An unsigned must always be >= 0, and generating a test for that can lead
to a compiler warning, even if it gets optimized out. The input to the
macros generated by this are supposed to be UV. This commit suppresses
any >= 0 test.
Diffstat (limited to 'regen')
-rwxr-xr-x | regen/regcharclass.pl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/regen/regcharclass.pl b/regen/regcharclass.pl index 58a2ca6506..d6e0010432 100755 --- a/regen/regcharclass.pl +++ b/regen/regcharclass.pl @@ -1090,10 +1090,18 @@ sub _combine { return if !@cond; my $item= shift @cond; my ( $cstr, $gtv ); - if ( ref $item ) { - $cstr= + if ( ref $item ) { # @item should be a 2-element array giving range start + # and end + if ($item->[0] == 0) { # UV's are never negative, so skip "0 <= " + # test which could generate a compiler warning + # that test is always true + $cstr= sprintf( "$test <= $self->{val_fmt}", $item->[1] ); + } + else { + $cstr= sprintf( "( $self->{val_fmt} <= $test && $test <= $self->{val_fmt} )", - @$item ); + @$item ); + } $gtv= sprintf "$self->{val_fmt}", $item->[1]; } else { $cstr= sprintf( "$self->{val_fmt} == $test", $item ); |