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.
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 );