comp.lang.ada
 help / color / mirror / Atom feed
* ADA Compile Warning
@ 2001-11-01 14:49 Ronald Rosenfeld
  2001-11-01 17:01 ` Ted Dennison
  0 siblings, 1 reply; 3+ messages in thread
From: Ronald Rosenfeld @ 2001-11-01 14:49 UTC (permalink / raw)


Gentlemen:

    Perhaps someone can help. We use a Rational VADSself Version
6.2.1. ADA compiler for DEC RISC Ultrix machines. When compiling the
following piece of code:

"WITH text_io;  -- WITHs must precede each new package declaration
 WITH base;
 PACKAGE byte_io IS NEW text_io.integer_io (base.byte_type);",

we get the following warning:

"warning: Appendix F: representation of actual prevents code sharing".

Why is the warning pointing to "NEW text_io.integer_io
(base.byte_type);"?

The module "base" has the following code:

--------------------------------------------------------------

"PACKAGE base IS

 --/ Visible Declarations.

 --/ Visible Constants.

   -- Note: Different on FE (PC)
   -- Left to right bit numbers within a byte.
   -- used for transportable boolean flag definitions.
   -- e.g.  FOR .. USE ..  Flag1  AT 0  B0..B0;

   B0              : CONSTANT := 7;
   B1              : CONSTANT := 6;
   B2              : CONSTANT := 5;
   B3              : CONSTANT := 4;
   B4              : CONSTANT := 3;
   B5              : CONSTANT := 2;
   B6              : CONSTANT := 1;
   B7              : CONSTANT := 0;

 --/ Visible Data Types.

 -- General Base Types
 
   SUBTYPE Boolean_type IS 
   -- basic boolean type with possible values of 0 or 1
       BOOLEAN;
 
 -- Integer Base Types

   SUBTYPE Integer32_type IS 
   -- Integer of 32 bits
      INTEGER;

   SUBTYPE Integer16_type IS 
   -- Integer of 16 bits
      SHORT_INTEGER;

   SUBTYPE Integer8_type IS 
   -- Integer of 8 bits
      TINY_INTEGER;

   SUBTYPE AddressInt_type IS INTEGER; -- Integer same size as an
address

 -- Float Base Types

   SUBTYPE Real64_type IS 
   -- Real number of 64 bits
      FLOAT;

   SUBTYPE Real32_type IS 
   -- Real number of 32 bits
      SHORT_FLOAT;

 -- Byte Base Types

   TYPE Byte_type IS NEW 
   -- Byte type  of 8 bits, range 0 .. 255 
      unsigned_types.Unsigned_Integer       
      RANGE 0..255;
   FOR Byte_type'SIZE USE 8;

   TYPE Byte_Array_type IS 
   -- Array of bytes, each byte being 8 bits
      ARRAY( INTEGER RANGE <> ) OF Byte_type;
   PRAGMA PACK(Byte_Array_type);
  
   TYPE Byte_Array_Pointer IS ACCESS Byte_Array_type;

   SUBTYPE Word_type IS 
   -- type word of 0.. 2**16-1 range
      unsigned_types.Unsigned_Integer 
      RANGE 0..2**16-1;
   
   SUBTYPE Double_Word_Type IS 
   -- type word of 0.. 2**32-1 range
      unsigned_types.Unsigned_Integer ;

 -- String Base Types

   TYPE String_Pointer_type IS 
   -- Pointer to the ADA standard type string
      ACCESS STRING;


   SUBTYPE String_Index_type IS
      POSITIVE;
   -- String index type.  Must be same type as STRING index for each
system.

 -- Address Base Constants

   NULL_ADDR        : CONSTANT system.ADDRESS := system.NO_ADDR;
   -- Constant Null address assigned to the system's No Address


 --/ Visible Exceptions.

 PRIVATE

 --/ Private Declarations.

 END base;  --PACKAGE "

--------------------------------------------------------------

Any help would be appreciated.

Ron Rosenfeld



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

* Re: ADA Compile Warning
  2001-11-01 14:49 ADA Compile Warning Ronald Rosenfeld
@ 2001-11-01 17:01 ` Ted Dennison
  2001-11-02 17:42   ` Ronald Rosenfeld
  0 siblings, 1 reply; 3+ messages in thread
From: Ted Dennison @ 2001-11-01 17:01 UTC (permalink / raw)


In article <4ccfed40.0111010649.3f98d88@posting.google.com>, Ronald Rosenfeld
says...
>    Perhaps someone can help. We use a Rational VADSself Version
>6.2.1. ADA compiler for DEC RISC Ultrix machines. When compiling the
>following piece of code:
>
>"WITH text_io;  -- WITHs must precede each new package declaration
> WITH base;
> PACKAGE byte_io IS NEW text_io.integer_io (base.byte_type);",
>
>we get the following warning:
>
>"warning: Appendix F: representation of actual prevents code sharing".
>
>Why is the warning pointing to "NEW text_io.integer_io
>(base.byte_type);"?

This is essentially saying: "Normally, I would share some code between this
generic instantiation of Text_IO.Integer_IO and all other such instantiations to
save space. However, I'm unable to do that in this case because of the way
base.byte_type is defined. Thus I'm going to have to create a separate copy of
all the code inside the generic."

This isn't a really big problem, unless you are making lots of Integer_IO
instantiations. Most Ada compilers don't even implement this generic sharing at
all, so the fact that this one can't do it in this case is really of little
concern.

However, since you appear to be a newbie (based on your capitilzation of "Ada"),
I'd like to ask *why* you are using Integer_IO in the first place. If you just
need a string representation of your integer-derived type,
"Base.Base_Type'image" would do the job much easier. Integer_IO is really only
for situations where you want to display the value in a specific format, or in a
base other than 10.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html

No trees were killed in the sending of this message. 
However a large number of electrons were terribly inconvenienced.



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

* Re: ADA Compile Warning
  2001-11-01 17:01 ` Ted Dennison
