comp.lang.ada
 help / color / mirror / Atom feed
* Pragma Unreferenced in GNAT GPL 2008
@ 2008-07-05  5:26 Wilhelm Spickermann
  2008-07-05  7:57 ` Dmitry A. Kazakov
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Wilhelm Spickermann @ 2008-07-05  5:26 UTC (permalink / raw)


After installing GNAT GPL 2008 I get unexpected warnings on
unreferenced variables:

...
      entry Wait (S : Event_State) when True is
      begin
         if S = On then
            requeue Wait_On with abort;
         else
            requeue Wait_Off with abort;
         end if;
      end Wait;

      entry Wait_On (S : Event_State) when Value = On is
         pragma Unreferenced (S);
      begin
         null;
      end Wait_On;
...
"pragma Unreferenced (S);" is honoured by GNAT GPL 2007 and seems
to be ignored by GNAT GPL 2008. 

Is this a compiler bug?

Wilhelm Spickermann




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Pragma Unreferenced in GNAT GPL 2008
  2008-07-05  5:26 Pragma Unreferenced in GNAT GPL 2008 Wilhelm Spickermann
@ 2008-07-05  7:57 ` Dmitry A. Kazakov
  2008-07-05 12:26   ` Wilhelm Spickermann
  2008-07-05 12:51 ` Simon Wright
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Dmitry A. Kazakov @ 2008-07-05  7:57 UTC (permalink / raw)


On Sat, 05 Jul 2008 07:26:49 +0200, Wilhelm Spickermann wrote:

> After installing GNAT GPL 2008 I get unexpected warnings on
> unreferenced variables:
> ...
>       entry Wait (S : Event_State) when True is
>       begin
>          if S = On then
>             requeue Wait_On with abort;
>          else
>             requeue Wait_Off with abort;
>          end if;
>       end Wait;
> 
>       entry Wait_On (S : Event_State) when Value = On is
>          pragma Unreferenced (S);
>       begin
>          null;
>       end Wait_On;
> ...
> "pragma Unreferenced (S);" is honoured by GNAT GPL 2007 and seems
> to be ignored by GNAT GPL 2008. 

Maybe they just have removed it.

But Wait_On need no parameters. It is OK to requeue to a parameterless
entry (9.5.4(3))

P.S. In simple cases, you could try entry families:

   type Event_State is (Signaled, Reset);

   entry Wait (Event_State);

   entry Wait (for S in Event_State) when S = Reset xor Value = On is
   begin
       null;
   end Wait;

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Pragma Unreferenced in GNAT GPL 2008
  2008-07-05  7:57 ` Dmitry A. Kazakov
@ 2008-07-05 12:26   ` Wilhelm Spickermann
  0 siblings, 0 replies; 9+ messages in thread
From: Wilhelm Spickermann @ 2008-07-05 12:26 UTC (permalink / raw)


Dmitry A. Kazakov wrote:

> But Wait_On need no parameters. It is OK to requeue to a
> parameterless entry (9.5.4(3))

Oh, I missed that one and the family-solution.

Thanks,
Wilhelm





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Pragma Unreferenced in GNAT GPL 2008
  2008-07-05  5:26 Pragma Unreferenced in GNAT GPL 2008 Wilhelm Spickermann
  2008-07-05  7:57 ` Dmitry A. Kazakov
@ 2008-07-05 12:51 ` Simon Wright
  2008-07-09  6:37   ` Wilhelm Spickermann
  2008-07-06  0:38 ` anon
  2008-07-08  8:28 ` Alex R. Mosteo
  3 siblings, 1 reply; 9+ messages in thread
From: Simon Wright @ 2008-07-05 12:51 UTC (permalink / raw)


Wilhelm Spickermann <quast.20.unbenutzbar@spamgourmet.com> writes:

> After installing GNAT GPL 2008 I get unexpected warnings on
> unreferenced variables:
>
> ...
>       entry Wait_On (S : Event_State) when Value = On is
>          pragma Unreferenced (S);
>       begin
>          null;
>       end Wait_On;
> ...
> "pragma Unreferenced (S);" is honoured by GNAT GPL 2007 and seems
> to be ignored by GNAT GPL 2008. 
>
> Is this a compiler bug?

It isn't ignored by gcc-4.3.0. I couldn't build GNAT GPL 2008 for
Intel Mac, so can't help there.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Pragma Unreferenced in GNAT GPL 2008
  2008-07-05  5:26 Pragma Unreferenced in GNAT GPL 2008 Wilhelm Spickermann
  2008-07-05  7:57 ` Dmitry A. Kazakov
  2008-07-05 12:51 ` Simon Wright
@ 2008-07-06  0:38 ` anon
  2008-07-09  6:29   ` Wilhelm Spickermann
  2008-07-08  8:28 ` Alex R. Mosteo
  3 siblings, 1 reply; 9+ messages in thread
From: anon @ 2008-07-06  0:38 UTC (permalink / raw)


A quick patch is just to comment out the line. That way the file still 
maintains all original statements.

The "pragma Unreferenced ( ... ) ;" is part of the GNAT extra pragma 
extensions. 

0. So, it depends on where you downloaded the package.  Some maintainer 
   do not recognize the statement, while others do.

1. You can also, check to see if you have;
      pragma Restrictions ( "No_Implementation_Pragmas" ) ;
   in your source or configuration files.  This statement will cause an 
   compiler error, if the compiler encounters any GNAT only "pragma" 
   statement.

