aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2020-12-22 10:34:37 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-05-03 05:28:21 -0400
commite36ee1b4df7197b6e7542bb67004b1fcf09714ce (patch)
tree4c718af3c6d41b3f01b1797de8590f864d76cef5 /gcc
parent1668564fdefee11a2f455766f310baf8d5b2e1af (diff)
downloadgcc-e36ee1b4df7197b6e7542bb67004b1fcf09714ce.zip
gcc-e36ee1b4df7197b6e7542bb67004b1fcf09714ce.tar.gz
gcc-e36ee1b4df7197b6e7542bb67004b1fcf09714ce.tar.bz2
[Ada] Spurious warning on postcondition and result
gcc/ada/ * sem_util.adb (Check_Result_And_Post_State): Replace custom Has_In_Out_Parameter with existing Has_Out_Or_In_Out_Parameter flag which corresponds exactly to what we need.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_util.adb30
1 files changed, 2 insertions, 28 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index b7b622d..c4fe191 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -4701,10 +4701,6 @@ package body Sem_Util is
-- and post-state. Prag is a [refined] postcondition or a contract-cases
-- pragma. Result_Seen is set when the pragma mentions attribute 'Result
- function Has_In_Out_Parameter (Subp_Id : Entity_Id) return Boolean;
- -- Determine whether subprogram Subp_Id contains at least one IN OUT
- -- formal parameter.
-
-------------------------------------------
-- Check_Result_And_Post_State_In_Pragma --
-------------------------------------------
@@ -5093,28 +5089,6 @@ package body Sem_Util is
end if;
end Check_Result_And_Post_State_In_Pragma;
- --------------------------
- -- Has_In_Out_Parameter --
- --------------------------
-
- function Has_In_Out_Parameter (Subp_Id : Entity_Id) return Boolean is
- Formal : Entity_Id;
-
- begin
- -- Traverse the formals looking for an IN OUT parameter
-
- Formal := First_Formal (Subp_Id);
- while Present (Formal) loop
- if Ekind (Formal) = E_In_Out_Parameter then
- return True;
- end if;
-
- Next_Formal (Formal);
- end loop;
-
- return False;
- end Has_In_Out_Parameter;
-
-- Local variables
Items : constant Node_Id := Contract (Subp_Id);
@@ -5194,10 +5168,10 @@ package body Sem_Util is
null;
-- Regardless of whether the function has postconditions or contract
- -- cases, or whether they mention attribute 'Result, an IN OUT formal
+ -- cases, or whether they mention attribute 'Result, an [IN] OUT formal
-- parameter is always treated as a result.
- elsif Has_In_Out_Parameter (Spec_Id) then
+ elsif Has_Out_Or_In_Out_Parameter (Spec_Id) then
null;
-- The function has both a postcondition and contract cases and they do