comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Selective suppression of warnings --- gnat on GNU/Linux
Date: Tue, 30 Dec 2008 18:13:37 -0500
Date: 2008-12-30T18:13:37-05:00	[thread overview]
Message-ID: <wccr63p1cke.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 7a6baa71-80e8-4f3a-80b6-34935bda2fc0@r10g2000prf.googlegroups.com

Michael Mounteney <gate02@landcroft.co.uk> writes:

> What I'd like is a pragma that switches-off and switches-on the
> warning over the specific range of lines containing the renamings, but
> no such seems to be available.  I don't want to switch off the warning
> from the command line as that will suppress valid warnings.

GNAT has a whole bunch of ways to suppress warnings.  Look at the docs.
You can suppress warnings in a range of code.  You can suppress
particular types of warnings.  You can suppress all warnings (in a range
of code, or globally).  Pragmas and command-line options.

As someone said, you might want "use type", which makes operators
directly visible, but nothing else.  Or you might want to use
subtypes of Integer.

Three alternative translations of Pascal's:

    type T = A..B;

have been discussed in this thread:

1.    subtype T is Integer range A..B;
2.    type T is new Integer range A..B;
3.    type T is range A..B;

Option 1 matches Pascal semantics most closely.

2 and 3 both might be better Ada style in some cases, but:

It's hard to tell from the Pascal code whether it's better or worse.
Sometimes 1 is better.  It depends on how many type conversions are
needed, and analyzing that would require a fairly sophisticated
translator, with global analysis of the Pascal program.

Option 3 is questionable, because of overflow semantics for intermediate
results in expressions.  In Pascal, if you say (X+Y)/2, it won't
overflow if X+Y is in Integer, but not in A..B.  Same is True in Ada for
option 2, but not necessarily for option 3.

- Bob



  parent reply	other threads:[~2008-12-30 23:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-30  3:13 Selective suppression of warnings --- gnat on GNU/Linux Michael Mounteney
2008-12-30  8:03 ` Ludovic Brenta
2008-12-30 22:49   ` Michael Mounteney
2008-12-30 23:26     ` Robert A Duff
2008-12-30 11:01 ` (see below)
2008-12-30 11:37   ` Georg Bauhaus
2008-12-30 12:05     ` (see below)
2008-12-30 14:11       ` Pascal ranges (was: Selective suppression of warnings --- gnat on GNU/Linux) Georg Bauhaus
2008-12-30 20:19         ` (see below)
2008-12-30 23:19           ` Pascal ranges Robert A Duff
2008-12-30 23:34             ` (see below)
2008-12-31  0:07               ` Robert A Duff
2008-12-31  0:32                 ` (see below)
2008-12-30 23:13 ` Robert A Duff [this message]
2008-12-31  9:46   ` Selective suppression of warnings --- gnat on GNU/Linux Jean-Pierre Rosen
2008-12-31 14:55     ` Robert A Duff
2008-12-31 16:13       ` Jean-Pierre Rosen
2008-12-31 20:01         ` Robert A Duff
2008-12-31 18:43     ` (see below)
2008-12-31 19:49       ` Robert A Duff
2008-12-31 20:24         ` Jeffrey R. Carter
2008-12-31 22:38           ` Robert A Duff
2008-12-31 19:46 ` Jerry
2008-12-31 22:39   ` Robert A Duff
2008-12-31 23:37   ` Michael Mounteney
2009-01-01  9:45   ` sjw
replies disabled

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