This patch verifies that when Default_Storage_Pools is specified by means of
an aspect, the entity to which it applies is a package or a subprogram.
Compiling pck2.ads must yield:
pck2.ads:4:11: aspect must apply to package or subprogram
---
with GNAT.Debug_Pools;
package Pck2 is
Pool : GNAT.Debug_Pools.Debug_Pool
with Default_Storage_Pool => Pool;
end Pck2;
Tested on x86_64-pc-linux-gnu, committed on trunk
2016-04-20 Ed Schonberg <[email protected]>
* sem_prag.adb (Analyze_Pragma, case Default_Storage_Pool):
If the pragma comes from an aspect specification, verify that
the aspect applies to an entity with a declarative part.
Index: sem_prag.adb
===================================================================
--- sem_prag.adb (revision 235202)
+++ sem_prag.adb (working copy)
@@ -13582,6 +13582,17 @@
Check_Is_In_Decl_Part_Or_Package_Spec;
end if;
+ if From_Aspect_Specification (N) then
+ declare
+ E : constant Entity_Id := Entity (Corresponding_Aspect (N));
+ begin
+ if not In_Open_Scopes (E) then
+ Error_Msg_N
+ ("aspect must apply to package or subprogram", N);
+ end if;
+ end;
+ end if;
+
if Present (Arg1) then
Pool := Get_Pragma_Arg (Arg1);