www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/16/09:37:07

Date: Thu, 16 May 1996 16:26:50 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Cc: DJGPP AT delorie DOT com
Subject: Re: Unused functions
In-Reply-To: <2D1D787C03@fs2.mt.umist.ac.uk>
Message-Id: <Pine.SUN.3.91.960516162042.5771I-100000@is>
Mime-Version: 1.0

On Thu, 16 May 1996, A.Appleyard wrote:

> A.Appleyard wrote wanting djgpp's linker to be able to say which entry points
> are (1) only used within the same file, so he can declare them `static', (2)
> not used at all, so he can delete them.
[snip]
> how to easily find unused functions and unused global-level declarations?
> Dividing the source form into infinity tiny files is too fiddly and awkward.

Then how about just grep'ping through the sources?  You could create a
file with the names of all the functions defined by your program then call
fgrep to search for these names.  If all you find for a certain function
is just its declaration and definition, that function is not used. 

You can also use grep (or sed or awk) to look for a regular expression 
that describes a function call and compare the results with the list of 
declared functions.

GCC has a switch that causes it to output a list of all the functions 
declared by a source file.  (Finding that switch in the GCC docs is left 
as an excercise to the interested readers ;-).

- Raw text -


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