public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Piotr Trojanek <trojanek@adacore.com>
Subject: [COMMITED] ada: Cleanup related to lock-free protected subprograms
Date: Thu,  6 Oct 2022 11:31:12 +0200	[thread overview]
Message-ID: <20221006093112.261959-1-poulhies@adacore.com> (raw)

From: Piotr Trojanek <trojanek@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst | 6 +++---
 gcc/ada/gnat_rm.texi                                   | 6 +++---
 gcc/ada/sem_ch9.adb                                    | 8 +++-----
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
index 53836c9fbcf..6752d48d159 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 e13dba037ff..e79cdeeacfe 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 cae0f233c52..6506358a02b 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;
 
-- 
2.34.1


                 reply	other threads:[~2022-10-06  9:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221006093112.261959-1-poulhies@adacore.com \
    --to=poulhies@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=trojanek@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).