From: Alex R. Mosteo on
Yannick Duchêne (Hibou57) wrote:

> Le Tue, 01 Jun 2010 21:04:44 +0200, Simon Wright <simon(a)pushface.org> a
> écrit:
>> First, you may need to use -gnatn or -gnatN and at least -O2 (have to
>> look up the manual for this).
> I've just noticed the same a short moment ago, indeed ;)

I've played with -gnatn and -gnatN in the past, and found that the latter
tends to bomb the compiler quite a lot. (GPL2008 and 2009 experiences).
Anyone seeing the same?

From: Vadim Godunko on
On Jun 2, 3:11 pm, "Alex R. Mosteo" <alejan...(a)mosteo.invalid> wrote:
>
> I've played with -gnatn and -gnatN in the past, and found that the latter
> tends to bomb the compiler quite a lot. (GPL2008 and 2009 experiences).
> Anyone seeing the same?

-gnatN is obsolete, you must use pragma Inline/Inline_Always with -
gnatn instead.
From: Georg Bauhaus on
On 02.06.10 16:39, Vadim Godunko wrote:
> On Jun 2, 3:11 pm, "Alex R. Mosteo" <alejan...(a)mosteo.invalid> wrote:
>>
>> I've played with -gnatn and -gnatN in the past, and found that the latter
>> tends to bomb the compiler quite a lot. (GPL2008 and 2009 experiences).
>> Anyone seeing the same?
>
> -gnatN is obsolete, you must use pragma Inline/Inline_Always with -
> gnatn instead.

Does this mean that 3rd party source cannot be
inlined across units unless GNAT specific pragma Inline_Always
is added to these 3rd party sources?
From: Yannick Duchêne (Hibou57) on
Le Wed, 02 Jun 2010 18:45:09 +0200, Georg Bauhaus
<rm.dash-bauhaus(a)futureapps.de> a écrit:
>> -gnatN is obsolete, you must use pragma Inline/Inline_Always with -
>> gnatn instead.
>
> Does this mean that 3rd party source cannot be
> inlined across units unless GNAT specific pragma Inline_Always
> is added to these 3rd party sources?
The option is supported, it's sure, I've checked it. In the mean time, GPS
does not provide it in project options (only -gnatn is supplied). May be
while still supported, this is a bit broken, thus not recommended and not
made visible.

As the option is supported, there should be no need to modify any third
party source.


--
There is even better than a pragma Assert: a SPARK --# check.
--# check C and WhoKnowWhat and YouKnowWho;
--# assert Ada;
-- i.e. forget about previous premises which leads to conclusion
-- and start with new conclusion as premise.
From: Vadim Godunko on
On Jun 2, 8:45 pm, Georg Bauhaus <rm.dash-bauh...(a)futureapps.de>
wrote:
> On 02.06.10 16:39, Vadim Godunko wrote:
>
> > -gnatN is obsolete, you must use pragma Inline/Inline_Always with -
> > gnatn instead.
>
> Does this mean that 3rd party source cannot be
> inlined across units unless GNAT specific pragma Inline_Always
> is added to these 3rd party sources?
No. Use of -gnatn and -O is sufficient to enable inlining of
subprograms marked by pragma Inline. But not all subprograms will be
inlined but only definitely simple.

For example:

package P is
function Simple (X, Y : Integer) return Integer;
pragma Inline (Simple);
function Complex (X, Y : Integer) return Integer;
pragma Inline (Complex);
end P;

package body P is
function Simple (X, Y : Integer) return Integer is
begin
return X + Y + 1;
end Simple;
function Complex (X, Y : Integer) return Integer is
begin
return X + Y + 1;
exception
when others =>
return 0;
end Complex;
end P;

with P;
function Test_Simple (X, Y : Integer) return Integer is
begin
return P.Simple (X, Y);
end Test_Simple;

with P;
function Test_Complex (X, Y : Integer) return Integer is
begin
return P.Complex (X, Y);
end Test_Complex;

$ gcc -c -S -O -gnatn test_simple.adb
$ gcc -c -S -O -gnatn test_complex.adb

From test_simple.s:

_ada_test_simple:
leal 1(%rdi,%rsi), %eax
ret

From test_complex.s:

_ada_test_complex:
subq $8, %rsp
call p__complex
addq $8, %rsp
ret
 | 
Pages: 1
Prev: Shared library project
Next: ANN: Ahven 1.8