From: Simon Wright <simon@pushface.org>
Subject: Re: Source Analysis Tools for Ada95
Date: 27 Apr 2003 07:26:23 +0100
Date: 2003-04-27T07:26:23+01:00 [thread overview]
Message-ID: <x7v65p08nhs.fsf@smaug.pushface.org> (raw)
In-Reply-To: 7fc0d0f7.0304261434.1f7f69fd@posting.google.com
tony@probepak.com (Dr. Anthony Probe) writes:
> > Gnat includes "gnatelim" which generates a list of gnat specific
> > pragmas causing no object code to be built for dead code. You
> > should be able to use this as a starting point for deleting unused
> > code.
>
> Wouldn't a compiler only detect the obvious dead code (that which
> isn't used from just analyzing the comp unit?
I have never used gnatelim, because the one time I tried it took a
long time (this was a few years ago) and I didn't really have a
problem anyway. But its intention is to find and mark those
subprograms (?and other constructs?) that aren't used in the
closure. Sounds like what you're after!
You need to get the binary distribution, because gnatelim isn't built
as part of the compiler (I believe it's an ASIS application).
Quotation from the 3.14p GNAT user's guide:
When a program shares a set of Ada packages with other programs, it
may happen that this program uses only a fraction of the
subprograms defined in these packages. The code created for these
unused subprograms increases the size of the executable.
gnatelim tracks unused subprograms in an Ada program and outputs a
list of GNAT-specific Eliminate pragmas (see next section) marking
all the subprograms that are declared but never called. By placing
the list of Eliminate pragmas in the GNAT configuration file
`gnat.adc' and recompiling your program, you may decrease the size
of its executable, because the compiler will not generate the code
for 'eliminated' subprograms.
The simplified syntax of the Eliminate pragma used by gnatelim is:
pragma Eliminate (Library_Unit_Name, Subprogram_Name);
where
Library_Unit_Name
full expanded Ada name of a library unit
Subprogram_Name
a simple or expanded name of a subprogram declared within this
compilation unit
Also, -gnatwu will warn of unused entities, including withed units. I
think this is GNAT 3.15p or later. (we use -gnatwaL, switch on all
warnings except elaboration ordering).
next prev parent reply other threads:[~2003-04-27 6:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-26 0:07 Source Analysis Tools for Ada95 Dr. Anthony Probe
2003-04-26 2:21 ` Steve
2003-04-26 22:34 ` Dr. Anthony Probe
2003-04-27 6:26 ` Simon Wright [this message]
2003-04-27 15:15 ` Jano
2003-04-27 21:32 ` Frode Tennebø
2003-04-28 18:51 ` Jano
2003-04-27 18:49 ` tmoran
2003-04-27 2:36 ` Alex Gibson
2003-04-27 19:56 ` Peter Richtmyer
2003-04-27 16:43 ` Dr. Michael Paus
-- strict thread matches above, loose matches on Subject: below --
2003-04-29 17:37 Lionel.DRAGHI
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox