]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Avoid checking parameters of protected procedures
authorViljar Indus <indus@adacore.com>
Thu, 22 Feb 2024 12:27:14 +0000 (14:27 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 16 May 2024 08:49:32 +0000 (10:49 +0200)
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.

gcc/ada/sem_ch6.adb

index 0a8030cb923634c7dcfa30d9c74d7c0e21cef669..ca40b5479e092a4e9c64ceb97cb95772ce55851e 100644 (file)
@@ -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;