aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch12.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-12-16 10:33:08 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-12-16 10:33:08 +0000
commitd6c7e020cffa8570c77e80da755c8963034657fb (patch)
tree3775aa45161e641db67e8c155cf2b3a4d137d437 /gcc/ada/sem_ch12.adb
parent070fa48b0a4fbdc754e18962d586f41cc263dad7 (diff)
downloadgcc-d6c7e020cffa8570c77e80da755c8963034657fb.zip
gcc-d6c7e020cffa8570c77e80da755c8963034657fb.tar.gz
gcc-d6c7e020cffa8570c77e80da755c8963034657fb.tar.bz2
[Ada] Implement new legality rules introduced in C.6(13) by AI12-0128
2019-12-16 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (VFA): Document extension of the no-aliasing rule to any subcomponent. * freeze.adb (Freeze_Object_Declaration): Small comment tweak. (Freeze_Record_Type): Do not deal with delayed aspect specifications for components here but... (Freeze_Entity): ...here instead. * sem_ch12.adb (Instantiate_Object): Improve wording of errors given for legality rules in C.6(12) and implement the new rule in C.6(13). * sem_res.adb (Resolve_Actuals): Likewise. * sem_prag.adb (Check_Atomic_VFA): New procedure implementing the new legality rules in C.6(13). (Process_Atomic_Independent_Shared_Volatile): Call Check_Atomic_VFA to check the legality rules. Factor out code marking types into... (Mark_Type): ...this new procedure. (Check_VFA_Conflicts): Do not check the legality rules here. (Pragma_Atomic_Components): Call Check_Atomic_VFA on component type. * sem_util.ads (Is_Subcomponent_Of_Atomic_Object): Declare. * sem_util.adb (Is_Subcomponent_Of_Atomic_Object): New predicate. * gnat_rm.texi: Regenerate. From-SVN: r279412
Diffstat (limited to 'gcc/ada/sem_ch12.adb')
-rw-r--r--gcc/ada/sem_ch12.adb31
1 files changed, 24 insertions, 7 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 6932368..d405297 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -11111,19 +11111,36 @@ package body Sem_Ch12 is
Note_Possible_Modification (Actual, Sure => True);
- -- Check for instantiation of atomic/volatile actual for
- -- non-atomic/volatile formal (RM C.6 (12)).
+ -- Check for instantiation with atomic/volatile object actual for
+ -- nonatomic/nonvolatile formal (RM C.6 (12)).
if Is_Atomic_Object (Actual) and then not Is_Atomic (Orig_Ftyp) then
- Error_Msg_N
- ("cannot instantiate non-atomic formal object "
- & "with atomic actual", Actual);
+ Error_Msg_NE
+ ("cannot instantiate nonatomic formal & of mode in out",
+ Actual, Gen_Obj);
+ Error_Msg_N ("\with atomic object actual (RM C.6(12))", Actual);
elsif Is_Volatile_Object (Actual) and then not Is_Volatile (Orig_Ftyp)
then
+ Error_Msg_NE
+ ("cannot instantiate nonvolatile formal & of mode in out",
+ Actual, Gen_Obj);
+ Error_Msg_N ("\with volatile object actual (RM C.6(12))", Actual);
+ end if;
+
+ -- Check for instantiation on nonatomic subcomponent of an atomic
+ -- object in Ada 2020 (RM C.6 (13)).
+
+ if Ada_Version >= Ada_2020
+ and then Is_Subcomponent_Of_Atomic_Object (Actual)
+ and then not Is_Atomic_Object (Actual)
+ then
+ Error_Msg_NE
+ ("cannot instantiate formal & of mode in out with actual",
+ Actual, Gen_Obj);
Error_Msg_N
- ("cannot instantiate non-volatile formal object "
- & "with volatile actual", Actual);
+ ("\nonatomic subcomponent of atomic object (RM C.6(13))",
+ Actual);
end if;
-- Formal in-parameter