Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: Charles Henrich Newsgroups: scea.yaroze.programming.codewarrior Subject: Re: tanttank demo linking problem in CW Date: Mon, 08 Sep 1997 10:31:02 -0400 Organization: SCEA News Server Lines: 116 Message-ID: <34140C26.DB8F698F@msu.edu> References: <3412F639.5F1C6C64@zicorp.com> <01bcbc11$baf64960$9fbf43ce@wkwerner> NNTP-Posting-Host: crh.cl.msu.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.02b7 [en] (X11; I; FreeBSD 2.2.2-RELEASE i386) Wayne K. Werner wrote: > Many times in converting sample code from a GNU project to CW, I find that > CW is catching many problems that GNU doesn't even notice. This was the > case in the Survival Demo used in the auditorium presentation. CW found > some instances of the use of uninitialized variables in one of the > functions. The GNU compiler missed this totaly! If Pradip was using CW > instead of GNU, he would have found these bugs before posting the demo. > > This is NOT a problem with CW, just the opposite! It appears that CW is > the more robust compiler/linker by far. If GCC is used properly, it will happily report every conceivable error on the planet. In fact I would argue -Wall should be the default for GCC. Every Makefile should use it in any case. GCC will not report all warnings unless -Wall is used on the command line. If Predip had used -Wall he would have found the bugs. You also need to look at the makefile for options usage when porting to CW as well. I.e. compiling tantank with -Wall produces: ================================================== -- psx-gcc -O2 -g -Wall -c main.c main.c:18: warning: return-type defaults to `int' main.c: In function `main': main.c:21: warning: implicit declaration of function `Seq_Init' main.c:22: warning: implicit declaration of function `init_text' main.c:26: warning: `return' with no value, in function returning non-void main.c:29: warning: `return' with no value, in function returning non-void main.c:40: warning: implicit declaration of function `Seq_Term' main.c:41: warning: control reaches end of non-void function psx-gcc -O2 -g -Wall -c pad.c psx-gcc -O2 -g -Wall -c tank.c tank.c:229: warning: `/*' within comment tank.c: In function `Tank_Main': tank.c:36: warning: implicit declaration of function `srand' tank.c:39: warning: implicit declaration of function `rand' tank.c:61: warning: implicit declaration of function `map_model_init' tank.c:62: warning: implicit declaration of function `map_coord_init' tank.c:84: warning: implicit declaration of function `GetTimer' tank.c:87: warning: implicit declaration of function `obj_interactive' tank.c:88: warning: implicit declaration of function `printf' tank.c:108: warning: implicit declaration of function `View_Map' tank.c: At top level: tank.c:244: warning: return-type defaults to `int' tank.c: In function `obj_interactive': tank.c:251: warning: implicit declaration of function `set_coordinate' tank.c:388: warning: suggest parentheses around && within || tank.c: At top level: tank.c:431: warning: return-type defaults to `int' tank.c: In function `MoveTank': tank.c:457: warning: suggest parentheses around && within || tank.c:468: warning: `return' with no value, in function returning non-void tank.c:470: warning: implicit declaration of function `map_move_check' tank.c:484: warning: control reaches end of non-void function tank.c: In function `Tank_Control': tank.c:511: warning: unused variable `i' tank.c: In function `Round_View': tank.c:788: warning: unused variable `i' tank.c: In function `Winner_View': tank.c:802: warning: unused variable `i' tank.c: In function `Timer_View': tank.c:854: warning: unused variable `i' psx-gcc -O2 -g -Wall -c sin.c psx-gcc -O2 -g -Wall -c tankinit.c tankinit.c:174: warning: `/*' within comment tankinit.c: In function `tank_sound_init': tankinit.c:211: warning: implicit declaration of function `printf' tankinit.c:212: warning: long unsigned int format, pointer arg (arg 2) psx-gcc -O2 -g -Wall -c sound.c psx-gcc -O2 -g -Wall -c cannon.c cannon.c: In function `Cannon_Move': cannon.c:91: warning: implicit declaration of function `Cannon_HitCheck' cannon.c:93: warning: implicit declaration of function `map_tama_check' cannon.c:80: warning: unused variable `tmpls' cannon.c:79: warning: unused variable `op' psx-gcc -O2 -g -Wall -c atm.c atm.c: In function `Atm_Move': atm.c:110: warning: implicit declaration of function `Atm_HitCheck' atm.c:112: warning: implicit declaration of function `map_tama_check' atm.c:99: warning: unused variable `tmpls' atm.c:98: warning: unused variable `op' psx-gcc -O2 -g -Wall -c machine.c machine.c: In function `Machine_Make': machine.c:38: warning: unused variable `z' machine.c: In function `Machine_Move': machine.c:95: warning: implicit declaration of function `Machine_HitCheck' machine.c:97: warning: implicit declaration of function `map_tama_check' machine.c:84: warning: unused variable `tmpls' machine.c:83: warning: unused variable `op' psx-gcc -O2 -g -Wall -c 2d.c 2d.c: In function `init_life': 2d.c:45: warning: unused variable `rect' 2d.c: In function `init_text': 2d.c:85: warning: unused variable `rect' 2d.c: In function `init_title': 2d.c:346: warning: unused variable `rect' psx-gcc -O2 -g -Wall -c map.c map.c: In function `View_Map': map.c:75: warning: unused variable `tmpls' map.c: In function `map_move_check': map.c:108: warning: suggest parentheses around && within || psx-gcc -O2 -g -Wall -c sub.c sub.c: In function `HitCheck': sub.c:60: warning: suggest parentheses around && within || psx-gcc -O2 -g -Wall -c title.c title.c:98: warning: `/*' within comment psx-gcc -O2 -g -Wall -c seqplay.c seqplay.c: In function `Seq_Init': seqplay.c:23: warning: implicit declaration of function `printf' =================================================== Clearly this is a pretty badly written bunch of code, but you cant blame that on GCC... -Crh