How do I turn off this warning?

This is a discussion on How do I turn off this warning? within the ADA forums in Programming Languages category; Hi there, I have the following almost-essential code ------------------------------------------------- with System; package V is type Unsigned_2 is mod 2**2; type Unsigned_5 is mod 2**2; type T1 is record Version : Unsigned_2; Inline : Boolean; Command : Unsigned_5; end record; for T1'Bit_Order use System.High_Order_First; for T1 use record Version at 0 range 0..1; Inline at 0 range 2..2; Command at 0 range 3..7; end record; end V; ------------------------------------------------- If I try to compile it with "gnatmake" I obtain the following list of warnings v.ads:17:29: warning: reverse bit order in machine scalar of length 8 v.ads:17:29: warning: little-endian range for component "Version" ...

Go Back   Application Development Forum > Programming Languages > ADA

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 07-22-2008, 04:07 PM
mockturtle
Guest
 
Default How do I turn off this warning?

Hi there,
I have the following almost-essential code

-------------------------------------------------
with System;

package V is
type Unsigned_2 is mod 2**2;
type Unsigned_5 is mod 2**2;

type T1 is
record
Version : Unsigned_2;
Inline : Boolean;
Command : Unsigned_5;
end record;

for T1'Bit_Order use System.High_Order_First;
for T1 use
record
Version at 0 range 0..1;
Inline at 0 range 2..2;
Command at 0 range 3..7;
end record;
end V;
-------------------------------------------------

If I try to compile it with "gnatmake" I obtain the
following list of warnings

v.ads:17:29: warning: reverse bit order in machine scalar of length 8
v.ads:17:29: warning: little-endian range for component "Version" is
6 .. 7
v.ads:18:29: warning: reverse bit order in machine scalar of length 8
v.ads:18:29: warning: little-endian range for component "Inline" is
5 .. 5
v.ads:19:29: warning: reverse bit order in machine scalar of length 8
v.ads:19:29: warning: little-endian range for component "Command" is
0 .. 4

I understand that with

for T1'Bit_Order use System.High_Order_First;

I am requesting the opposite convention of the "natural"
one of my architecture (Linux on Intel), but I am
aware of it and I need it to match the order in
the packets I want to process. I am getting sick of
those warnings and I would like to say to the compiler
"Thank you for your help, but I know what I am doing,
so shut up."

I tried to look at the option list you get by calling "gnatmake" by
itself
and also "-gnatwA" (turn off all optional warning), but with no luck.
Any idea?
Reply With Quote
  #2  
Old 07-22-2008, 04:34 PM
Robert A Duff
Guest
 
Default Re: How do I turn off this warning?

mockturtle <framefritti@gmail.com> writes:

> type Unsigned_5 is mod 2**2;


That doesn't look right. ;-)

I don't know why -gnatwA doesn't work for you.

You should note that this bit-order stuff has been changed (improved)
between Ada 95 and Ada 2005.

- Bob
Reply With Quote
  #3  
Old 07-22-2008, 05:36 PM
Simon Wright
Guest
 
Default Re: How do I turn off this warning?

Try pragma Warnings (Off) and (On) round the representation clauses.
In fact, this works for me (GCC 4.3.0):

for T1 use
record
pragma Warnings (Off);
Version at 0 range 0..1;
Inline at 0 range 2..2;
Command at 0 range 3..7;
pragma Warnings (On);
end record;
Reply With Quote
  #4  
Old 07-23-2008, 07:22 AM
stefan-lucks@see-the.signature
Guest
 
Default Re: How do I turn off this warning?

On Tue, 22 Jul 2008, mockturtle wrote:

> I have the following almost-essential code

[...]
> -------------------------------------------------
>
> If I try to compile it with "gnatmake" I obtain the
> following list of warnings

[...]

> [...] but I am aware of it and I need it to match the order in the
> packets I want to process. I am getting sick of those warnings and I
> would like to say to the compiler "Thank you for your help, but I know
> what I am doing, so shut up."


Try "pragma Warnings (off, <warning message>);".

Read <http://www.adacore.com/2007/11/19/ada-gem-18/>.

So long

Stefan

--
------ Stefan Lucks -- Bauhaus-University Weimar -- Germany ------
Stefan dot Lucks at uni minus weimar dot de
------ I love the taste of Cryptanalysis in the morning! ------

Reply With Quote
  #5  
Old 07-23-2008, 04:23 PM
Simon Wright
Guest
 
Default Re: How do I turn off this warning?

stefan-lucks@see-the.signature writes:

> Try "pragma Warnings (off, <warning message>);".


Possibly overkill in this case; there are 3 lines of code giving 6
warnings (4 unique ones). And you have to turn them on again, or you get
a warning about that too. And (GCC 4.3.0) they don't actually get turned
off unless you do supply the matching On!

for T1 use
record
pragma Warnings
(Off, "reverse bit order in machine scalar of length 8");
pragma Warnings
(Off, "little-endian range for component ""Version"" is 6 .. 7");
Version at 0 range 0..1;
pragma Warnings
(On, "little-endian range for component ""Version"" is 6 .. 7");
pragma Warnings
(Off, "little-endian range for component ""Inline"" is 5 .. 5");
Inline at 0 range 2..2;
pragma Warnings
(On, "little-endian range for component ""Inline"" is 5 .. 5");
pragma Warnings
(Off, "little-endian range for component ""Command"" is 0 .. 4");
Command at 0 range 3..7;
pragma Warnings
(On, "little-endian range for component ""Command"" is 0 .. 4");
pragma Warnings
(On, "reverse bit order in machine scalar of length 8");
end record;
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 07:57 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.