comp.lang.ada
 help / color / mirror / Atom feed
From: anon@anon.org (anon)
Subject: Re: What are the limitations imposed by GNAT without runtime?
Date: Wed, 10 Oct 2007 17:51:40 GMT
Date: 2007-10-10T17:51:40+00:00	[thread overview]
Message-ID: <Mi8Pi.199957$ax1.18334@bgtnsc05-news.ops.worldnet.att.net> (raw)
In-Reply-To: 1192010655.057857.9760@k79g2000hse.googlegroups.com

Actually, the string names for the type Wah does not exist if you use the 
"pragma NO_RUN_TIME". The compiler does not generated the code. So in 
order to do a "type-to-string" conversion you will have to build a 
function. That actually replaces the function that is use for attribute 
"IMAGE". And in that function the string names will exist.  Just like if you 
need the IMAGE attribute for a numeric object you will need to build a 
function to convert that numeric data to a string data. 

  To test this type:   "gnat compile kernel.adb -S" 
  Then check the file: "kernel.s"

    You will see that without the "pragma NO_RUN_TIME" statement 
    there is a data string of "ONETWO" which can be use by IMAGE 
    attribute.  But with the pragma the string "ONETWO" is 
    removed as well as the code that uses the data string, so 
    you have to build your own version.

Now in my answer I provide an example function based on your type with 
two objects. If you had a type with more than a couple of objects, then
you might want to use an array with the type value as part of the index 
algorithm to that array. 


This is one of the problems using the "pragma NO_RUN_TIME ;" 
statement! Which became obsolescent after GNAT 3.15P . 


From the GNAT_RM 3.15P :

Implementation Defined Pragmas
******************************

 ...

`pragma No_Run_Time'
     Syntax:

          pragma No_Run_Time;

     This is a configuration pragma that makes sure the user code does
     not use nor need anything from the GNAT run time.  This is mostly
     useful in context where code certification is required.  Please
     consult the `GNAT Pro High-Integrity Edition User's Guide' for
     additional information.


Now, from the GCC 4.3 => GNAT_RM :

Chapter 14: Obsolescent Features                                    211

 14 Obsolescent Features

 This chapter describes features that are provided by GNAT, but are 
 considered obsolescent since there are preferred ways of achieving 
 the same effect. These features are provided solely for historical 
 compatibility purposes.

 14.1 pragma No Run Time

 The pragma No_Run_Time is used to achieve an affect similar to the 
 use of the "Zero Foot Print" configurable run time, but without 
 requiring a specially configured run time. The result of using this 
 pragma, which must be used for all units in a partition, is to 
 restrict the use of any language features requiring run-time support 
 code. The preferred usage is to use an appropriately configured 
 run-time that includes just those features that are to be made 
 accessible.



 <1192010655.057857.9760@k79g2000hse.googlegroups.com>,  Lucretia <lucretia9@lycos.co.uk> writes:
>> procedure Kernel is
>>
>>   type Wah is ( One, Two ) ;
>>
>>   -- ------------------------------------------------ --
>>   -- Simple function replaces the Image attribute for --
>>   -- Wah type                                         --
>>   -- ------------------------------------------------ --
>>   function Image_Wah ( V : Wah ) return String is
>>
>>     begin -- Image_Wah
>>
>>       if V = One then
>>         return "One" ;
>>       else
>>         return "Two" ;
>>       end if ;
>>
>>     end Image_Wah ;
>
>This isn't much of an option as the compiler already creates the
>strings for these in the data section. I'm not sure if these 2 other
>strings would be created again or not.
>
>Luke.
>




  reply	other threads:[~2007-10-10 17:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-09 16:28 What are the limitations imposed by GNAT without runtime? Lucretia
2007-10-09 20:10 ` anon
2007-10-10  4:39   ` Simon Wright
2007-10-10 10:07     ` Lucretia
2007-10-10 10:04   ` Lucretia
2007-10-10 17:51     ` anon [this message]
2007-10-10 19:00       ` Lucretia
2007-10-10 19:24         ` Lucretia
2007-10-11  3:05         ` anon
replies disabled

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