comp.lang.ada
 help / color / mirror / Atom feed
From: Phil Thornley <phil.jpthornley@googlemail.com>
Subject: Re: Workaround for invariant SPARK condition
Date: Thu, 25 Jun 2009 00:48:01 -0700 (PDT)
Date: 2009-06-25T00:48:01-07:00	[thread overview]
Message-ID: <60fb6c3e-3f41-40a6-a445-4d8e12cc49a3@v4g2000vba.googlegroups.com> (raw)
In-Reply-To: a3fc8e4b-93a4-4b91-a858-7441842ce7f7@e20g2000vbc.googlegroups.com

On 25 June, 00:03, xorque <xorquew...@googlemail.com> wrote:
> Hello.
>
> I have a piece of code that does this:
>
> function Check_Support (Request : in Request_t) return Boolean is
> begin
>   return Request /= Unsupported;
> end Check_Support;
>
> I'm using it in some code:
>
> if Check_Support (Request_Push) then
>   ...
> end if;
>
> Request_Push is a compile-time constant with an implementation-defined
> value. Given that the value is detected at compile-time, SPARK thinks
> the
> condition is invariant.
>
> Is there some way I can tell SPARK that this condition isn't actually
> invariant,
> even though it appears to be?

You could turn it into a variable, but then it would infiltrate into
all the annotations, which you probably don't want.

This is the sort of problem that the accept annotation is there for:
   --# accept F, 22, "Value is implementation defined.";
   if Check_Support (Request_Push) then
   --# end accept;

Phil Thornley




  reply	other threads:[~2009-06-25  7:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-24 23:03 Workaround for invariant SPARK condition xorque
2009-06-25  7:48 ` Phil Thornley [this message]
2009-06-25  8:50   ` Rod Chapman
2009-06-25 11:19     ` xorque
replies disabled

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