comp.lang.ada
 help / color / mirror / Atom feed
From: jb@rti.UUCP (Jeff Bartlett)
Subject: Re: Conditional compilation
Date: 22 Jun 88 00:44:52 GMT	[thread overview]
Message-ID: <2313@rti.UUCP> (raw)
In-Reply-To: 28254@clyde.ATT.COM

In article <28254@clyde.ATT.COM>, rds@moss.ATT.COM writes:
> 
> If this is, in fact, what the LRM intends to say it is an insufficient
> method for conditional compilation. Consider the following scenario:
> 
> Package A is generic with a generic type parameter. Package B is generic
> with the same generic parameter. A particular system requires only
> package A and another system requires both A & B. 
> 
> B's compilation requires the existance of an instantiated version of A.

1. if the customer is to do this instantiation of A then they must receive
   the source for B.

> It is important that the customer with system A who does not need package B
> not get package B and not neccesarily know of the existance of package B.

2. This implies that there are no packages in the minimal system that depend
	on B
     ==> no shipped executables need package B.
     ==> package B is supplied to customer in source or in a shipped
         compilation library

> An appropriate solution (in a C environment) is to conditionally
> include the code for package B with package A at compilation time.
 
The C source would have:
	#ifdef EXTRA_FEATURES
	#include "package_b.c"
	#endif

- the existance of package B should not be revealed in limited systems.
- the C source would reveal the existance of package B
- C is appropiate solution.
==> the customers do not get the source.

for the limited system:
    - if it is in a shipped compilation library compile everything
      and delete the interface and body for package B from the library

    - not supplied B in source form (for the case of user instantiated A and
      '#include "package_b.c"' is acceptable ).

    - these are separately compilable units.  Just don't compile the
      file containing package B.

Any bad assumptions or flaws in logic?

Are the any tests in the Ada compiler validation suite that checks that
compilation unit Y does not depend on the interface of B in the compilation
library?

    with B;
    procedure Y is
       K : B.TYPE1;  -- unref'd, may be removed
    begin
	if FALSE then
	    B.ROUTINE1;
	    K := 5;
	end if;
    end Y;

DecAda V1.5 has the library dependancy but no code or stack space was generated.

LRM 10.1.1.6 states that the 'with' will cause a library dependancy.  Should
the optimizer be allowed to revoke it or does a 'with' imply an explict
elaboration of package B regardless of the fact that there are no references
to B in procedure Y.

Of course this isn't allowed

   procedure Y is
   begin
      if FALSE then
	 declare
	    with B;
	    K : B.TYPE1;  -- unref'd, may be removed
	 begin
	    B.ROUTINE1;
	    K := 5;
	 end;
      end if;
   end Y;

if it were then the compiler could safely assume that the elaboration of B
was not needed.
     
> Richard DeSimine
> AT&T Bell Laboratories
> (201) 386-2059

Jeff Bartlett
Center for Digital Systems Research
Research Triangle Institute
jb@rti.rti.org		...mcnc!rti!jb

  reply	other threads:[~1988-06-22  0:44 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-06-13  0:24 Conditional compilation Steinar Haug
1988-06-17 13:53 ` rds
1988-06-22  0:44   ` Jeff Bartlett [this message]
1988-06-23 13:01   ` Arny B. Engelson
1988-06-27 18:01     ` Dave Seward
1988-06-29 13:32   ` brucej
1988-06-17 14:48 ` rjs
  -- strict thread matches above, loose matches on Subject: below --
1989-12-12  0:08 conditional compilation Emery
2000-07-31  0:00 Matthew Woodcraft
2000-07-31  0:00 ` Marin D. Condic
2000-07-31  0:00   ` Ira D. Baxter
2000-08-01  0:00   ` Simon Brady
2000-07-31  0:00     ` Marin D. Condic
2000-08-01  0:00     ` Ted Dennison
2000-08-01  0:00       ` Robert A Duff
2000-08-01  0:00         ` Laurent Guerby
2000-08-02  0:00       ` Simon Brady
2000-08-02  0:00         ` Georg Bauhaus
2000-08-02  0:00         ` Simon Brady
2000-08-01  0:00           ` William J. Thomas
2000-08-02  0:00         ` Robert A Duff
2000-08-02  0:00           ` Brian Rogoff
2000-08-03  0:00             ` Robert A Duff
2000-08-02  0:00           ` Georg Bauhaus
2000-08-03  0:00             ` Robert A Duff
2000-08-03  0:00           ` Florian Weimer
2000-09-19  0:00 Conditional Compilation Kenneth Kueny
2000-09-19  0:00 ` E. Robert Tisdale
2000-09-19  0:00   ` Larry Kilgallen
2000-09-19  0:00     ` Jeff Allen
2000-09-20  0:49       ` Robert Dewar
2000-09-19  0:00         ` Bobby D. Bryant
2000-09-24  0:00           ` Robert Dewar
2000-09-19  0:00   ` David Starner
2000-09-20  0:52     ` Robert Dewar
2000-09-20  0:47   ` Robert Dewar
2000-10-09  0:00   ` John McCabe
2000-09-19  0:00 ` David Starner
2000-09-19  0:00 ` Richard Riehle
2000-09-19  0:00 ` Ted Dennison
2000-09-19  0:00 ` Jeffrey Carter
2000-09-19  0:00   ` Samuel T. Harris
2000-09-20  0:44     ` Robert Dewar
2000-09-20  1:33 ` tmoran
     [not found]   ` <8qauu3$7ei$1@nnrp1.deja.com>
2000-09-24  0:00     ` Robert Dewar
2000-09-25  2:45       ` Ted Dennison
2000-09-25  0:00         ` peter
     [not found] ` <39CA31F2.E160F0D8@res.raytheon.com>
2000-09-24  0:00   ` Robert Dewar
2001-01-02 13:27 ` Andrew Hately
2001-01-02 16:46   ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox