Ada Bare Bones: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Line 64: Line 64:
pragma Restrictions (No_Enumeration_Maps);
pragma Restrictions (No_Enumeration_Maps);
pragma Normalize_Scalars;
pragma Normalize_Scalars;
pragma Restrictions (No_Exception_Handlers);
pragma Restrictions (No_Exception_Propagation);
pragma Restrictions (No_Finalization);
pragma Restrictions (No_Finalization);
pragma Restrictions (No_Tasking);
pragma Restrictions (No_Tasking);
Line 106: Line 106:


This forces the compiler to disallow any attempt to raise an exception over a subprogram boundary. All exceptions are caught with the Last_Chance_Handler subprogram. See [http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gnat_rm/No_005fException_005fPropagation.html#No_005fException_005fPropagation GNAT RM:No_Exception_Propagation] for more information.
This forces the compiler to disallow any attempt to raise an exception over a subprogram boundary. All exceptions are caught with the Last_Chance_Handler subprogram. See [http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gnat_rm/No_005fException_005fPropagation.html#No_005fException_005fPropagation GNAT RM:No_Exception_Propagation] for more information.

The [http://docs.adacore.com/gnat-hie-docs/html/gnathie_ug_3.html#SEC8 GNAT High Integrity Edition] documentation states the folowing:

<blockquote>
Exception declarations and raise statements are still permitted under this restriction. A raise statement is compiled into a call of __gnat_last_chance_handler.
</blockquote>

I have been unable, thus far, to raise my own exceptions, although I can declare one at library level. On placing a declaration inside console.ads:

<source lang="ada">
TE : exception; -- A badly named exception.
</source>

and raising inside bare_bones.adb:

<source lang="ada">
raise Console.TE;
exception
when Console.TE =>
Put ("TE caught", 1, 2);
</source>

and upon compiling, I get the following:

<pre>
bare_bones.adb:17:04: construct not allowed in configurable run-time mode
bare_bones.adb:17:04: file a-except.ads not found
bare_bones.adb:17:04: entity "Ada.Exceptions.Raise_Exception" not available
gnatmake: "/home/laguest/src/mine/bare_bones/src/bare_bones.adb" compilation error
make: *** [disk/boot/bare_bones] Error 4
</pre>

so the compiler is looking for the Ada.Exceptions package which defines the normal language standard exception handling, not the cut down version we are using here. Do the same with one of the language defined exceptions works fine. ''I will file a bug at FSF for this as I believe it to be incorrect''.


====No_Finalization====
====No_Finalization====