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=0.7 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3f92589f15917eec X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: mockturtle Newsgroups: comp.lang.ada Subject: Re: Simple Warnings Needs Date: Wed, 23 Feb 2011 11:56:36 -0800 (PST) Organization: http://groups.google.com Message-ID: Reply-To: comp.lang.ada@googlegroups.com NNTP-Posting-Host: 93.37.244.172 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1298490996 23173 127.0.0.1 (23 Feb 2011 19:56:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 23 Feb 2011 19:56:36 +0000 (UTC) In-Reply-To: <8aaf3582-0cc1-4c5f-ab85-eeb7ba569d9e@glegroupsg2000goo.googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=93.37.244.172; posting-account=9fwclgkAAAD6oQ5usUYhee1l39geVY99 User-Agent: G2/1.0 Xref: g2news1.google.com comp.lang.ada:17561 Date: 2011-02-23T11:56:36-08:00 List-Id: On Wednesday, February 23, 2011 7:52:37 PM UTC+1, Rego wrote: > I would like to know (in more details than gnat documentation) the critic= ality of these warnings options:=20 > ** "-gnatwd" (Implicit dereferencing) > ** "-gnatwf" (Unreferenced formals) > ** "-gnatwh" (Hiding) > ** "-gnatwm" (Modified but unreferenced variables) > ** "-gnatwk" (Variables that could be constants) >=20 Hmmm... I would say that at least some of these warnings do not induce secu= rity threats. For example, Hiding warning should be raised in a context si= milar to this (disclaimer: I do not have an Ada compiler at hand [my dog ea= t it :-)], so I cannot test the code) with A; -- it declares Foo : Integer; =20 procedure Warn is use A; -- make A.Foo visible Foo : integer; -- Warning: Hiding A.Foo Goo : integer; begin -- The local one or the one in A? Goo :=3D Foo; =20 end Warn; In this case, I would say, the compiler warns you since you could want to a= ccess the Foo in A and you did not notice that you hide it. I would say th= at in a typical case this does not give rise to a security threat, but to a= non-working program. About "-gnatwf" (Unreferenced formals), "-gnatwm" (Modified but unreference= d variables) I think that the idea is to warn about "strange" construct: w= hy did you modify that variable if you are not reading it again? This is s= trange and maybe it is the consequence of an error. Again, the risk is hav= ing a program with a bug rather than a security threat.=20 I do not know about the remaining two. Maybe "-gnatwk" (Variables that cou= ld be constants) it is just about optimization and/or declaring explicitly = that the variable will not change, but I am not sure.