From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d679dd7e9c16805a X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad.newshosting.com!newshosting.com!newspeer.monmouth.com!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Selective suppression of warnings --- gnat on GNU/Linux Date: Tue, 30 Dec 2008 18:13:37 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <7a6baa71-80e8-4f3a-80b6-34935bda2fc0@r10g2000prf.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1230678818 16605 192.74.137.71 (30 Dec 2008 23:13:38 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 30 Dec 2008 23:13:38 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:ewfFINs26+/EDaVM5IJD7IUvRy4= Xref: g2news2.google.com comp.lang.ada:4114 Date: 2008-12-30T18:13:37-05:00 List-Id: Michael Mounteney 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