* No_Implicit_Heap_Allocations
@ 2011-01-27 10:38 Maciej Sobczak
2011-01-27 11:00 ` No_Implicit_Heap_Allocations Maciej Sobczak
2011-01-27 11:06 ` No_Implicit_Heap_Allocations Mark Lorenzen
0 siblings, 2 replies; 9+ messages in thread
From: Maciej Sobczak @ 2011-01-27 10:38 UTC (permalink / raw)
Consider this reduced test:
-- file p.ads:
package P is
procedure Wait_Until_Something;
end P;
-- file p.adb:
package body P is
protected Object is
entry Wait_Until_Something;
private
Something : Boolean := False;
end Object;
protected body Object is
entry Wait_Until_Something when Something is
begin
null;
end Wait_Until_Something;
end Object;
procedure Wait_Until_Something is
begin
Object.Wait_Until_Something;
end Wait_Until_Something;
end P;
-- file foo.adb:
pragma Restrictions (No_Implicit_Heap_Allocations);
with P;
procedure Foo is
begin
null;
end Foo;
Now the interesting part:
$ gnatmake foo
gcc -c p.adb
gnatbind -x foo.ali
error: "foo.adb" has restriction No_Implicit_Heap_Allocations
error: but the following files violate this restriction:
error: "p.adb"
gnatmake: *** bind failed.
$
What happens here? In what way p.adb violates the restriction on
implicit heap usage?
I don't see anything there that could possibly violate it and if it
does due to internals of this trivial protected object, then I think
Ravenscar programs are in trouble.
This is GNAT GPL 2009 on Linux-x86.
--
Maciej Sobczak * www.msobczak.com * www.inspirel.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: No_Implicit_Heap_Allocations
2011-01-27 10:38 No_Implicit_Heap_Allocations Maciej Sobczak
@ 2011-01-27 11:00 ` Maciej Sobczak
2011-01-27 11:06 ` No_Implicit_Heap_Allocations Mark Lorenzen
1 sibling, 0 replies; 9+ messages in thread
From: Maciej Sobczak @ 2011-01-27 11:00 UTC (permalink / raw)
On Jan 27, 11:38 am, Maciej Sobczak <see.my.homep...@gmail.com> wrote:
> This is GNAT GPL 2009 on Linux-x86.
Sorry, there was a typo.
This is GNAT GPL 2010 (20100603) on Linux-x86.
--
Maciej Sobczak * www.msobczak.com * www.inspirel.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: No_Implicit_Heap_Allocations
2011-01-27 10:38 No_Implicit_Heap_Allocations Maciej Sobczak
2011-01-27 11:00 ` No_Implicit_Heap_Allocations Maciej Sobczak
@ 2011-01-27 11:06 ` Mark Lorenzen
2011-01-27 15:49 ` No_Implicit_Heap_Allocations Maciej Sobczak
1 sibling, 1 reply; 9+ messages in thread
From: Mark Lorenzen @ 2011-01-27 11:06 UTC (permalink / raw)
On 27 Jan., 11:38, Maciej Sobczak <see.my.homep...@gmail.com> wrote:
>
> What happens here? In what way p.adb violates the restriction on
> implicit heap usage?
> I don't see anything there that could possibly violate it and if it
> does due to internals of this trivial protected object, then I think
> Ravenscar programs are in trouble.
>
> This is GNAT GPL 2009 on Linux-x86.
Add pragma Restrictions (No_Implicit_Heap_Allocations) the
specification of P and it will build.
- Mark L
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: No_Implicit_Heap_Allocations
2011-01-27 11:06 ` No_Implicit_Heap_Allocations Mark Lorenzen
@ 2011-01-27 15:49 ` Maciej Sobczak
2011-01-27 18:07 ` No_Implicit_Heap_Allocations Vinzent Hoefler
0 siblings, 1 reply; 9+ messages in thread
From: Maciej Sobczak @ 2011-01-27 15:49 UTC (permalink / raw)
On Jan 27, 12:06 pm, Mark Lorenzen <mark.loren...@gmail.com> wrote:
> Add pragma Restrictions (No_Implicit_Heap_Allocations) the
> specification of P and it will build.
That is true, but it still looks like a compiler bug to me.
I should not add all possible Restrictions to my library units just in
case any of them will be some day used in a program that imposes any
of these restrictions, right?.
This check should be done automagically and in fact different versions
of GNAT behave differently in this regard.
--
Maciej Sobczak * http://www.inspirel.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: No_Implicit_Heap_Allocations
2011-01-27 15:49 ` No_Implicit_Heap_Allocations Maciej Sobczak
@ 2011-01-27 18:07 ` Vinzent Hoefler
2011-01-27 22:13 ` No_Implicit_Heap_Allocations Maciej Sobczak
0 siblings, 1 reply; 9+ messages in thread
From: Vinzent Hoefler @ 2011-01-27 18:07 UTC (permalink / raw)
Maciej Sobczak wrote:
> I should not add all possible Restrictions to my library units just in
> case any of them will be some day used in a program that imposes any
> of these restrictions, right?.
1) Why don't you use a separate file for the configuration pragmas and
add this to the project instead?
2) If you do, does it make a difference?
Vinzent.
--
You know, we're sitting on four million pounds of fuel, one nuclear weapon,
and a thing that has 270,000 moving parts built by the lowest bidder.
Makes you feel good, doesn't it?
-- Rockhound, "Armageddon"
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: No_Implicit_Heap_Allocations
2011-01-27 18:07 ` No_Implicit_Heap_Allocations Vinzent Hoefler
@ 2011-01-27 22:13 ` Maciej Sobczak
2011-01-28 5:15 ` No_Implicit_Heap_Allocations Yannick Duchêne (Hibou57)
0 siblings, 1 reply; 9+ messages in thread
From: Maciej Sobczak @ 2011-01-27 22:13 UTC (permalink / raw)
On Jan 27, 7:07 pm, "Vinzent Hoefler"
<0439279208b62c95f1880bf0f8776...@t-domaingrabbing.de> wrote:
> 1) Why don't you use a separate file for the configuration pragmas and
> add this to the project instead?
I was not aware of this possibility. How should I do that, precisely?
--
Maciej Sobczak * http://www.inspirel.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: No_Implicit_Heap_Allocations
2011-01-27 22:13 ` No_Implicit_Heap_Allocations Maciej Sobczak
@ 2011-01-28 5:15 ` Yannick Duchêne (Hibou57)
2011-01-28 15:19 ` No_Implicit_Heap_Allocations Maciej Sobczak
0 siblings, 1 reply; 9+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2011-01-28 5:15 UTC (permalink / raw)
Le Thu, 27 Jan 2011 23:13:15 +0100, Maciej Sobczak
<see.my.homepage@gmail.com> a écrit:
> On Jan 27, 7:07 pm, "Vinzent Hoefler"
> <0439279208b62c95f1880bf0f8776...@t-domaingrabbing.de> wrote:
>
>> 1) Why don't you use a separate file for the configuration pragmas and
>> add this to the project instead?
>
> I was not aware of this possibility. How should I do that, precisely?
>
> --
> Maciej Sobczak * http://www.inspirel.com
>
Hi Maciej,
This file is commonly named “gnat.adc”, while this can be named any other
way. You may find more about this Configuration Pragmas File here :
http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/The-Configuration-Pragmas-Files.html
Now about where/how it takes place:
http://www.cs.fsu.edu/~baker/ada/gnat/html/gnat_ugn_3.html
This file is useful in many case, like with GNATElim, which is (the
latter) useful to remove unnecessary stuffs in a GNAT-compiled
application. This use to be my main usage of “gnat.adc” ( about this
particular usage, this old page,
http://www.les-ziboux.rasama.org/reduire-taille-executable-gnat.html if
ever you read french ).
--
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour
les chiens.
“I am fluent in ASCII” [Warren 2010]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: No_Implicit_Heap_Allocations
2011-01-28 5:15 ` No_Implicit_Heap_Allocations Yannick Duchêne (Hibou57)
@ 2011-01-28 15:19 ` Maciej Sobczak
2011-01-28 15:38 ` No_Implicit_Heap_Allocations Mark Lorenzen
0 siblings, 1 reply; 9+ messages in thread
From: Maciej Sobczak @ 2011-01-28 15:19 UTC (permalink / raw)
On Jan 28, 6:15 am, Yannick Duchêne (Hibou57)
<yannick_duch...@yahoo.fr> wrote:
> This file is commonly named “gnat.adc”, while this can be named any other
> way. You may find more about this Configuration Pragmas File here : http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/The-Configuration-Pragmas-...
Thank you for explanations. Indeed, a separate file dedicated for
configuration pragmas can be very handy.
--
Maciej Sobczak * http://www.inspirel.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: No_Implicit_Heap_Allocations
2011-01-28 15:19 ` No_Implicit_Heap_Allocations Maciej Sobczak
@ 2011-01-28 15:38 ` Mark Lorenzen
0 siblings, 0 replies; 9+ messages in thread
From: Mark Lorenzen @ 2011-01-28 15:38 UTC (permalink / raw)
On 28 Jan., 16:19, Maciej Sobczak <see.my.homep...@gmail.com> wrote:
> On Jan 28, 6:15 am, Yannick Duchêne (Hibou57)
>
> <yannick_duch...@yahoo.fr> wrote:
> > This file is commonly named “gnat.adc”, while this can be named any other
> > way. You may find more about this Configuration Pragmas File here : http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/The-Configuration-Pragmas-...
>
> Thank you for explanations. Indeed, a separate file dedicated for
> configuration pragmas can be very handy.
Indeed. On the project I'm working on at the moment, we plan to place
all Restriction pragmas in a common file to ensure that all units are
compiled with the same set of restrictions. Maybe it isn't strictly
necessary, but better safe than sorry.
- Mark L
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-01-28 15:38 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27 10:38 No_Implicit_Heap_Allocations Maciej Sobczak
2011-01-27 11:00 ` No_Implicit_Heap_Allocations Maciej Sobczak
2011-01-27 11:06 ` No_Implicit_Heap_Allocations Mark Lorenzen
2011-01-27 15:49 ` No_Implicit_Heap_Allocations Maciej Sobczak
2011-01-27 18:07 ` No_Implicit_Heap_Allocations Vinzent Hoefler
2011-01-27 22:13 ` No_Implicit_Heap_Allocations Maciej Sobczak
2011-01-28 5:15 ` No_Implicit_Heap_Allocations Yannick Duchêne (Hibou57)
2011-01-28 15:19 ` No_Implicit_Heap_Allocations Maciej Sobczak
2011-01-28 15:38 ` No_Implicit_Heap_Allocations Mark Lorenzen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox