comp.lang.ada
 help / color / mirror / Atom feed
* Pragma Suppress for Bit_Order warnings
@ 2007-07-08 16:31 richtmyer
  2007-07-08 22:11 ` Robert A Duff
  0 siblings, 1 reply; 4+ messages in thread
From: richtmyer @ 2007-07-08 16:31 UTC (permalink / raw)


The Gnat RM (section 6.8) states:

    "Since the misconception that Bit_Order automatically deals with
all endian-related incompatibilities is a common one, the
specification of a component field that is an integral number of bytes
will always generate a warning. This warning may be suppressed using
pragma Suppress if desired."

I have coded:

   for Data'Bit_Order use High_Order_First;
   pragma suppress (xxx);

and I get two warning lines for each bit definition. What is the "xxx"
I need to suppress the compiler warnings?

thanks,
Peter




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

* Re: Pragma Suppress for Bit_Order warnings
  2007-07-08 16:31 Pragma Suppress for Bit_Order warnings richtmyer
@ 2007-07-08 22:11 ` Robert A Duff
  2007-07-09  1:05   ` richtmyer
  2007-07-09  8:42   ` Georg Bauhaus
  0 siblings, 2 replies; 4+ messages in thread
From: Robert A Duff @ 2007-07-08 22:11 UTC (permalink / raw)


richtmyer@cox.net writes:

> The Gnat RM (section 6.8) states:
>
>     "Since the misconception that Bit_Order automatically deals with
> all endian-related incompatibilities is a common one, the
> specification of a component field that is an integral number of bytes
> will always generate a warning. This warning may be suppressed using
> pragma Suppress if desired."
>
> I have coded:
>
>    for Data'Bit_Order use High_Order_First;
>    pragma suppress (xxx);
>
> and I get two warning lines for each bit definition. What is the "xxx"
> I need to suppress the compiler warnings?

I think that's a bug in the documentation.  Pragma Suppress has nothing
to do with suppressing warnings -- it suppresses run-time checks.  To
suppress warnings, use pragma Warnings.  There are many useful options
-- look it up in the docs.  There are also command-line switches
to control warnings.

- Bob



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

* Re: Pragma Suppress for Bit_Order warnings
  2007-07-08 22:11 ` Robert A Duff
@ 2007-07-09  1:05   ` richtmyer
  2007-07-09  8:42   ` Georg Bauhaus
  1 sibling, 0 replies; 4+ messages in thread
From: richtmyer @ 2007-07-09  1:05 UTC (permalink / raw)


On Jul 8, 6:11 pm, Robert A Duff <bobd...@shell01.TheWorld.com> wrote:

> I think that's a bug in the documentation...
>
> - Bob

You are right ... "Pragma Warnings (off);" worked.
I am not used to Robert having bugs   :-)

I am just getting back into Ada after 3.5 years ... seems much longer.

thanks,
Peter




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

* Re: Pragma Suppress for Bit_Order warnings
  2007-07-08 22:11 ` Robert A Duff
  2007-07-09  1:05   ` richtmyer
@ 2007-07-09  8:42   ` Georg Bauhaus
  1 sibling, 0 replies; 4+ messages in thread
From: Georg Bauhaus @ 2007-07-09  8:42 UTC (permalink / raw)


Robert A Duff wrote:
>   To
> suppress warnings, use pragma Warnings.  There are many useful options
> -- look it up in the docs.  There are also command-line switches
> to control warnings.
> 

Command-line switches for controlling compiler warnings seems
a better approach than placing compiler specific pragmas in
an Ada program: When a pragma is implementation specific, it is
effectively adding more warnings when a different compiler is
used, or even when a different edition of the same compiler is
used. This compiler (edition) may have different implementation
defined pragma characteristics. Another compiler might translate
the program but it will also warn about unsupported/differently
supported pragmas.
The very effect the author had intended to suppress, originally!

Another option is to use good IDEs and/or SCM providing diagnostic
message filters. For a start, grep/findstr will serve this purpose
in most PCs/workstations under the sun :-) Adjusting Emacs message
filters is fairly easy; I suppose that GPS's output listings
can be programmed in a similar fashion.

(Some pragmas effectively turn a simple Ada program into a
non-portable program (a vendor and OS lock, perhaps unintented),
e.g. those that say in source which link libraries to use
and how.)



-- Georg



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

end of thread, other threads:[~2007-07-09  8:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-08 16:31 Pragma Suppress for Bit_Order warnings richtmyer
2007-07-08 22:11 ` Robert A Duff
2007-07-09  1:05   ` richtmyer
2007-07-09  8:42   ` Georg Bauhaus

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