* [Ada] Detect generics as violation of the SPARK restriction
@ 2011-08-04 15:19 Arnaud Charlet
0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2011-08-04 15:19 UTC (permalink / raw)
To: gcc-patches; +Cc: Marc Sango
[-- Attachment #1: Type: text/plain, Size: 396 bytes --]
When the SPARK restriction was set, GNAT was not issuing violations on generic.
Now corrected.
Tested on x86_64-pc-linux-gnu, committed on trunk
2011-08-04 Marc Sango <sango@adacore.com>
* sem_ch12.adb (Analyze_Generic_Package_Declaration,
Analyze_Generic_Subprogram_Declaration, Analyze_Package_Instantiation,
Analyze_Subprogram_Instantiation): Check absence of generic in SPARK
mode.
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 1570 bytes --]
Index: sem_ch12.adb
===================================================================
--- sem_ch12.adb (revision 177384)
+++ sem_ch12.adb (working copy)
@@ -2690,6 +2690,8 @@
Decl : Node_Id;
begin
+ Check_SPARK_Restriction ("generic is not allowed", N);
+
-- We introduce a renaming of the enclosing package, to have a usable
-- entity as the prefix of an expanded name for a local entity of the
-- form Par.P.Q, where P is the generic package. This is because a local
@@ -2811,6 +2813,8 @@
Typ : Entity_Id;
begin
+ Check_SPARK_Restriction ("generic is not allowed", N);
+
-- Create copy of generic unit, and save for instantiation. If the unit
-- is a child unit, do not copy the specifications for the parent, which
-- are not part of the generic tree.
@@ -3051,6 +3055,8 @@
-- Start of processing for Analyze_Package_Instantiation
begin
+ Check_SPARK_Restriction ("generic is not allowed", N);
+
-- Very first thing: apply the special kludge for Text_IO processing
-- in case we are instantiating one of the children of [Wide_]Text_IO.
@@ -4195,6 +4201,8 @@
-- Start of processing for Analyze_Subprogram_Instantiation
begin
+ Check_SPARK_Restriction ("generic is not allowed", N);
+
-- Very first thing: apply the special kludge for Text_IO processing
-- in case we are instantiating one of the children of [Wide_]Text_IO.
-- Of course such an instantiation is bogus (these are packages, not
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-08-04 15:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-04 15:19 [Ada] Detect generics as violation of the SPARK restriction Arnaud Charlet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).