comp.lang.ada
 help / color / mirror / Atom feed
From: Lucretia <laguest9000@googlemail.com>
Subject: s-stoele.ads:62:69: error: cannot convert to a pointer type
Date: Wed, 16 Nov 2016 10:01:34 -0800 (PST)
Date: 2016-11-16T10:01:34-08:00	[thread overview]
Message-ID: <04081823-0013-4bc4-b461-ba9c1a5e40b3@googlegroups.com> (raw)

Hi,

I've been updating my bare_bones project and I've always wanted to add a simple secondary stack to it, so as a dummy interface I created the following in my RTS:

package System.Secondary_Stack is
   package SSE renames System.Storage_Elements;
   
   type Mark_Id is private;
   
   function SS_Mark return Mark_Id;
   
   procedure SS_Allocate
     (Addr         : System.Address;
      Storage_Size : SSE.Storage_Count);
   
   procedure SS_Release (M : Mark_Id);
private
   type Mark_Id is new SSE.Integer_Address;
   
   SS_Pool : Integer;
   
   SS_Size : constant SSE.Storage_Element with
     import        => True,
     Convention    => Asm,
     External_Name => "sec_stack_size";
end System.Secondary_Stack;

package body System.Secondary_Stack is
   function SS_Mark return Mark_Id is
   begin
      return Mark_Id'First;
   end SS_Mark;
   
   procedure SS_Allocate     
     (Addr         : System.Address;
      Storage_Size : SSE.Storage_Count) is
   begin
      null;
   end SS_Allocate;

   procedure SS_Release (M : Mark_Id) is
   begin
      null;
   end SS_Release;
end System.Secondary_Stack;

But when compiling this:

--  Cut out the use/with clauses
procedure Bare_Bones is
   Line : Screen_Height_Range := Screen_Height_Range'First;

   procedure T is
   begin
      Put ("T called", Screen_Width_Range'First, Line);
   end T;
   
   function Hello return String is
   begin
      return "hello";
   end Hello;
begin
   --     null;
   Clear;

   Put ("Hello, bare bones in Ada",
        Screen_Width_Range'First,
        Line);

   Line := Line + 1;

   if Magic = Magic_Value then
      Put ("Magic numbers match!", Screen_Width_Range'First, Line);
   else
      Put ("Magic numbers don't match!", Screen_Width_Range'First, Line);  --  comment

      raise Program_Error;
   end if;

   Line := Line + 1;

   T;
   
   Line := Line + 1;

   Put (Hello, Screen_Width_Range'First, Line);
end Bare_Bones;

I get the following error:

GNAT 4.9.2
Copyright 1992-2014, Free Software Foundation, Inc.
/home/laguest/src/mine/bare_bones/build/gnat/gen/rts/i586/adainclude/s-stoele.ads: In function 'Bare_Bones.Hello':
/home/laguest/src/mine/bare_bones/build/gnat/gen/rts/i586/adainclude/s-stoele.ads:62:69: error: cannot convert to a pointer type

Compiling: /home/laguest/src/mine/bare_bones/src/bare_bones.adb (source file time stamp: 2016-11-16 17:01:32)
 186 lines: No errors
End of compilation
i586-elf-gnatmake: "/home/laguest/src/mine/bare_bones/src/bare_bones.adb" compilation error
makefile:118: recipe for target '/home/laguest/src/mine/bare_bones/build/gnat/gen/pc/debug/disk/boot/bare_bones-i586.elf' failed
make: *** [/home/laguest/src/mine/bare_bones/build/gnat/gen/pc/debug/disk/boot/bare_bones-i586.elf] Error 4

My expanded source is:


pragma restrictions (no_obsolescent_features);
with vga_console;
use vga_console;
with multiboot;
use multiboot;
use type multiboot.multiboot__magic_values;
with system.system__secondary_stack;

procedure bare_bones is
   M9b : system__secondary_stack__mark_id :=
     $system__secondary_stack__ss_mark;
   procedure bare_bones___finalizer;
   freeze bare_bones___finalizer []

   procedure bare_bones___finalizer is
   begin
      $system__secondary_stack__ss_release (M9b);
      return;
   end bare_bones___finalizer;
begin
   line : vga_console__screen_height_range := 1;

   procedure bare_bones__t is
   begin
      vga_console__put__2 ("T called", 1, line, foreground =>
        vga_console__white, background => vga_console__black);
      return;
   end bare_bones__t;

   function bare_bones__hello return string is
   begin
      return "hello";
   end bare_bones__hello;

   vga_console__clear (background => vga_console__black);
   vga_console__put__2 ("Hello, bare bones in Ada", 1, 1, foreground =>
     vga_console__white, background => vga_console__black);
   line := 2;
   if magic = multiboot__magic_value then
      vga_console__put__2 ("Magic numbers match!", 1, 2, foreground =>
        vga_console__white, background => vga_console__black);
   else
      vga_console__put__2 ("Magic numbers don't match!", 1, 2,
        foreground => vga_console__white, background =>
        vga_console__black);
      [program_error "explicit raise"]
   end if;
   line := 3;
   bare_bones__t;
   R7b : constant integer := line + 1;
   [constraint_error when
     not (R7b in 1 .. 25)
     "range check failed"]
   line := R7b;
   B8b : declare
   begin
      vga_console__put__2 (bare_bones__hello, 1, line, foreground =>
        vga_console__white, background => vga_console__black);
   end B8b;
   return;
at end
   bare_bones___finalizer;
end bare_bones;

I'm lost. Anyone have any idea?

             reply	other threads:[~2016-11-16 18:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-16 18:01 Lucretia [this message]
2016-11-16 19:51 ` s-stoele.ads:62:69: error: cannot convert to a pointer type Simon Wright
2016-11-16 19:59   ` Lucretia
2016-11-16 19:53 ` Simon Wright
2016-11-16 20:00   ` Lucretia
replies disabled

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