diff options
author | Steve Baird <baird@adacore.com> | 2023-12-07 12:18:29 -0800 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-01-09 14:13:30 +0100 |
commit | 7d4c4a4d21aceabf7bae4eec608d2c6f22fc9d76 (patch) | |
tree | f6f78856a2d881871fbfd7a72df96e2bc6ef93d9 /gcc/ada/contracts.adb | |
parent | 85f0ae3c54ad48e62ca02e61a1aa1ab3c8664142 (diff) | |
download | gcc-7d4c4a4d21aceabf7bae4eec608d2c6f22fc9d76.zip gcc-7d4c4a4d21aceabf7bae4eec608d2c6f22fc9d76.tar.gz gcc-7d4c4a4d21aceabf7bae4eec608d2c6f22fc9d76.tar.bz2 |
ada: Fix bug in Sem_Util.Enclosing_Declaration
Fix Sem_Util.Enclosing_Declaration to not return an N_Subprogram_Specification
node. Remove code in various places that was formerly needed to cope with this
misbehavior.
gcc/ada/
* sem_util.adb (Enclosing_Declaration): Instead of returning a
subprogram specification node, return its parent (which is
presumably a subprogram declaration).
* contracts.adb (Insert_Stable_Property_Check): Remove code
formerly needed to compensate for incorrect behavior of
Sem_Util.Enclosing_Declaration.
* exp_attr.adb (In_Available_Context): Remove code formerly needed
to compensate for incorrect behavior of
Sem_Util.Enclosing_Declaration.
* sem_ch8.adb (Is_Actual_Subp_Of_Inst): Remove code formerly
needed to compensate for incorrect behavior of
Sem_Util.Enclosing_Declaration.
Diffstat (limited to 'gcc/ada/contracts.adb')
-rw-r--r-- | gcc/ada/contracts.adb | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index fa0d59a..21bbbf1 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -2529,17 +2529,9 @@ package body Contracts is Pragma_Argument_Associations => Args, Class_Present => Class_Present); - Subp_Decl : Node_Id := Subp_Id; + Subp_Decl : constant Node_Id := Enclosing_Declaration (Subp_Id); + pragma Assert (Is_Declaration (Subp_Decl)); begin - -- Enclosing_Declaration may return, for example, - -- a N_Procedure_Specification node. Cope with this. - loop - Subp_Decl := Enclosing_Declaration (Subp_Decl); - exit when Is_Declaration (Subp_Decl); - Subp_Decl := Parent (Subp_Decl); - pragma Assert (Present (Subp_Decl)); - end loop; - Insert_After_And_Analyze (Subp_Decl, Prag); end Insert_Stable_Property_Check; |