comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Too big
Date: Thu, 24 Mar 2016 07:50:01 +0200
Date: 2016-03-24T07:50:01+02:00	[thread overview]
Message-ID: <dlhdgaF52a9U1@mid.individual.net> (raw)
In-Reply-To: <eb06b468-3a3c-4272-84d9-3a1dcc4a59df@googlegroups.com>

On 16-03-24 00:18 , mike-h@ada-augusta.demon.co.uk wrote:
> "gnatmake -ws -c -u -PC:\Users\Mike\Desktop\Ada\Sudoku_solver\solver.gpr solver-solve.adb
> gcc -c -I- -gnatA C:\Users\Mike\Desktop\Ada\Sudoku_solver\solver-solve.adb
> cannot generate code for file solver-solve.adb (subunit)
> gnatmake: "C:\Users\Mike\Desktop\Ada\Sudoku_solver\solver-solve.adb" compilation error
> [2016-03-23 21:55:41] process exited with status 4 (elapsed time: 03.37s)"
>
> What is the most likely reason? For example, the offending subunit
> contains a large number of "separate" procedures. Would it help to
> wrap them up in a package?

GNAT's message suggests to me that solver-solve.adb is itself a subunit 
(of solver). GNAT cannot fully compile subunits separately; it can check 
their syntax and semantics, but cannot generate code. GNAT generates the 
code for subunits when it compiles the parent unit. So for GNAT, "is 
separate" works somewhat as "#include" in C.

For example, if I have, in solver.adb:

procedure Solver
is
    X : Integer;

    procedure Solve (A : in out Integer)
    is separate;

begin
    X := 14;
    Solve (X);
end Solver;

and then in solver-solve.adb:

separate (Solver)
procedure Solve (A : in out Integer)
is begin
   A := A + 1;
end Solve;

and give the command "gnatmake -ws -c -u solver-solve.adb" I get

gcc -c solver-solve.adb
cannot generate code for file solver-solve.adb (subunit)
gnatmake: "solver-solve.adb" compilation error

but the command "gnatmake -ws -c -u solver.adb" succeeds and creates 
solver.o.

A consequence of this GNAT property is that dividing a large unit into 
subunits decrease source-file size, but does not decrease compile-time.

Can your problem be this simple?

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .


      parent reply	other threads:[~2016-03-24  5:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-23 22:18 Too big mike-h
2016-03-23 22:23 ` Cotswold Mike
2016-03-23 23:04   ` Anh Vo
2016-03-24  7:51     ` Cotswold Mike
2016-03-23 23:05 ` Robert A Duff
2016-03-23 23:25 ` rieachus
2016-03-24  5:50 ` Niklas Holsti [this message]
replies disabled

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