aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2018-05-28 08:53:22 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-28 08:53:22 +0000
commitaab1da2af490f53c882ff7508b640c782dbc68f8 (patch)
tree57256f3d4e74f7f9a76bb475c393383020f8cc4b /gcc
parentc8e95568a1fa2957eca057c659497aed2b58bfd3 (diff)
downloadgcc-aab1da2af490f53c882ff7508b640c782dbc68f8.zip
gcc-aab1da2af490f53c882ff7508b640c782dbc68f8.tar.gz
gcc-aab1da2af490f53c882ff7508b640c782dbc68f8.tar.bz2
[Ada] Spurious error on aspect Volatile
This patch modifies the analysis of aspect/pragma Volatile to correct accept the annotation when it applies to single protected and single task types, and SPARK_Mode On is in effect. ------------ -- Source -- ------------ -- pack.ads package Pack with SPARK_Mode is protected PO_Aspect with Volatile is end; -- OK protected PO_Pragma is end; pragma Volatile (PO_Pragma); -- OK task TO_Aspect with Volatile; -- OK task TO_Pragma; pragma Volatile (TO_Pragma); -- OK end Pack; ---------------------------- -- Compilation and output -- ---------------------------- $ gcc -c pack.ads $ gcc -c pack.ads -gnatd.F cannot generate code for file pack.ads (package spec) 2018-05-28 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * sem_prag.adb (Process_Atomic_Independent_Shared_Volatile): Include the declarations of single concurrent types because they fall in the category of full type and object declarations. From-SVN: r260820
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/sem_prag.adb8
2 files changed, 11 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index bea3214..324645d 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2018-05-28 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_prag.adb (Process_Atomic_Independent_Shared_Volatile): Include
+ the declarations of single concurrent types because they fall in the
+ category of full type and object declarations.
+
2018-05-28 Eric Botcazou <ebotcazou@adacore.com>
* repinfo.adb (Compute_Max_Length): Skip _Parent component.
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index ef475ff..ae340aa 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -7399,9 +7399,11 @@ package body Sem_Prag is
if SPARK_Mode = On
and then Prag_Id = Pragma_Volatile
- and then
- not Nkind_In (Original_Node (Decl), N_Full_Type_Declaration,
- N_Object_Declaration)
+ and then not Nkind_In (Original_Node (Decl),
+ N_Full_Type_Declaration,
+ N_Object_Declaration,
+ N_Single_Protected_Declaration,
+ N_Single_Task_Declaration)
then
Error_Pragma_Arg
("argument of pragma % must denote a full type or object "