[fpc-pascal] Remove unused functions in a class

JoshyFun joshyfun at gmail.com
Sun Apr 5 13:28:59 CEST 2009

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 to the thread on
JM> the Lazarus list about the big executables: note that it has only a

Yes and no :) The thread raises the question in my brain :) but not to
reduce the LCL final size, it was only a conceptual question, how can
the compiler determine that a virtual method is unused at all, and
even if it is removed the VMT entry should be present do not ?

JM> limited effect on Lazarus programs, because almost all linked LCL code
JM> can potentially be executed (due to the way the LCL is constructed).
JM> In fact, I think most savings there come from making a number of  
JM> virtual method calls non-virtual, rather than from throwing away  
JM> unreachable code.

I think that LCL should be reestructured to get the compiler and
linker performing a good dead code clean, but that task is a big task.

JM> The internal linker can also do it (only throwing away virtual method
JM> that produces an error if you try to link a unit compiled with the
JM> option using the external linker), but that hasn't been done yet.

Just for curiosity which is the parameter set ?

Thank you for the answer.

Best regards,

More information about the fpc-pascal mailing list