comp.lang.ada
 help / color / mirror / Atom feed
* elab pragma placement
@ 2023-01-21 23:43 Simon Belmont
  2023-01-22  8:15 ` Luke A. Guest
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Belmont @ 2023-01-21 23:43 UTC (permalink / raw)


Where is the right spot to apply an elaboration pragma to a library level subprogram?  GNAT (20210519-103) complains that in the below code C cannot with subprogram A.B because it's not Pure, but it certainly appears to be, and no amount of shuffling around the pragma in B seems to placate it.  Playing with the declaration of T seems to change the behavior; is GNAT is just misreporting a different error?

Thanks

-sb


package A is
  pragma Pure;  
  type T is limited null record;
end A;

procedure A.B (x : T) is
  pragma Pure; -- is this the right spot?
begin
  null;
end A.B;

with A.B;  -- error: cannot depend on "B" (wrong categorization)
package C is
  pragma Pure;
end C;

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

* Re: elab pragma placement
  2023-01-21 23:43 elab pragma placement Simon Belmont
@ 2023-01-22  8:15 ` Luke A. Guest
  2023-01-22  9:55   ` AdaMagica
  0 siblings, 1 reply; 5+ messages in thread
From: Luke A. Guest @ 2023-01-22  8:15 UTC (permalink / raw)


On 21/01/2023 23:43, Simon Belmont wrote:
> Where is the right spot to apply an elaboration pragma to a library level subprogram?  GNAT (20210519-103) complains that in the below code C cannot with subprogram A.B because it's not Pure, but it certainly appears to be, 

To be pure it can contain only things that can be pre-elaborated, iirc, 
so only types, no functions.

> and no amount of shuffling around the pragma in B seems to placate it.  Playing with the declaration of T seems to change the behavior; is GNAT is just misreporting a different error?
> 
> Thanks
> 
> -sb
> 
> 
> package A is
>    pragma Pure;
>    type T is limited null record;
> end A;
> 
> procedure A.B (x : T) is
>    pragma Pure; -- is this the right spot?
> begin
>    null;
> end A.B;
> 
> with A.B;  -- error: cannot depend on "B" (wrong categorization)
> package C is
>    pragma Pure;
> end C;

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

* Re: elab pragma placement
  2023-01-22  8:15 ` Luke A. Guest
@ 2023-01-22  9:55   ` AdaMagica
  2023-01-22 23:14     ` Rod Kay
  0 siblings, 1 reply; 5+ messages in thread
From: AdaMagica @ 2023-01-22  9:55 UTC (permalink / raw)


A subprogram is a program unit and may be declared pure. I do not see that A.B performs any of 10.2.1(15ff).

I tried
procedure A.B (x : T) with Pure;
which is accepted together with its body and still got the compiler complaint.

Looks like a compiler problem.

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

* Re: elab pragma placement
  2023-01-22  9:55   ` AdaMagica
@ 2023-01-22 23:14     ` Rod Kay
  2023-01-22 23:18       ` Rod Kay
  0 siblings, 1 reply; 5+ messages in thread
From: Rod Kay @ 2023-01-22 23:14 UTC (permalink / raw)


On 22/1/23 20:55, AdaMagica wrote:
> A subprogram is a program unit and may be declared pure. I do not see that A.B performs any of 10.2.1(15ff).
> 
> I tried
> procedure A.B (x : T) with Pure;
> which is accepted together with its body and still got the compiler complaint.
> 
> Looks like a compiler problem.

    If you are on linux, then you could set the stack size with

    $ ulimit -s unlimited
    $ launch_my_app



Regards.

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

* Re: elab pragma placement
  2023-01-22 23:14     ` Rod Kay
@ 2023-01-22 23:18       ` Rod Kay
  0 siblings, 0 replies; 5+ messages in thread
From: Rod Kay @ 2023-01-22 23:18 UTC (permalink / raw)


On 23/1/23 10:14, Rod Kay wrote:
> On 22/1/23 20:55, AdaMagica wrote:
>> A subprogram is a program unit and may be declared pure. I do not see 
>> that A.B performs any of 10.2.1(15ff).
>>
>> I tried
>> procedure A.B (x : T) with Pure;
>> which is accepted together with its body and still got the compiler 
>> complaint.
>>
>> Looks like a compiler problem.
> 
>     If you are on linux, then you could set the stack size with
> 
>     $ ulimit -s unlimited
>     $ launch_my_app
> 
> 
> 
> Regards.


Sorry, wrong thread :/ .

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

end of thread, other threads:[~2023-01-22 23:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-21 23:43 elab pragma placement Simon Belmont
2023-01-22  8:15 ` Luke A. Guest
2023-01-22  9:55   ` AdaMagica
2023-01-22 23:14     ` Rod Kay
2023-01-22 23:18       ` Rod Kay

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