On Wednesday 17 December 2008 21:05:34 Mindaugas Kavaliauskas wrote: > 2008-12-18 05:02 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) > * include/hbclass.ch > * include/hbcomp.ch > * include/hberrors.h > * include/hbgenerr.c > * include/hbmain.c > * include/hbopt.c > + PCode optimizations: > 1) Self := QSELF(), Self:method -> QSELF():method > 2) Declared, but unused variables are removed from code > These optimizations are enabled if jump optimizations are enabled. > > + added recursive pcode tree tracer. It is capable to generate new > warning: Variable %s is assigned, but not used. > Warning is not generated in these cases: > 1) unoptimal Self := QSELF() pcode [generated by preprocessor > rules] > 2) if variable name starts with '_nowarn_'. This allows to > suppress warning in case unoptimal pcode is generated by > preprocessor rules > 3) assigned value is NIL. This let us force garbage collection > using oVar := NIL > Warning has warning level 3. > ; NOTE: if you are using -w3 -es2 in makefiles, you'll need to > fix your > redundant code to compile the project
[snip] Nice addition, thanks Mindaugas. One thing that I've noticed is showed in the following case: /----- start prg code -----/ FUNCTION Main LOCAL s := "Hello" LOCAL GetList := {} @ 0,0 GET s READ RETURN NIL /----- end prg code -----/ The Harbour compiler will complain (if -w3 enabled) because the READ command is translated to: ReadModal( GetList, NIL,,,,, ) ; GetList := {} and it catches (correctly) the last "GetList := {}" as "assigned but not used". To solve this I think that we need to have "ASize( GetList, 0 )" instead of "GetList := {}". best regards, Teo _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour