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: Viljar Indus <indus@adacore.com>
Subject: [COMMITTED 27/35] ada: Avoid checking parameters of protected procedures
Date: Thu, 16 May 2024 11:25:56 +0200	[thread overview]
Message-ID: <20240516092606.41242-27-poulhies@adacore.com> (raw)
In-Reply-To: <20240516092606.41242-1-poulhies@adacore.com>

From: Viljar Indus <indus@adacore.com>

The compiler triggers warnings on generated protected procedures
if the procedure does not have an explicit spec. Instead check
if the body was created for a protected procedure if the spec
is not present.

gcc/ada/

	* sem_ch6.adb (Analyze_Subprogram_Body_Helper):
	If the spec is not present for a subprogram body then
	check if the body definiton was created for a protected
	procedure.

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

---
 gcc/ada/sem_ch6.adb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 0a8030cb923..ca40b5479e0 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -4971,8 +4971,11 @@ package body Sem_Ch6 is
          --  Skip the check for subprograms generated for protected subprograms
          --  because it is also done for the protected subprograms themselves.
 
-         elsif Present (Spec_Id)
-           and then Present (Protected_Subprogram (Spec_Id))
+         elsif (Present (Spec_Id)
+                 and then Present (Protected_Subprogram (Spec_Id)))
+           or else
+             (Acts_As_Spec (N)
+               and then Present (Protected_Subprogram (Body_Id)))
          then
             null;
 
-- 
2.43.2


  parent reply	other threads:[~2024-05-16  9:26 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16  9:25 [COMMITTED 01/35] ada: Fix docs and comments about pragmas for Boolean-valued aspects Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 02/35] ada: Fix casing in error messages Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 03/35] ada: Fix ordering of code for pragma Preelaborable_Initialization Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 04/35] ada: Fix alphabetic ordering of aspect identifiers Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 05/35] ada: Cleanup reporting locations for Ada 2022 and GNAT extension aspects Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 06/35] ada: Reuse existing expression when rewriting aspects to pragmas Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 07/35] ada: Remove Aspect_Specifications field from N_Procedure_Specification Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 08/35] ada: Fix bug in maintaining dimension info Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 09/35] ada: Formal_Derived_Type'Size is not static Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 10/35] ada: Implement per-finalization-collection spinlocks Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 11/35] ada: Follow up fixes for Put_Image/streaming regressions Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 12/35] ada: Fix crash with -gnatdJ and -gnatw_q Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 13/35] ada: Fix casing of CUDA in error messages Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 14/35] ada: Fix bogus error on function returning noncontrolling result in private part Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 15/35] ada: Fix resolving tagged operations in array aggregates Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 16/35] ada: Fix latent alignment issue for dynamically-allocated controlled objects Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 17/35] ada: Fix typo in CUDA error message Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 18/35] ada: Fixup one more pattern of broken scope information Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 19/35] ada: Minor performance improvement for dynamically-allocated controlled objects Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 20/35] ada: Fix comments about Get_Ranged_Checks Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 21/35] ada: Fix detection of if_expressions that are known on entry Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 22/35] ada: No need to follow New_Occurrence_Of with Set_Etype Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 23/35] ada: Improve recovery from illegal occurrence of 'Old in if_expression Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 24/35] ada: Propagate Program_Error from failed finalization of collection Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 25/35] ada: Fix reason code for length check Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 26/35] ada: Ignore ghost nodes in call graph information for dispatching calls Marc Poulhiès
2024-05-16  9:25 ` Marc Poulhiès [this message]
2024-05-16  9:25 ` [COMMITTED 28/35] ada: Fix standalone Windows builds of adaint.c Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 29/35] ada: Fix missing length checks with case expressions Marc Poulhiès
2024-05-16  9:25 ` [COMMITTED 30/35] ada: Fix reference to RM clause in comment Marc Poulhiès
2024-05-16  9:26 ` [COMMITTED 31/35] ada: Implement new experimental attribute 'Super Marc Poulhiès
2024-05-16  9:26 ` [COMMITTED 32/35] ada: Exception on Indefinite_Vector aggregate with loop_parameter_specification Marc Poulhiès
2024-05-16  9:26 ` [COMMITTED 33/35] ada: Redundant validity checks Marc Poulhiès
2024-05-16  9:26 ` [COMMITTED 34/35] ada: Reset scope of top level object declaration during unnesting Marc Poulhiès
2024-05-16  9:26 ` [COMMITTED 35/35] ada: Remove obsolete reference in comment Marc Poulhiès

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=20240516092606.41242-27-poulhies@adacore.com \
    --to=poulhies@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=indus@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).