aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch6.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-08-24 21:52:32 +0200
committerMarc Poulhiès <poulhies@adacore.com>2022-09-12 10:16:50 +0200
commitde01e1b86a1095459883d15224aa195e6a3c71ff (patch)
tree187d9ae6cd9a898e51169f2920702566000bcbff /gcc/ada/sem_ch6.adb
parent1d2bc28c41b6ddf0b11a7a3d7d312ff45cb2cb7d (diff)
downloadgcc-de01e1b86a1095459883d15224aa195e6a3c71ff.zip
gcc-de01e1b86a1095459883d15224aa195e6a3c71ff.tar.gz
gcc-de01e1b86a1095459883d15224aa195e6a3c71ff.tar.bz2
[Ada] Do not mark user parameters of protected subprograms as artificial
This occurs because protected subprograms are not translated directly into object code but first rewritten as a pair of subprograms by the front-end. gcc/ada/ * exp_ch9.adb (Build_Protected_Spec): Tidy up and propagate the Comes_From_Source flag onto the new formal parameters. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not check references for subprograms generated for protected subprograms.
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r--gcc/ada/sem_ch6.adb12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index c92e691..93eeecb 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -5511,12 +5511,22 @@ package body Sem_Ch6 is
-- Check references of the subprogram spec when we are dealing with
-- an expression function due to it having a generated body.
- -- Otherwise, we simply check the formals of the subprogram body.
if Present (Spec_Id)
and then Is_Expression_Function (Spec_Id)
then
Check_References (Spec_Id);
+
+ -- 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))
+ then
+ null;
+
+ -- Otherwise, we simply check the formals of the subprogram body.
+
else
Check_References (Body_Id);
end if;