]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Fri, 17 Apr 2009 12:01:56 +0000 (14:01 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 17 Apr 2009 12:01:56 +0000 (14:01 +0200)
2009-04-17  Thomas Quinot  <quinot@adacore.com>

* exp_aggr.adb: Minor code reorganization, no behaviour change.

2009-04-17  Ed Schonberg  <schonberg@adacore.com>

* sem_ch8.adb (Use_One_Type): Handle properly a redundant use type
clause in a unit that is a package body or a subunit, when the previous
clause appears in a spec or a parent.

From-SVN: r146250

gcc/ada/ChangeLog
gcc/ada/exp_aggr.adb
gcc/ada/sem_ch8.adb

index 6d0d2a6ba73f57370ac51f1838e1a8e2a447ce57..67f4c53fb422d566c1ee829403f13605ca5038cf 100644 (file)
@@ -1,3 +1,13 @@
+2009-04-17  Thomas Quinot  <quinot@adacore.com>
+
+       * exp_aggr.adb: Minor code reorganization, no behaviour change.
+
+2009-04-17  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch8.adb (Use_One_Type): Handle properly a redundant use type
+       clause in a unit that is a package body or a subunit, when the previous
+       clause appears in a spec or a parent.
+
 2009-04-17  Thomas Quinot  <quinot@adacore.com>
 
        * sinfo.ads, exp_aggr.adb, exp_aggr.ads: Minor reformatting
index 22e44f4b74eb82b8b2e9a53e5df59a27b18ad4c9..61fa79021ca552a919d3907745852466bbd81082 100644 (file)
@@ -1226,10 +1226,10 @@ package body Exp_Aggr is
             if Present (Comp_Type)
               and then Needs_Finalization (Comp_Type)
               and then not Is_Limited_Type (Comp_Type)
-              and then
-                (not Is_Array_Type (Comp_Type)
-                   or else not Is_Controlled (Component_Type (Comp_Type))
-                   or else Nkind (Expr) /= N_Aggregate)
+              and then not
+                (Is_Array_Type (Comp_Type)
+                   and then Is_Controlled (Component_Type (Comp_Type))
+                   and then Nkind (Expr) = N_Aggregate)
             then
                Append_List_To (L,
                  Make_Adjust_Call (
index 4c97e09ee4a40be8840d0dc588ab3583a58bd1b1..58d9ff68a46fecdb8f7295ae0d0ee13b9ee74b27 100644 (file)
@@ -7249,7 +7249,9 @@ package body Sem_Ch8 is
                      Unit1 := Unit (Parent (Clause1));
                      Unit2 := Unit (Parent (Clause2));
 
-                     --  If both clauses are on same unit, report redundancy
+                     --  If both clauses are on same unit, or one is the body
+                     --  of the other, or one of them is in a subunit, report
+                     --  redundancy on the later one.
 
                      if Unit1 = Unit2 then
                         Error_Msg_Sloc := Sloc (Current_Use_Clause (T));
@@ -7257,6 +7259,23 @@ package body Sem_Ch8 is
                           ("& is already use-visible through previous "
                            & "use_type_clause #?", Clause1, T);
                         return;
+
+                     elsif Nkind (Unit1) = N_Subunit then
+                        Error_Msg_Sloc := Sloc (Current_Use_Clause (T));
+                        Error_Msg_NE
+                          ("& is already use-visible through previous "
+                           & "use_type_clause #?", Clause1, T);
+                        return;
+
+                     elsif Nkind_In (Unit2, N_Package_Body, N_Subprogram_Body)
+                       and then Nkind (Unit1) /= Nkind (Unit2)
+                       and then Nkind (Unit1) /= N_Subunit
+                     then
+                        Error_Msg_Sloc := Sloc (Clause1);
+                        Error_Msg_NE
+                          ("& is already use-visible through previous "
+                           & "use_type_clause #?", Current_Use_Clause (T), T);
+                        return;
                      end if;
 
                      --  There is a redundant use type clause in a child unit.