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: a07f3367d7,71d79ed4fdc42ae2 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Make specific warning error with gnat? Date: Fri, 2 Jul 2010 15:17:04 -0500 Organization: Jacob Sparre Andersen Message-ID: References: <82mxuaxmb1.fsf@stephe-leake.org> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1278101826 27108 69.95.181.76 (2 Jul 2010 20:17:06 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 2 Jul 2010 20:17:06 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news1.google.com comp.lang.ada:12151 Date: 2010-07-02T15:17:04-05:00 List-Id: "Markus Schoepflin" wrote in message news:i0kcdn$g44$1@nntp.ilk.net... ... > I neither have the time nor the resources available to fix all of them, > nor am I allowed to do so. But if the compiler already knows that there > will be a constraint error at runtime, I would have liked the compilation > to fail. Keep in mind that such a message may occur in cases where there is no actual problem. That can often happen if you have code that is conditional on constants. To take an extreme example, if you have: Max_Items := constant := 0; and then the code is: if Max_Items /= 0 then Average := Float(Count)/Float(Max_Items); -- (1) else Average := 0.0; end if; The code at (1) would raise Constraint_Error if it was executed, but of course it can never be executed. If you change the warning to an error here, you won't be able to compile the code without removing or changing the expression at (1), and that would cause problems if/when Max_Items is set to a different value. Randy.