@ 2001-11-02 17:42   ` Ronald Rosenfeld
  0 siblings, 0 replies; 3+ messages in thread
From: Ronald Rosenfeld @ 2001-11-02 17:42 UTC (permalink / raw)


Ted Dennison<dennison@telepath.com> wrote in message news:<4efE7.8816$xS6.11821@www.newsranger.com>...
> In article <4ccfed40.0111010649.3f98d88@posting.google.com>, Ronald Rosenfeld
> says...
> >    Perhaps someone can help. We use a Rational VADSself Version
> >6.2.1. ADA compiler for DEC RISC Ultrix machines. When compiling the
> >following piece of code:
> >
> >"WITH text_io;  -- WITHs must precede each new package declaration
> > WITH base;
> > PACKAGE byte_io IS NEW text_io.integer_io (base.byte_type);",
> >
> >we get the following warning:
> >
> >"warning: Appendix F: representation of actual prevents code sharing".
> >
> >Why is the warning pointing to "NEW text_io.integer_io
> >(base.byte_type);"?
> 
> This is essentially saying: "Normally, I would share some code between this
> generic instantiation of Text_IO.Integer_IO and all other such instantiations to
> save space. However, I'm unable to do that in this case because of the way
> base.byte_type is defined. Thus I'm going to have to create a separate copy of
> all the code inside the generic."
> 
> This isn't a really big problem, unless you are making lots of Integer_IO
> instantiations. Most Ada compilers don't even implement this generic sharing at
> all, so the fact that this one can't do it in this case is really of little
> concern.
> 
> However, since you appear to be a newbie (based on your capitilzation of "Ada"),
> I'd like to ask *why* you are using Integer_IO in the first place. If you just
> need a string representation of your integer-derived type,
> "Base.Base_Type'image" would do the job much easier. Integer_IO is really only
> for situations where you want to display the value in a specific format, or in a
> base other than 10.
> 
> ---
> T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
> 
> No trees were killed in the sending of this message. 
> However a large number of electrons were terribly inconvenienced.

Ted,

    Many thanks for your help. You asked me why I am using Integer_IO.
That's a good question. I don't know. I just inherited the software.
It does things in ways I don't understand. I tried your suggestion
with success.

Ron



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

end of thread, other threads:[~2001-11-02 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-01 14:49 ADA Compile Warning Ronald Rosenfeld
2001-11-01 17:01 ` Ted Dennison
2001-11-02 17:42   ` Ronald Rosenfeld

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