comp.lang.ada
 help / color / mirror / Atom feed
* Interrupt_Handler and "directly specified"
@ 2015-11-20 18:33 G.B.
  2015-11-20 19:22 ` Simon Wright
  2015-11-20 21:25 ` Randy Brukardt
  0 siblings, 2 replies; 4+ messages in thread
From: G.B. @ 2015-11-20 18:33 UTC (permalink / raw)


For a protected handler, I had specified an aspect,

    procedure On_1
    with Interrupt_Handler => True;

and got a strange compiler diagnostic, listed below.

Is the above syntax correct?

I could drop " => True" and the compiler seemed happy. OTOH,
the RM states, in C.3.1 6.2/3, that "if not directly specified,
the aspect is False".

I don't know what "directly specified" in RM C.3.1 means,
exactly. Does it mean just specified as opposed to no
such aspect specified (in source, near it)? So drop "=> ..."
for truth?

The pragma version of Interrupt_Handler seems to support
this view in that it has only one argument, the procedure name.
But the mention of "False" in the RM lets me ask.

The example:

$ PATH=/opt/GNAT2015/bin:$PATH gcc -c -gnatlv -gnatwa parent.ads 
parent-admin.adb

GNAT GPL 2015 (20150428-49)
Copyright 1992-2015, Free Software Foundation, Inc.


Compiling: parent.ads
Source file time stamp: 2015-11-20 18:10:41
Compiled at: 2015-11-20 19:18:28

      1. package Parent is
      2. private
      3. end Parent;

  3 lines: No errors

GNAT GPL 2015 (20150428-49)
Copyright 1992-2015, Free Software Foundation, Inc.


Compiling: parent-admin.adb
Source file time stamp: 2015-11-20 18:18:17
Compiled at: 2015-11-20 19:18:28

      1.
      2. package body Parent.Admin is
      3.
      4.    protected body P1 is
      5.
      6.       procedure On_1
               |
         >>> expected type "System.Interrupts.Dynamic_Interrupt_Protection"
         >>> found private type 
"System.Tasking.Protected_Objects.Protection"

      7.       is begin
      8.          null;
      9.       end On_1;
     10.
     11.    end P1;
     12.
     13. end Parent.Admin;

Compiling: parent-admin.ads
Source file time stamp: 2015-11-20 18:18:10
Compiled at: 2015-11-20 19:18:28

      1.
      2. package Parent.Admin is
      3.
      4.    protected P1 is
      5.
      6.       procedure On_1
      7.       with Interrupt_Handler => True;
      8.
      9.    end P1;
     10.
     11. end Parent.Admin;

  13 lines: 2 errors


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

* Re: Interrupt_Handler and "directly specified"
  2015-11-20 18:33 Interrupt_Handler and "directly specified" G.B.
@ 2015-11-20 19:22 ` Simon Wright
  2015-11-20 21:25 ` Randy Brukardt
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Wright @ 2015-11-20 19:22 UTC (permalink / raw)


"G.B." <bauhaus@futureapps.invalid> writes:

> For a protected handler, I had specified an aspect,
>
>    procedure On_1
>    with Interrupt_Handler => True;
>
> and got a strange compiler diagnostic, listed below.

> Compiling: parent-admin.adb
> Source file time stamp: 2015-11-20 18:18:17
> Compiled at: 2015-11-20 19:18:28
>
>      1.
>      2. package body Parent.Admin is
>      3.
>      4.    protected body P1 is
>      5.
>      6.       procedure On_1
>               |
>         >>> expected type "System.Interrupts.Dynamic_Interrupt_Protection"
>         >>> found private type
> "System.Tasking.Protected_Objects.Protection"
>
>      7.       is begin
>      8.          null;
>      9.       end On_1;
>     10.
>     11.    end P1;
>     12.
>     13. end Parent.Admin;

>  13 lines: 2 errors

(a) I can only see one error?
(b) that is a compiler error (problem with internal representations of
intermediate code, I think)
(c) what is it doing on the body!!
(d) GCC 6 does the same
(e) if you say "with Interrupt_Handler => False" it compiles OK, but who
    knows what it means!

Report the error!


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

* Re: Interrupt_Handler and "directly specified"
  2015-11-20 18:33 Interrupt_Handler and "directly specified" G.B.
  2015-11-20 19:22 ` Simon Wright
@ 2015-11-20 21:25 ` Randy Brukardt
  2015-11-22  9:59   ` Georg Bauhaus
  1 sibling, 1 reply; 4+ messages in thread
From: Randy Brukardt @ 2015-11-20 21:25 UTC (permalink / raw)


"G.B." <bauhaus@futureapps.invalid> wrote in message 
news:n2nou4$jap$1@dont-email.me...
> For a protected handler, I had specified an aspect,
>
>    procedure On_1
>    with Interrupt_Handler => True;
>
> and got a strange compiler diagnostic, listed below.
>
> Is the above syntax correct?

Yes.

> I could drop " => True" and the compiler seemed happy. OTOH,
> the RM states, in C.3.1 6.2/3, that "if not directly specified,
> the aspect is False".
>
> I don't know what "directly specified" in RM C.3.1 means,
> exactly. Does it mean just specified as opposed to no
> such aspect specified (in source, near it)? So drop "=> ..."
> for truth?

"directly specified" means explicitly given on this entity (as opposed to 
inheriting a value from some ancestor, which is considered "specified").

If you leave the value off of any aspect specification, the value is True. 
(see 13.1.1(15/3)). So in
    with Pack, Atomic, Pure, Interrupt_Handler, Import;
all of these aspects have the value True. (And you'll get some errors.)

If
    procedure On_1 with Interrupt_Handler;
works and
    procedure On_1 with Interrupt_Handler => True;
does not, you've got a compiler bug, because these mean exactly the same 
thing.

                               Randy.




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

* Re: Interrupt_Handler and "directly specified"
  2015-11-20 21:25 ` Randy Brukardt
@ 2015-11-22  9:59   ` Georg Bauhaus
  0 siblings, 0 replies; 4+ messages in thread
From: Georg Bauhaus @ 2015-11-22  9:59 UTC (permalink / raw)


On 20.11.15 22:25, Randy Brukardt wrote:

>> I don't know what "directly specified" in RM C.3.1 means,
>> exactly. Does it mean just specified as opposed to no
>> such aspect specified (in source, near it)? So drop "=> ..."
>> for truth?
>
> "directly specified" means explicitly given on this entity (as opposed to
> inheriting a value from some ancestor, which is considered "specified").
>
> If you leave the value off of any aspect specification, the value is True.
> (see 13.1.1(15/3)).

Thank you very much for clarifying.

The error is reported,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68481


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

end of thread, other threads:[~2015-11-22  9:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-20 18:33 Interrupt_Handler and "directly specified" G.B.
2015-11-20 19:22 ` Simon Wright
2015-11-20 21:25 ` Randy Brukardt
2015-11-22  9:59   ` Georg Bauhaus

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