From: Jarkko Hietaniemi Date: Thu, 15 Jul 1999 14:26:03 +0000 (+0000) Subject: Fix the bin/oct/hex constant overflow tests for X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9f62e1ec6945a49a52880c6619a9badbeb4bb8ea;p=p5sagit%2Fp5-mst-13.2.git Fix the bin/oct/hex constant overflow tests for long long platforms. p4raw-id: //depot/cfgperl@3674 --- diff --git a/t/pragma/warn/util b/t/pragma/warn/util index ea3aed5..fc1e6dd 100644 --- a/t/pragma/warn/util +++ b/t/pragma/warn/util @@ -45,8 +45,10 @@ Illegal binary digit '9' ignored at - line 3. BEGIN { require Config ; import Config } $^W =1 ; sub make_bin { "1" x $_[0] } -$n = make_bin(8 * $Config{longsize} ) ; -$o = make_bin(8 * $Config{longsize} + 1) ; +my $s = $Config{longsize}; +eval { pack "q", 0 }; eval { $s = length pack "q", 0 } unless $@; +$n = make_bin(8 * $s ) ; +$o = make_bin(8 * $s + 1) ; { use warning 'unsafe' ; my $a = oct "0b$n" ; @@ -56,15 +58,17 @@ $o = make_bin(8 * $Config{longsize} + 1) ; } my $b = oct "0b$o" ; EXPECT -Integer overflow in binary number at - line 10. -Integer overflow in binary number at - line 14. +Integer overflow in binary number at - line 12. +Integer overflow in binary number at - line 16. ######## # util.c BEGIN { require Config ; import Config } $^W =1 ; sub make_oct { ("","1","3")[$_[0]%3] . "7" x int($_[0]/3) } -$n = make_oct(8 * $Config{longsize} ); -$o = make_oct(8 * $Config{longsize} + 1); +my $s = $Config{longsize}; +eval { pack "q", 0 }; eval { $s = length pack "q", 0 } unless $@; +$n = make_oct(8 * $s ); +$o = make_oct(8 * $s + 1); { use warning 'unsafe' ; my $a = oct "$n" ; @@ -74,15 +78,17 @@ $o = make_oct(8 * $Config{longsize} + 1); } my $b = oct "$o" ; EXPECT -Integer overflow in octal number at - line 10. -Integer overflow in octal number at - line 14. +Integer overflow in octal number at - line 12. +Integer overflow in octal number at - line 16. ######## # util.c BEGIN { require Config ; import Config } $^W =1 ; sub make_hex { ("","1","3","7")[$_[0]%4] . "f" x int($_[0]/4) } -$n = make_hex(8 * $Config{longsize} ) ; -$o = make_hex(8 * $Config{longsize} + 1) ; +my $s = $Config{longsize}; +eval { pack "q", 0 }; eval { $s = length pack "q", 0 } unless $@; +$n = make_hex(8 * $s ) ; +$o = make_hex(8 * $s + 1) ; { use warning 'unsafe' ; my $a = hex "$n" ; @@ -92,6 +98,6 @@ $o = make_hex(8 * $Config{longsize} + 1) ; } my $b = hex "$o" ; EXPECT -Integer overflow in hexadecimal number at - line 10. -Integer overflow in hexadecimal number at - line 14. +Integer overflow in hexadecimal number at - line 12. +Integer overflow in hexadecimal number at - line 16.