diff options
author | Justin Squirek <squirek@adacore.com> | 2022-04-21 20:35:20 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-05-30 08:29:03 +0000 |
commit | 507ed659e0110e3cba9aa8bba875768833d7b7ea (patch) | |
tree | 4ab2e274030d5ee0811b2115dd4d503d70aceb58 /gcc/ada/par-ch6.adb | |
parent | f55e8fd165c1ed1e1c12def08ddb5f4fc55dafbb (diff) | |
download | gcc-507ed659e0110e3cba9aa8bba875768833d7b7ea.zip gcc-507ed659e0110e3cba9aa8bba875768833d7b7ea.tar.gz gcc-507ed659e0110e3cba9aa8bba875768833d7b7ea.tar.bz2 |
[Ada] Incorrect unreferenced warnings on null subprograms and formals with aspects
This patch corrects an error in the compiler whereby spurious
unreferenced warnings are generated on formal parameters of null generic
subprograms.
These changes also fix the parsing of aspects on formal parameters such
that the aspects now get properly set for all formal parameters in a
parameter list.
gcc/ada/
* par-ch6.adb (P_Formal_Part): Set Aspect_Specifications on all
formals instead of just the last in a formal id list.
* sem_ch6.adb (Analyze_Null_Procedure): Mark expanded null
generic procedures as trivial in order to avoid spurious
unreferenced warnings.
Diffstat (limited to 'gcc/ada/par-ch6.adb')
-rw-r--r-- | gcc/ada/par-ch6.adb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb index 2832fd4..95fa937 100644 --- a/gcc/ada/par-ch6.adb +++ b/gcc/ada/par-ch6.adb @@ -1656,6 +1656,28 @@ package body Ch6 is P_Aspect_Specifications (Specification_Node, False); + -- Set the aspect specifications for previous Ids + + if Has_Aspects (Specification_Node) + and then Prev_Ids (Specification_Node) + then + -- Loop through each previous id + + declare + Prev_Id : Node_Id := Prev (Specification_Node); + begin + loop + Set_Aspect_Specifications + (Prev_Id, Aspect_Specifications (Specification_Node)); + + -- Exit when we reach the first parameter in the list + + exit when not Prev_Ids (Prev_Id); + Prev_Id := Prev (Prev_Id); + end loop; + end; + end if; + if Token = Tok_Right_Paren then Scan; -- past right paren exit Specification_Loop; |