comparison always false is a problem or not?

2004-04-30 Thread Joel Rees
My experience is that this kind of thing tends to lead to dead code or 
endless loops. Do I need to dig in and find the macro declaration and 
see if I can fix it?

warning: comparison is always false due to limited range of data 
type

regcomp.c:724
pp_sys.c:302
byterun.c:898
re_comp.c:724
Joel Rees


Re: comparison always false is a problem or not?

2004-04-30 Thread Sherm Pendley
On Apr 30, 2004, at 2:30 AM, Joel Rees wrote:
My experience is that this kind of thing tends to lead to dead code or 
endless loops. Do I need to dig in and find the macro declaration and 
see if I can fix it?

warning: comparison is always false due to limited range of data 
type
In my own code, I compile with -Wall and try to chase down and 
eliminate all warnings. Occasionally I might use a -Wno-something to 
turn off a warning once I've determined that it's harmless, but I 
really, really prefer to fix them.

I treat other people's code differently. If I'm building something from 
source and it emits warnings, I'll make a mental note of that fact. 
Then, if it's crashy, buggy, or exhibits some other odd behavior, I 
might go back and see if the warnings are relevant to the problems. If 
the app works fine though, I don't worry about the warnings.

Those file names look familiar - are you building Perl? If so, and the 
self-tests pass, I definitely wouldn't worry about the warnings too 
much. Perl's self-tests are remarkably thorough.

sherm--


Re: comparison always false is a problem or not?

2004-04-30 Thread Joel Rees
On 2004.4.30, at 04:38 PM, Sherm Pendley wrote:

 On Apr 30, 2004, at 2:30 AM, Joel Rees wrote:

 My experience is that this kind of thing tends to lead to dead code  
 or endless loops. Do I need to dig in and find the macro declaration  
 and see if I can fix it?

 warning: comparison is always false due to limited range of data  
 type

 In my own code, I compile with -Wall and try to chase down and  
 eliminate all warnings. Occasionally I might use a -Wno-something to  
 turn off a warning once I've determined that it's harmless, but I  
 really, really prefer to fix them.

Me too.

 I treat other people's code differently. If I'm building something  
 from source and it emits warnings, I'll make a mental note of that  
 fact. Then, if it's crashy, buggy, or exhibits some other odd  
 behavior, I might go back and see if the warnings are relevant to the  
 problems. If the app works fine though, I don't worry about the  
 warnings.

That's kind of what I was figuring would do, but I also would prefer  
not to find my code skipping a parse because the code got thrown out.  
So I thought I'd check.

 Those file names look familiar - are you building Perl?

Of course! (I suppose I should have said so.)

  If so, and the self-tests pass,

Well, since you're kind enough to ask (heh heh), here's a few more I  
get:

In the make phase,

 ...
 cc -flat_namespace -L/usr/local/lib  -o miniperl ¥
 miniperlmain.o opmini.o libperl.a -lm -lc
 ./miniperl -w -Ilib -MExporter -e '?' || make minitest
 make: [extra.pods] Error 1 (ignored)
 ./miniperl -Ilib configpm configpm.tmp
 sh mv-if-diff configpm.tmp lib/Config.pm
 ...
 Making Errno (nonxs)
 Writing Makefile for Errno
 ../../miniperl "-I../../lib" "-I../../lib" "-I../../lib"  
"-I../../lib" Errno_pm.PL Errno.pm
 cp Errno.pm ../../lib/Errno.pm
 make: [extras.make] Error 1 (ignored)

 Everything is up to date. Type 'make test' to run test  
suite.

and also the range warnings mentioned already. In the make test phase,

 ...
 ext/DB_File/t/db-btree...#
 # This test is known to crash in Mac OS X versions 10.2 (or earlier)
 # because of the buggy Berkeley DB version included with the OS.
 #
 FAILED at test 0
 ext/DB_File/t/db-hashok
 ext/DB_File/t/db-recno...#
 # Some older versions of Berkeley DB version 1 will fail db-recno
 # tests 61, 63, 64 and 65.
 ...
 # You can safely ignore the errors if you're never going to use the
 ...
 #
 FAILED at test 64
 ext/Devel/DProf/t/DProf..ok
 ...
 Failed 2 test scripts out of 804, 99.75% okay.
 ### Since not all tests were successful, you may want to run some of
 ...
 ### Bourne-style shells, like bash, ksh, and zsh, respectively.
 u=25.78  s=0  cu=599.71  cs=171.77  scripts=804  tests=80310
 make[2]: *** [_test_tty] Error 1
 make[1]: *** [_test] Error 2
 make: *** [test] Error 2

It says I can ignore those, so I did a make install and got

...
 Making Errno (nonxs)
 make[1]: [extras.make] Error 1 (ignored)

 Everything is up to date. Type 'make test' to run test  
suite.
 if [ -n "" ]; ¥
 then ¥
 cd utils; make compile; ¥
 cd ../x2p; make compile; ¥
 cd ../pod; make compile; ¥
 else :; ¥
 fi
 ./perl installperl --destdir=
 WARNING: You've never run 'make test' or some tests failed!  
(Installing anyway.)

which worried me a little. So I went ahead and ran t/harness after the  
install completed. (That's backwards, I suppose.):

 ...
 op/lex_assign..ok
 op/lfs.skipped
 all skipped: writing past 2GB failed: process limits?
 op/listok
 ...
 ../ext/DB_File/t/db-btree..#
 # This test is known to crash in Mac OS X versions 10.2 (or earlier)
 # because of the buggy Berkeley DB version included with the OS.
 #
 ../ext/DB_File/t/db-btree..dubious
 Test returned status 0 (wstat 10, 0xa)
 ../ext/DB_File/t/db-hash...ok
 ../ext/DB_File/t/db-recno..#
 # Some older versions of Berkeley DB version 1 will fail db-recno
 # tests 61, 63, 64 and 65.
 #
 # For example Mac OS X 10.2 (or earlier) has such an old
 ...
 ../ext/DB_File/t/db-recno..FAILED tests 64, 67, 70