comp.lang.ada
 help / color / mirror / Atom feed
* Compiling separates with GPS GPL version (Ada 2005 i think)
@ 2006-03-01 12:37 stuart clark
  2006-03-01 14:19 ` Marc A. Criley
  0 siblings, 1 reply; 6+ messages in thread
From: stuart clark @ 2006-03-01 12:37 UTC (permalink / raw)


i have package spec which declares two visible task. Thye package body
then declares these tasks as separates. i then have the task in
individual files named

common_to_both_1553-io_1553.adb

i have compiled both the package spec and body, however when i try to
compile the separates is get the following;

gnatmake -u -c -u -PC:/GNAT/uatl/uatl_common_lib.gpr
common_to_both_1553-io_1553.adb -d
gcc -c -I- -gnatA "C:\Documents and Settings\stuart\My
Documents\UATL\uatl\common\common_lib\common_to_both_1553-io_1553.adb"
cannot generate code for file common_to_both_1553-io_1553.adb (subunit)
to check subunit for errors, use -gnatc
gnatmake: "c:\documents and settings\stuart\my
documents\uatl\uatl\common\common_lib\common_to_both_1553-io_1553.adb"
compilation error

process exited with status 4


Questions
1) What am i doing wrong???

2) Can i invoke a gnatmake myself in GPS, i tried a GPS shell but it
doesnt recognise the gnatmake command. Is there some way of manually
compiling stuff. At present i am simply doing a SHIFT-F$ to compile the
separate.

Stuart Clark




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compiling separates with GPS GPL version (Ada 2005 i think)
  2006-03-01 12:37 Compiling separates with GPS GPL version (Ada 2005 i think) stuart clark
@ 2006-03-01 14:19 ` Marc A. Criley
  2006-03-01 22:22   ` stuart clark
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Marc A. Criley @ 2006-03-01 14:19 UTC (permalink / raw)


stuart clark wrote:
> i have package spec which declares two visible task. Thye package body
> then declares these tasks as separates. i then have the task in
> individual files named
> 

<snips>

> Questions
> 1) What am i doing wrong???

As best I recollect (and I stopped using "separates" a _long_ time ago), 
when you compile a package body designating units as separate with the 
_GNAT_ compiler, it brings in and compiles those units as part of the 
body compilation. (This is specific to the GNAT compiler, others may 
differ.)

What this means is that attempting to compile the "separate" unit files 
alone *has no effect*.  This is why you get the error message:

 > cannot generate code for file common_to_both_1553-io_1553.adb (subunit)
 > to check subunit for errors, use -gnatc

To reiterate, the GNAT compiler compiles separate units when it compiles 
the body of the unit from which they're separate.  The most you can do 
with the separate unit itself is simply have GNAT scan it for errors.

So, you ask, why even bother having subunits?  Precisely! :-)  If you're 
using a GNAT compiler, there isn't much point, which is one of the 
reasons why I stopped using them a long time ago.

-- Marc A. Criley
-- McKae Technologies
-- www.mckae.com
-- DTraq - XPath In Ada - XML EZ Out



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compiling separates with GPS GPL version (Ada 2005 i think)
  2006-03-01 14:19 ` Marc A. Criley
@ 2006-03-01 22:22   ` stuart clark
  2006-03-01 22:22   ` stuart clark
  2006-03-03  6:20   ` Simon Wright
  2 siblings, 0 replies; 6+ messages in thread
From: stuart clark @ 2006-03-01 22:22 UTC (permalink / raw)


Thanks, i didnt even check to see if when i compiled the body it had
"built" the separates.

I compiled the body and then tried to compile the separate, DOOHHH !!!!!




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compiling separates with GPS GPL version (Ada 2005 i think)
  2006-03-01 14:19 ` Marc A. Criley
  2006-03-01 22:22   ` stuart clark
@ 2006-03-01 22:22   ` stuart clark
  2006-03-03  6:20   ` Simon Wright
  2 siblings, 0 replies; 6+ messages in thread
From: stuart clark @ 2006-03-01 22:22 UTC (permalink / raw)


Thanks, i didnt even check to see if when i compiled the body it had
"built" the separates.

I compiled the body and then tried to compile the separate, DOOHHH !!!!!




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compiling separates with GPS GPL version (Ada 2005 i think)
  2006-03-01 14:19 ` Marc A. Criley
  2006-03-01 22:22   ` stuart clark
  2006-03-01 22:22   ` stuart clark
@ 2006-03-03  6:20   ` Simon Wright
  2006-03-03 22:24     ` Randy Brukardt
  2 siblings, 1 reply; 6+ messages in thread
From: Simon Wright @ 2006-03-03  6:20 UTC (permalink / raw)


"Marc A. Criley" <mcNOSPAM@mckae.com> writes:

> So, you ask, why even bother having subunits?  Precisely! :-) If
> you're using a GNAT compiler, there isn't much point, which is one
> of the reasons why I stopped using them a long time ago.

(a) my ColdFrame (http://coldframe.sf.net/) generates code from a UML
model; it generates subprogram, task and protected type
implementations as separates, so that I don't have to worry about
preserving your code when I recreate the generated stuff.

(b) I find separates handy for eg unit tests, where there's a set of
test cases each of which is quite large (has a number of test
procedures); I've implemented each test case as a package with a
separate body.

I agree with Marc that you need a good reason for using separates (if
nothing else, because of the increased number of files which need CM!)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compiling separates with GPS GPL version (Ada 2005 i think)
  2006-03-03  6:20   ` Simon Wright
@ 2006-03-03 22:24     ` Randy Brukardt
  0 siblings, 0 replies; 6+ messages in thread
From: Randy Brukardt @ 2006-03-03 22:24 UTC (permalink / raw)


"Simon Wright" <simon@pushface.org> wrote in message
news:m2fym06od0.fsf@grendel.local...
> "Marc A. Criley" <mcNOSPAM@mckae.com> writes:
>
> > So, you ask, why even bother having subunits?  Precisely! :-) If
> > you're using a GNAT compiler, there isn't much point, which is one
> > of the reasons why I stopped using them a long time ago.
...
(some good reasons for using separates)
...
(c) a separate can have its own with clauses, so this provides a way to
reduce the visibility of rarely used components. (After all, a good rule to
follow is to limit everything to the smallest scope where it is needed.)

(d) Most compilers really do compile these things separately. In a large
unit with frequent changes, this can save a lot of time. (Although that was
much more true when PC's were 4 MHZ, not the 4 GHZ that they are today. On
the IBM PC, the average compilation with Janus/Ada took over 10 seconds, and
long units could take much longer...)

                       Randy.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-03-03 22:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-01 12:37 Compiling separates with GPS GPL version (Ada 2005 i think) stuart clark
2006-03-01 14:19 ` Marc A. Criley
2006-03-01 22:22   ` stuart clark
2006-03-01 22:22   ` stuart clark
2006-03-03  6:20   ` Simon Wright
2006-03-03 22:24     ` Randy Brukardt

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