diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-12-21 13:42:22 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-12-21 13:42:22 +0000 |
commit | a29bc1d981ada9d07f05b7e03a08f9a72d9e4f19 (patch) | |
tree | 247b82d23f09335fb206e9cb9737d5acbf2ced65 /gcc/ada/sem_ch6.adb | |
parent | 86bd03fab26210d9df28fee70abdc4df76be394e (diff) | |
download | gcc-a29bc1d981ada9d07f05b7e03a08f9a72d9e4f19.tar.gz |
2011-12-21 Matthew Heaney <heaney@adacore.com>
* a-crbtgk.adb (Generic_Conditional_Insert): Fixed incorrect comment.
2011-12-21 Ed Schonberg <schonberg@adacore.com>
* sem_ch5.adb (Analyze_Iterator_Specification): If the name
of an element iterator is not an entity name we introduce a
local renaming declaration for it. To prevent spurious warnings
on parameterless function calls that return a container, when
expansion is disabled (either explicitly or because of a previous
errors) the name must be marked as not coming from source.
2011-12-21 Arnaud Charlet <charlet@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Separate
handling in CodePeer mode and only ignore Component_Size
attribute.
2011-12-21 Robert Dewar <dewar@adacore.com>
* sem_ch6.adb (Process_Formals): Set proper mechanism for
formals whose types have conventions Ada_Pass_By_Copy or
Ada_Pass_By_Reference.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182584 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r-- | gcc/ada/sem_ch6.adb | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index dbb4bb86e39..1df37372295 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -9527,14 +9527,14 @@ package body Sem_Ch6 is Default := Expression (Param_Spec); if Is_Scalar_Type (Etype (Default)) then - if Nkind - (Parameter_Type (Param_Spec)) /= N_Access_Definition + if Nkind (Parameter_Type (Param_Spec)) /= + N_Access_Definition then Formal_Type := Entity (Parameter_Type (Param_Spec)); - else - Formal_Type := Access_Definition - (Related_Nod, Parameter_Type (Param_Spec)); + Formal_Type := + Access_Definition + (Related_Nod, Parameter_Type (Param_Spec)); end if; Apply_Scalar_Range_Check (Default, Formal_Type); @@ -9556,6 +9556,21 @@ package body Sem_Ch6 is if Is_Aliased (Formal) then Set_Mechanism (Formal, By_Reference); + + -- Warn if user asked this to be passed by copy + + if Convention (Formal_Type) = Convention_Ada_Pass_By_Copy then + Error_Msg_N + ("?cannot pass aliased parameter & by copy", Formal); + end if; + + -- Force mechanism if type has Convention Ada_Pass_By_Ref/Copy + + elsif Convention (Formal_Type) = Convention_Ada_Pass_By_Copy then + Set_Mechanism (Formal, By_Copy); + + elsif Convention (Formal_Type) = Convention_Ada_Pass_By_Reference then + Set_Mechanism (Formal, By_Reference); end if; Next (Param_Spec); |