From 43dbd3e338b914681b7d8d90daef7caf5ea6b9fd Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 14 Oct 2013 15:50:16 +0200 Subject: [PATCH] [multiple changes] 2013-10-14 Robert Dewar * sem_aux.adb, sem_aux.ads, sem_prag.adb: Minor reformatting. 2013-10-14 Ed Schonberg * sem_res.adb (Resolve_Actuals): Add error message for a subprogram with an in-out parameter when used in a predicate, to clarify subsequent error at the point of call. From-SVN: r203558 --- gcc/ada/ChangeLog | 10 ++++++++++ gcc/ada/sem_aux.adb | 1 - gcc/ada/sem_aux.ads | 2 +- gcc/ada/sem_prag.adb | 5 ++--- gcc/ada/sem_res.adb | 9 +++++++++ 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 986d97bf36f..d155557eff5 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +2013-10-14 Robert Dewar + + * sem_aux.adb, sem_aux.ads, sem_prag.adb: Minor reformatting. + +2013-10-14 Ed Schonberg + + * sem_res.adb (Resolve_Actuals): Add error message for a + subprogram with an in-out parameter when used in a predicate, + to clarify subsequent error at the point of call. + 2013-10-14 Hristian Kirtchev * sem_prag.adb (Is_Matching_Input): Consume a matching null input. diff --git a/gcc/ada/sem_aux.adb b/gcc/ada/sem_aux.adb index 5a4c4384320..5c2b5df89b6 100644 --- a/gcc/ada/sem_aux.adb +++ b/gcc/ada/sem_aux.adb @@ -1160,7 +1160,6 @@ package body Sem_Aux is begin N := Parent (Pack_Id); - while Nkind (N) /= N_Package_Specification loop N := Parent (N); diff --git a/gcc/ada/sem_aux.ads b/gcc/ada/sem_aux.ads index d493059c42f..a4b1a673bce 100644 --- a/gcc/ada/sem_aux.ads +++ b/gcc/ada/sem_aux.ads @@ -351,5 +351,5 @@ package Sem_Aux is function Package_Specification (Pack_Id : Entity_Id) return Node_Id; -- Given an entity for a package or generic package, return corresponding -- package specification. Simplifies handling of child units, and better - -- than the old idiom: Specification (Unit_Declaration_Node (Pack_Id). + -- than the old idiom: Specification (Unit_Declaration_Node (Pack_Id)). end Sem_Aux; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index ee790ad4aea..69df1759b55 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -19971,16 +19971,15 @@ package body Sem_Prag is if Nkind (Ref_Input) = N_Null then Remove (Ref_Input); - return True; + else Match_Error ("null input cannot be matched in corresponding " & "refinement clause", Dep_Input); end if; - -- The remaining cases are formal parameters, variables and - -- states. + -- Remaining cases are formal parameters, variables, and states else Dep_Id := Entity_Of (Dep_Input); diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index ca2b551136d..3cb49f416a7 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -3933,6 +3933,15 @@ package body Sem_Res is and then not Is_Init_Proc (Nam) then Error_Msg_NE ("actual for& must be a variable", A, F); + + if Is_Subprogram (Current_Scope) + and then + (Is_Invariant_Procedure (Current_Scope) + or else Is_Predicate_Function (Current_Scope)) + then + Error_Msg_N ("function used in predicate cannot " & + "modify its argument", F); + end if; end if; -- What's the following about???