delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/15/04:39:45

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Organization: Materials Science Centre
To: DJGPP AT DELORIE DOT COM
Date: Wed, 15 May 1996 09:30:09 GMT
Subject: Unused functions
Message-ID: <157DDF4142@fs2.mt.umist.ac.uk>

  A.Appleyard wrote:-
> In djgpp v1, and in djgpp v2, is there an option to tell the linker to tell
> me of any function entry points that are present but never used? This would
> be useful letting me weed out unused functions and global variables in a big
> multi-file program that I have developed and altered much.

  Eli Zaretski replied:-
> You could run `nm' on all the object files and look for functions that are
> only mentioned with a `T' letter. Functions that are called should be found
> with a `u' somewhere.

  I did what Eli said, and I found and read djgpp\docs\binutils\binutils.tex .
  (1) NM gives far too much output for me to wade through.
  (2) NM seems to (give a `T' and not a `U') also for functions that are only
called in the same file that they are declared in.
  What is needed is, a djgpp linker option that will tell the linker to output
a remark list of unused entry points, e.g.:-

  Caution: mark::replace(int,int) in KEYF.CC is never used              (a)
  Caution: mark::rewrite(int,int) in KEYF.CC is only used in KEYF.CC    (b)

  (a) would tell me that that function can be removed, to reduce bulk.
  (b) would tell me that that function could be declared `static'.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019