diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-08 09:46:51 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-08 09:46:51 +0000 |
commit | d1dc14a06fb1e9f8eeb978a397a4b200bc879b36 (patch) | |
tree | 67331f30e758c8cdfc7fdaad11de9e2755edeeb3 /gcc | |
parent | 8dbed78ee65dcab69fa93f8dd84d27f39b51aae3 (diff) | |
download | gcc-d1dc14a06fb1e9f8eeb978a397a4b200bc879b36.tar.gz |
2010-10-08 Robert Dewar <dewar@adacore.com>
* sem_ch4.adb: Minor reformatting.
2010-10-08 Robert Dewar <dewar@adacore.com>
* sem_ch6.adb (Check_Conformance): Check null exclusion match for full
conformance.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165153 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/ada/sem_ch4.adb | 4 | ||||
-rw-r--r-- | gcc/ada/sem_ch6.adb | 29 |
3 files changed, 40 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f15e9c0b74d..bfec7bc74df 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2010-10-08 Robert Dewar <dewar@adacore.com> + + * sem_ch4.adb: Minor reformatting. + +2010-10-08 Robert Dewar <dewar@adacore.com> + + * sem_ch6.adb (Check_Conformance): Check null exclusion match for full + conformance. + 2010-10-08 Thomas Quinot <quinot@adacore.com> * sem_ch12.adb (Instantiate_Object): Rename Formal_Id to Gen_Obj, for diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index a967ac1e8da..5891e9b14d5 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -507,7 +507,7 @@ package body Sem_Ch4 is -- be a null object, and we can insert an unconditional raise -- before the allocator. - -- Ada2012 (AI-104) : a not null indication here is altogether + -- Ada2012 (AI-104): a not null indication here is altogether -- illegal. if Can_Never_Be_Null (Type_Id) then @@ -515,6 +515,7 @@ package body Sem_Ch4 is Not_Null_Check : constant Node_Id := Make_Raise_Constraint_Error (Sloc (E), Reason => CE_Null_Not_Allowed); + begin if Ada_Version >= Ada_12 then Error_Msg_N @@ -524,6 +525,7 @@ package body Sem_Ch4 is elsif Expander_Active then Insert_Action (N, Not_Null_Check); Analyze (Not_Null_Check); + else Error_Msg_N ("null value not allowed here?", E); end if; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 38d5c2e34ff..d1ec09a4369 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -3711,7 +3711,6 @@ package body Sem_Ch6 is Error_Msg_Name_1 := Chars (New_Id); Error_Msg_Name_2 := Name_Ada + Convention_Id'Pos (Convention (New_Id)); - Conformance_Error ("\prior declaration for% has convention %!"); else @@ -3771,6 +3770,29 @@ package body Sem_Ch6 is Set_Error_Posted (New_Formal); return; end if; + + -- Null exclusion must match + + if Null_Exclusion_Present (Parent (Old_Formal)) + /= + Null_Exclusion_Present (Parent (New_Formal)) + then + -- Only give error if both come from source. This should be + -- investigated some time, since it should not be needed ??? + + if Comes_From_Source (Old_Formal) + and then + Comes_From_Source (New_Formal) + then + Conformance_Error + ("\null exclusion for & does not match", New_Formal); + + -- Mark error posted on the new formal to avoid duplicated + -- complaint about types not matching. + + Set_Error_Posted (New_Formal); + end if; + end if; end if; -- Ada 2005 (AI-423): Possible access [sub]type and itype match. This @@ -3912,6 +3934,11 @@ package body Sem_Ch6 is or else Is_Access_Constant (Etype (Old_Formal)) /= Is_Access_Constant (Etype (New_Formal))) + + -- Do not complain if error already posted on New_Formal. This + -- avoids some redundant error messages. + + and then not Error_Posted (New_Formal) then -- It is allowed to omit the null-exclusion in case of stream -- attribute subprograms. We recognize stream subprograms |