From 73999267a3581a69fc112fb7c420231ed4213357 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 1 Aug 2014 12:24:57 +0200 Subject: [PATCH] [multiple changes] 2014-08-01 Robert Dewar * sem_ch10.adb: Minor reformatting. 2014-08-01 Ed Schonberg * sem_ch6.adb (Same_Generic_Actual): Make function symmetric, because either type may be a subtype of the other. 2014-08-01 Vincent Celier * makeusg.adb: Add documentation for debug switch -dn. 2014-08-01 Ed Schonberg * sem_dim.adb (Process_Minus, Process_Divide): Label dimension expression with standard operator and type, for pretty-printing use, when in ASIS_Mode. When generating code dimensional analysis is not involved and dimension expressions are handled statically, and other operators are resolved in the usual way. 2014-08-01 Ed Schonberg * sem_ch3.adb (Build_Derived_Record_Type): Remove setting of Parent_Subtype in ASIS mode, leads to several failures. * sem_ch4.adb (Analyze_Selected_Component): In an instance, if the prefix is a type extension, check whether component is declared in the parent type, possibly in a parent unit. Needed in ASIS mode when Parent_Subtype is not set. From-SVN: r213449 --- gcc/ada/ChangeLog | 30 ++++++++++++++++++++++++++++++ gcc/ada/makeusg.adb | 6 ++++++ gcc/ada/sem_ch10.adb | 9 ++++++--- gcc/ada/sem_ch3.adb | 14 ++++---------- gcc/ada/sem_ch4.adb | 10 ++++++++++ gcc/ada/sem_ch6.adb | 31 ++++++++++++++++++++++++------- gcc/ada/sem_dim.adb | 20 ++++++++++++++------ 7 files changed, 94 insertions(+), 26 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d5606e6a248..54b32b47e36 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,33 @@ +2014-08-01 Robert Dewar + + * sem_ch10.adb: Minor reformatting. + +2014-08-01 Ed Schonberg + + * sem_ch6.adb (Same_Generic_Actual): Make function symmetric, + because either type may be a subtype of the other. + +2014-08-01 Vincent Celier + + * makeusg.adb: Add documentation for debug switch -dn. + +2014-08-01 Ed Schonberg + + * sem_dim.adb (Process_Minus, Process_Divide): Label dimension + expression with standard operator and type, for pretty-printing + use, when in ASIS_Mode. When generating code dimensional analysis + is not involved and dimension expressions are handled statically, + and other operators are resolved in the usual way. + +2014-08-01 Ed Schonberg + + * sem_ch3.adb (Build_Derived_Record_Type): Remove setting of + Parent_Subtype in ASIS mode, leads to several failures. + * sem_ch4.adb (Analyze_Selected_Component): In an instance, + if the prefix is a type extension, check whether component is + declared in the parent type, possibly in a parent unit. Needed + in ASIS mode when Parent_Subtype is not set. + 2014-08-01 Robert Dewar * sem_prag.adb: Minor reformatting. diff --git a/gcc/ada/makeusg.adb b/gcc/ada/makeusg.adb index 16eb5f968b1..3c708bf0eac 100644 --- a/gcc/ada/makeusg.adb +++ b/gcc/ada/makeusg.adb @@ -257,6 +257,12 @@ begin Write_Eol; Write_Eol; + -- Line for -dn + + Write_Str (" -dn Do not delete temporary files"); + Write_Eol; + Write_Eol; + Write_Str (" --create-map-file Create map file mainprog.map"); Write_Eol; diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index 13deef6bc49..a3c6784be2c 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -507,14 +507,17 @@ package body Sem_Ch10 is -- Avoid checking implicitly generated with clauses, limited with -- clauses or withs that have pragma Elaborate or Elaborate_All. - -- With_clauses introduced for renamings of parent clauses are not - -- marked implicit because they need to be properly installed, but - -- they do not come from source and do not require warnings. if Nkind (Clause) = N_With_Clause and then not Implicit_With (Clause) and then not Limited_Present (Clause) and then not Elaborate_Present (Clause) + + -- With_clauses introduced for renamings of parent clauses + -- are not marked implicit because they need to be properly + -- installed, but they do not come from source and do not + -- require warnings. + and then Comes_From_Source (Clause) then -- Package body-to-spec check diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index adbfd5011df..df59cb7c63c 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -8418,17 +8418,11 @@ package body Sem_Ch3 is -- STEP 5c: Process the record extension for non private tagged types elsif not Private_Extension then + Expand_Record_Extension (Derived_Type, Type_Def); - -- Add the _parent field in the derived type. In ASIS mode there is - -- not enough semantic information for full expansion, but set the - -- parent subtype to allow resolution of selected components in - -- instance bodies. - - if ASIS_Mode then - Set_Parent_Subtype (Derived_Type, Parent_Type); - else - Expand_Record_Extension (Derived_Type, Type_Def); - end if; + -- Note : previously in ASIS mode we set the Parent_Subtype of the + -- derived type to propagate some semantic information. This led + -- to other ASIS failures and has been removed. -- Ada 2005 (AI-251): Addition of the Tag corresponding to all the -- implemented interfaces if we are in expansion mode diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index d5573273e87..64f0a7451f6 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -4646,6 +4646,7 @@ package body Sem_Ch4 is end loop; if Present (Par) and then Is_Generic_Actual_Type (Par) then + -- Now look for component in ancestor types Par := Generic_Parent_Type (Declaration_Node (Par)); @@ -4655,6 +4656,14 @@ package body Sem_Ch4 is or else Par = Etype (Par); Par := Etype (Par); end loop; + + -- In ASIS mode the generic parent type may be absent. Examine + -- the parent type directly for a component that may have been + -- visible in a parent generic unit. + + elsif Is_Derived_Type (Prefix_Type) then + Par := Etype (Prefix_Type); + Find_Component_In_Instance (Par); end if; end; @@ -4664,6 +4673,7 @@ package body Sem_Ch4 is if No (Entity (Sel)) then raise Program_Error; end if; + return; -- Component not found, specialize error message when appropriate diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 1bfa90e46cd..1fb0e7e1f58 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -7274,21 +7274,38 @@ package body Sem_Ch6 is -- Check that the types of corresponding formals have the same -- generic actual if any. We have to account for subtypes of a -- generic formal, declared between a spec and a body, which may - -- appear distinct in an instance but matched in the generic. + -- appear distinct in an instance but matched in the generic, and + -- the subtype may be used either in the spec or the body of the + -- subprogram being checked. ------------------------- -- Same_Generic_Actual -- ------------------------- function Same_Generic_Actual (T1, T2 : Entity_Id) return Boolean is + + function Is_Declared_Subtype (S1, S2 : Entity_Id) return Boolean; + -- Predicate to check whether S1 is a subtype of S2 in the source + -- of the instance. + + ------------------------- + -- Is_Declared_Subtype -- + ------------------------- + + function Is_Declared_Subtype (S1, S2 : Entity_Id) return Boolean is + begin + return Comes_From_Source (Parent (S1)) + and then Nkind (Parent (S1)) = N_Subtype_Declaration + and then Is_Entity_Name (Subtype_Indication (Parent (S1))) + and then Entity (Subtype_Indication (Parent (S1))) = S2; + end Is_Declared_Subtype; + + -- Start of processing for Same_Generic_Actual + begin return Is_Generic_Actual_Type (T1) = Is_Generic_Actual_Type (T2) - or else - (Present (Parent (T1)) - and then Comes_From_Source (Parent (T1)) - and then Nkind (Parent (T1)) = N_Subtype_Declaration - and then Is_Entity_Name (Subtype_Indication (Parent (T1))) - and then Entity (Subtype_Indication (Parent (T1))) = T2); + or else Is_Declared_Subtype (T1, T2) + or else Is_Declared_Subtype (T2, T1); end Same_Generic_Actual; -- Start of processing for Different_Generic_Profile diff --git a/gcc/ada/sem_dim.adb b/gcc/ada/sem_dim.adb index 6bb74ee0714..37d2f7a9123 100644 --- a/gcc/ada/sem_dim.adb +++ b/gcc/ada/sem_dim.adb @@ -2262,10 +2262,14 @@ package body Sem_Dim is -- Provide minimal semantic information on dimension expressions, -- even though they have no run-time existence. This is for use by - -- ASIS tools, in particular pretty-printing. + -- ASIS tools, in particular pretty-printing. If generating code + -- standard operator resolution will take place. + + if ASIS_Mode then + Set_Entity (N, Standard_Op_Minus); + Set_Etype (N, Standard_Integer); + end if; - Set_Entity (N, Standard_Op_Minus); - Set_Etype (N, Standard_Integer); return Result; end Process_Minus; @@ -2294,10 +2298,14 @@ package body Sem_Dim is -- Provide minimal semantic information on dimension expressions, -- even though they have no run-time existence. This is for use by - -- ASIS tools, in particular pretty-printing. + -- ASIS tools, in particular pretty-printing. If generating code + -- standard operator resolution will take place. + + if ASIS_Mode then + Set_Entity (N, Standard_Op_Divide); + Set_Etype (N, Standard_Integer); + end if; - Set_Entity (N, Standard_Op_Divide); - Set_Etype (N, Standard_Integer); return Result; end Process_Divide; -- 2.30.2