2. Then check the command line options.  The GNAT maintainer may have 
   created a command line options to turn on/off GNAT extensions.

In <6d8f0qF1c5qaU1@mid.individual.net>, Wilhelm Spickermann <quast.20.unbenutzbar@spamgourmet.com> writes:
>After installing GNAT GPL 2008 I get unexpected warnings on
>unreferenced variables:
>
>....
>      entry Wait (S : Event_State) when True is
>      begin
>         if S = On then
>            requeue Wait_On with abort;
>         else
>            requeue Wait_Off with abort;
>         end if;
>      end Wait;
>
>      entry Wait_On (S : Event_State) when Value = On is
>         pragma Unreferenced (S);
>      begin
>         null;
>      end Wait_On;
>....
>"pragma Unreferenced (S);" is honoured by GNAT GPL 2007 and seems
>to be ignored by GNAT GPL 2008. 
>
>Is this a compiler bug?
>
>Wilhelm Spickermann
>




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Pragma Unreferenced in GNAT GPL 2008
  2008-07-05  5:26 Pragma Unreferenced in GNAT GPL 2008 Wilhelm Spickermann
                   ` (2 preceding siblings ...)
  2008-07-06  0:38 ` anon
@ 2008-07-08  8:28 ` Alex R. Mosteo
  2008-07-09  6:06   ` Wilhelm Spickermann
  3 siblings, 1 reply; 9+ messages in thread
From: Alex R. Mosteo @ 2008-07-08  8:28 UTC (permalink / raw)


Wilhelm Spickermann wrote:

> After installing GNAT GPL 2008 I get unexpected warnings on
> unreferenced variables:

And I'm being warned that a variable is not referenced when it indeed is (and
it's not a very cornerish case, although it is within a quite large hierarchy
of objects). That seems the contrary, but maybe something has changed in that
area of the compiler.

> 
> ...
>       entry Wait (S : Event_State) when True is
>       begin
>          if S = On then
>             requeue Wait_On with abort;
>          else
>             requeue Wait_Off with abort;
>          end if;
>       end Wait;
> 
>       entry Wait_On (S : Event_State) when Value = On is
>          pragma Unreferenced (S);
>       begin
>          null;
>       end Wait_On;
> ...
> "pragma Unreferenced (S);" is honoured by GNAT GPL 2007 and seems
> to be ignored by GNAT GPL 2008.
> 
> Is this a compiler bug?
> 
> Wilhelm Spickermann




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Pragma Unreferenced in GNAT GPL 2008
  2008-07-08  8:28 ` Alex R. Mosteo
@ 2008-07-09  6:06   ` Wilhelm Spickermann
  0 siblings, 0 replies; 9+ messages in thread
From: Wilhelm Spickermann @ 2008-07-09  6:06 UTC (permalink / raw)


Alex R. Mosteo wrote:

> And I'm being warned that a variable is not referenced when it
> indeed is (and it's not a very cornerish case, although it is
> within a quite large hierarchy of objects). That seems the
> contrary, but maybe something has changed in that area of the
> compiler.
> 

I didn't check it again, but IIRC there have been some changes in
that area:

- Warnings about variables which are accessed only by
initializing or finalizing have been changed. (Additional
compiler options?)

- Variables may be called unused, even if only their contents is
potentially unused. (potentially overwriting the contents of an
in out parameter before using the contents)

(But I don't have the list of changes within reach.)
Wilhelm




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Pragma Unreferenced in GNAT GPL 2008
  2008-07-06  0:38 ` anon
@ 2008-07-09  6:29   ` Wilhelm Spickermann
  0 siblings, 0 replies; 9+ messages in thread
From: Wilhelm Spickermann @ 2008-07-09  6:29 UTC (permalink / raw)


anon wrote:

> A quick patch is just to comment out the line. That way the
> file still maintains all original statements.

That won't help, as the pragma is already ignored. :-)

It's not a problem of getting things compiled -- it's just an
old "finger excercise" used to check the new compiler and I
wondered, if this new behaviour is to be expected.

Thanks,
Wilhelm




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Pragma Unreferenced in GNAT GPL 2008
  2008-07-05 12:51 ` Simon Wright
@ 2008-07-09  6:37   ` Wilhelm Spickermann
  0 siblings, 0 replies; 9+ messages in thread
From: Wilhelm Spickermann @ 2008-07-09  6:37 UTC (permalink / raw)


Simon Wright wrote:

> It isn't ignored by gcc-4.3.0. I couldn't build GNAT GPL 2008
> for Intel Mac, so can't help there.

Thanks anyway. Installation on my PC (Suse Linux 11.0) was easier
than with GNAT GPL 2007 (Suse 10.3), as some installation script
errors were gone. But I'm not sure if I prefer it over the 2007
one, since distributed programming support seems to be gone too.

Wilhelm




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-07-09  6:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-05  5:26 Pragma Unreferenced in GNAT GPL 2008 Wilhelm Spickermann
2008-07-05  7:57 ` Dmitry A. Kazakov
2008-07-05 12:26   ` Wilhelm Spickermann
2008-07-05 12:51 ` Simon Wright
2008-07-09  6:37   ` Wilhelm Spickermann
2008-07-06  0:38 ` anon
2008-07-09  6:29   ` Wilhelm Spickermann
2008-07-08  8:28 ` Alex R. Mosteo
2008-07-09  6:06   ` Wilhelm Spickermann

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