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,71d79ed4fdc42ae2 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!elk.ncren.net!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Make specific warning error with gnat? Date: Tue, 06 Jul 2010 17:12:30 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <82mxuaxmb1.fsf@stephe-leake.org> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1278450737 15216 192.74.137.71 (6 Jul 2010 21:12:17 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 6 Jul 2010 21:12:17 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:fyNtWguxnhZuYLRpeT5VNHxkPkA= Xref: g2news2.google.com comp.lang.ada:13208 Date: 2010-07-06T17:12:30-04:00 List-Id: Markus Schoepflin writes: > I would love to, but I'm dealing with a multi-million LOC legacy code > base of Ada 83 in maintenance mode, which produces quite a large number > of warnings. In that case, I think you should read the docs about the various warning switches, and turn off the ones you wish to ignore, and turn on the ones you wish to fix. Then use -gnatwe to make all warnings (the ones you turned on) into errors. Then fix those: for each warning, if the code is wrong, fix the bug, and if not, use pragma Warnings(Off). Don't be shy about using Warnings(Off). The compiler is sometimes wrong to warn, and the Warnings(Off) (with a suitable comment) documents the fact that something fishy is going on, but in this particular case it's OK. Don't contort the code just to make the compiler happy. It's usually a good idea to use the form of the pragma that gives the warning text. Note that you can turn off warnings globally in two ways: with switches, or with pragmas in a configuration file. The latter can be as fine-grained as you like. For new code, -gnatwae is a good idea. But that's not your case. - Bob