Re: [fpc-pascal] Remove unused functions in a class

2009-04-05 Thread Jonas Maebe
On 05 Apr 2009, at 00:40, JoshyFun wrote: If a virtual method of a class is not used at all in the programm will the compiler remove it from the executable ? If you use FPC 2.3.1 with whole-program optimization and the compiler can prove that it is never callable: yes. See

Re[2]: [fpc-pascal] Remove unused functions in a class

2009-04-05 Thread JoshyFun
Hello Jonas, Sunday, April 5, 2009, 11:20:59 AM, you wrote: JM If you use FPC 2.3.1 with whole-program optimization and the compiler JM can prove that it is never callable: yes. See JM http://wiki.freepascal.org/Whole_Program_Optimization JM for more information. In case this is in relation

Re: Re[2]: [fpc-pascal] Remove unused functions in a class

2009-04-05 Thread Jonas Maebe
On 05 Apr 2009, at 13:28, JoshyFun wrote: JM If you use FPC 2.3.1 with whole-program optimization and the compiler JM can prove that it is never callable: yes. See JM http://wiki.freepascal.org/Whole_Program_Optimization JM for more information. In case this is in relation to the

Re[4]: [fpc-pascal] Remove unused functions in a class

2009-04-05 Thread JoshyFun
Hello Jonas, Sunday, April 5, 2009, 2:09:33 PM, you wrote: JM If you have a class hierarchy tbase-tderived1-tderived2 with a JM virtual method called vmethod, and nowhere in the program there is a JM call to vmethod, then it is unused. Or if it is only called using JM tderived2 instances, then

Re: Re[4]: [fpc-pascal] Remove unused functions in a class

2009-04-05 Thread Jonas Maebe
On 05 Apr 2009, at 17:12, JoshyFun wrote: TCustomFoo=class(TObject); TDerivedFoo=class(TCustomFoo) procedure Myprocedure(); virtual; end; TDeDerivedFoo=class(TDerivedFoo) procedure MyProcedure(); override; end; And in the code: var MyObj: TCustomFoo; begin MyObj:=TDeDerivedFoo.Create();

Re[6]: [fpc-pascal] Remove unused functions in a class

2009-04-05 Thread JoshyFun
Hello Jonas, Sunday, April 5, 2009, 5:27:02 PM, you wrote: Something like this could kill the dead code detection ? A simple yes/no is enoght :) JM Not in case of whole-program optimization: JM --- dead.sorg 2009-04-05 17:24:25.0 +0200 JM +++ dead.s 2009-04-05

[fpc-pascal] Remove unused functions in a class

2009-04-04 Thread JoshyFun
Hello FPC-Pascal, If a virtual method of a class is not used at all in the programm will the compiler remove it from the executable ? I think that unused constants and functions will be removed by the compiler or the linker but the methdos of a class... :-? -- Best regards, JoshyFun