From: Piotr Trojanek Date: Mon, 3 Oct 2022 14:45:49 +0000 (+0200) Subject: ada: Cleanup related to lock-free protected subprograms X-Git-Tag: basepoints/gcc-14~4085 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56a93169a4f413e0a711e973cf34e2ee89151ef4;p=thirdparty%2Fgcc.git ada: Cleanup related to lock-free protected subprograms Cleanup code and documentation; semantics is unaffected. gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (Lock_Free): Remove inconsistent periods that end item descriptions. * sem_ch9.adb (Allows_Lock_Free_Implementation): Remove unnecessary guard against an empty list of parameters; replace low-level entity kind membership test with a high-level query; refill error message. * gnat_rm.texi: Regenerate. --- diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst index 53836c9fbcf2..6752d48d1594 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst @@ -3744,10 +3744,10 @@ In addition, each protected subprogram body must satisfy: * May reference only one protected component * May not reference nonconstant entities outside the protected subprogram - scope. + scope * May not contain address representation items, allocators, or quantified - expressions. -* May not contain delay, goto, loop, or procedure-call statements. + expressions +* May not contain delay, goto, loop, or procedure-call statements * May not contain exported and imported entities * May not dereferenced access values * Function calls and attribute references must be static diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index e13dba037ffd..e79cdeeacfea 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -5243,14 +5243,14 @@ May reference only one protected component @item May not reference nonconstant entities outside the protected subprogram -scope. +scope @item May not contain address representation items, allocators, or quantified -expressions. +expressions @item -May not contain delay, goto, loop, or procedure-call statements. +May not contain delay, goto, loop, or procedure-call statements @item May not contain exported and imported entities diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb index cae0f233c52a..6506358a02b7 100644 --- a/gcc/ada/sem_ch9.adb +++ b/gcc/ada/sem_ch9.adb @@ -178,8 +178,6 @@ package body Sem_Ch9 is elsif Nkind (Decl) = N_Subprogram_Declaration and then Nkind (Specification (Decl)) = N_Procedure_Specification - and then - Present (Parameter_Specifications (Specification (Decl))) then declare Par_Specs : constant List_Id := @@ -477,7 +475,7 @@ package body Sem_Ch9 is -- Prohibit references to non-constant entities -- outside the protected subprogram scope. - if Ekind (Id) in Assignable_Kind + if Is_Assignable (Id) and then not Scope_Within_Or_Same (Scope (Id), Sub_Id) and then not @@ -487,8 +485,8 @@ package body Sem_Ch9 is then if Lock_Free_Given then Error_Msg_NE - ("reference to global variable& not " & - "allowed", N, Id); + ("reference to global variable& not allowed", + N, Id); return Skip; end if;