comp.lang.ada
 help / color / mirror / Atom feed
From: mockturtle <framefritti@gmail.com>
Subject: Re: Simple Warnings Needs
Date: Wed, 23 Feb 2011 11:56:36 -0800 (PST)
Date: 2011-02-23T11:56:36-08:00	[thread overview]
Message-ID: <a13958e8-ac82-4b50-a931-1a3a706bdff4@glegroupsg2000goo.googlegroups.com> (raw)
In-Reply-To: <8aaf3582-0cc1-4c5f-ab85-eeb7ba569d9e@glegroupsg2000goo.googlegroups.com>

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 criticality of these warnings options: 
>  ** "-gnatwd" (Implicit dereferencing)
>  ** "-gnatwf" (Unreferenced formals)
>  ** "-gnatwh" (Hiding)
>  ** "-gnatwm" (Modified but unreferenced variables)
>  ** "-gnatwk" (Variables that could be constants)
> 

Hmmm... I would say that at least some of these warnings do not induce security threats.  For example, Hiding warning should be raised in a context similar to this (disclaimer: I do not have an Ada compiler at hand [my dog eat it :-)], so I cannot test the code)

  with A;  -- it declares Foo : Integer;
  
  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 := Foo;  
  end Warn;

In this case, I would say, the compiler warns you since you could want to access the Foo in A and you did not notice that you hide it.  I would say that 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 unreferenced variables)  I think that the idea is to warn about "strange" construct: why did you modify that variable if you are not reading it again?  This is strange and maybe it is the consequence of an error.  Again, the risk is having a program with a bug rather than a security threat. 

I do not know about the remaining two.  Maybe "-gnatwk" (Variables that could be constants) it is just about optimization and/or declaring explicitly that the variable will not change, but I am not sure.




  reply	other threads:[~2011-02-23 19:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-23 18:52 Simple Warnings Needs Rego
2011-02-23 19:56 ` mockturtle [this message]
2011-02-23 23:07   ` jpwoodruff
2011-02-23 20:06 ` Ludovic Brenta
2011-02-23 21:55 ` Martin
2011-02-24  8:26   ` Markus Schöpflin
2011-02-26  3:51     ` Rego
replies disabled

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