• elab pragma placement

    From Simon Belmont@21:1/5 to All on Sat Jan 21 15:43:32 2023
    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;

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luke A. Guest@21:1/5 to Simon Belmont on Sun Jan 22 08:15:18 2023
    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;

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From AdaMagica@21:1/5 to All on Sun Jan 22 01:55:07 2023
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rod Kay@21:1/5 to AdaMagica on Mon Jan 23 10:14:18 2023
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rod Kay@21:1/5 to Rod Kay on Mon Jan 23 10:18:14 2023
    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 :/ .

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)