2010-10-04 Vincent Celier <celier@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Oct 2010 13:16:56 +0000 (13:16 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Oct 2010 13:16:56 +0000 (13:16 +0000)
* sinput-l.adb (Load_File): Do not fail when switch -gnateG is
specified and the processed file cannot be written. Just issue a
warning and continue.

2010-10-04  Thomas Quinot  <quinot@adacore.com>

* sem_res.adb: Minor reformatting.

2010-10-04  Ed Schonberg  <schonberg@adacore.com>

* sem_ch8.adb (Analyze_Subprogram_Renaming): If the renamed operation
is an overridden inherited operation, the desired operation is the
overriding one, which is the alias of the visible one.

2010-10-04  Ed Schonberg  <schonberg@adacore.com>

* sem_ch6.adb (Find_Corresponding_Spec): Check that the wrapper body is
present before deleting from the tree, when an inherited function with
a controlling result that returns a null extension is overridden by a
later declaration or body.

2010-10-04  Gary Dismukes  <dismukes@adacore.com>

* checks.adb: Update comment.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164933 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/checks.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_ch8.adb
gcc/ada/sem_res.adb
gcc/ada/sinput-l.adb

index abc8429..8596df4 100644 (file)
@@ -1,3 +1,30 @@
+2010-10-04  Vincent Celier  <celier@adacore.com>
+
+       * sinput-l.adb (Load_File): Do not fail when switch -gnateG is
+       specified and the processed file cannot be written. Just issue a
+       warning and continue.
+
+2010-10-04  Thomas Quinot  <quinot@adacore.com>
+
+       * sem_res.adb: Minor reformatting.
+
+2010-10-04  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch8.adb (Analyze_Subprogram_Renaming): If the renamed operation
+       is an overridden inherited operation, the desired operation is the
+       overriding one, which is the alias of the visible one.
+
+2010-10-04  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch6.adb (Find_Corresponding_Spec): Check that the wrapper body is
+       present before deleting from the tree, when an inherited function with
+       a controlling result that returns a null extension is overridden by a
+       later declaration or body.
+
+2010-10-04  Gary Dismukes  <dismukes@adacore.com>
+
+       * checks.adb: Update comment.
+
 2010-09-30  Joseph Myers  <joseph@codesourcery.com>
 
        * gcc-interface/misc.c (optimize, optimize_size): Undefine as macros
index 7448168..b67e8d6 100644 (file)
@@ -819,15 +819,6 @@ package body Checks is
                      --  node is retained, in order to avoid the warning for
                      --  redundant conversions in Resolve_Type_Conversion.
 
-                     --  The above comment is uncomfortable. This seems like
-                     --  an awkward covert channel, since there isno general
-                     --  requirement in sinfo.ads or einfo.ads that requires
-                     --  this rewrite. Instead, the issue seems to be that in
-                     --  the old code, some node was incorrectly marked as
-                     --  coming from source when it should not have been and/or
-                     --  the warning code did not properly test the appropriate
-                     --  Comes_From_Soure flag. ???
-
                      Rewrite (N, Relocate_Node (N));
 
                      Set_Etype (N, Target_Type);
index a379e3a..80b3eb1 100644 (file)
@@ -5910,8 +5910,8 @@ package body Sem_Ch6 is
                --  that was created for an operation inherited by a null
                --  extension, it may be overridden by a body without a previous
                --  spec (one more reason why these should be shunned). In that
-               --  case remove the generated body, because the current one is
-               --  the explicit overriding.
+               --  case remove the generated body if present, because the
+               --  current one is the explicit overriding.
 
                elsif Ekind (E) = E_Function
                  and then Ada_Version >= Ada_05
@@ -5922,15 +5922,20 @@ package body Sem_Ch6 is
                then
                   Set_Has_Completion (E, False);
 
-                  if Expander_Active then
+                  if Expander_Active
+                    and then Nkind (Parent (E)) = N_Function_Specification
+                  then
                      Remove
                        (Unit_Declaration_Node
-                         (Corresponding_Body (Unit_Declaration_Node (E))));
+                          (Corresponding_Body (Unit_Declaration_Node (E))));
+
                      return E;
 
-                  --  If expansion is disabled, the wrapper function has not
-                  --  been generated, and this is the standard case of a late
-                  --  body overriding an inherited operation.
+                  --  If expansion is disabled, or if the wrapper function has
+                  --  not been generated yet, this a late body overriding an
+                  --  inherited operation, or it is an overriding by some other
+                  --  declaration before the controlling result is frozen. In
+                  --  either case this is a declaration of a new entity.
 
                   else
                      return Empty;
index b61eeab..75e98ba 100644 (file)
@@ -2100,6 +2100,21 @@ package body Sem_Ch8 is
       if No (Old_S) then
          Old_S := Find_Renamed_Entity (N, Name (N), New_S, Is_Actual);
 
+         --  The visible operation may be an inherited abstract operation that
+         --  was overridden in the private part, in which case a call will
+         --  dispatch to the overriding operation. Use the overriding one in
+         --  the renaming declaration, to prevent spurious errors below.
+
+         if Is_Overloadable (Old_S)
+           and then Is_Abstract_Subprogram (Old_S)
+           and then No (DTC_Entity (Old_S))
+           and then Present (Alias (Old_S))
+           and then not Is_Abstract_Subprogram (Alias (Old_S))
+           and then Is_Overriding_Operation (Alias (Old_S))
+         then
+            Old_S := Alias (Old_S);
+         end if;
+
          --  When the renamed subprogram is overloaded and used as an actual
          --  of a generic, its entity is set to the first available homonym.
          --  We must first disambiguate the name, then set the proper entity.
index 7cca8ab..fa0b66b 100644 (file)
@@ -8847,9 +8847,8 @@ package body Sem_Res is
             --  own expression is a possibly overloaded function call. The
             --  qualified expression is needed to be disambiguate the call,
             --  but it appears in a context in which a name is needed, forcing
-            --  the use of a conversion.
-            --  In Ada2012 a qualified expression is a name, and this idiom
-            --  is not needed any longer.
+            --  the use of a conversion. In Ada 2012, a qualified expression is
+            --  a name, and this idiom is no longer needed.
 
             elsif Nkind (Orig_N) = N_Qualified_Expression
               and then Nkind (Expression (Orig_N)) = N_Function_Call
@@ -9255,9 +9254,9 @@ package body Sem_Res is
 
          Rewrite (N, Op_Node);
 
-         --  If the context type is private, add the appropriate conversions
-         --  so that the operator is applied to the full view. This is done
-         --  in the routines that resolve intrinsic operators,
+         --  If the context type is private, add the appropriate conversions so
+         --  that the operator is applied to the full view. This is done in the
+         --  routines that resolve intrinsic operators.
 
          if Is_Intrinsic_Subprogram (Op)
            and then Is_Private_Type (Typ)
@@ -9277,9 +9276,8 @@ package body Sem_Res is
 
       elsif Ekind (Op) = E_Function and then Is_Intrinsic_Subprogram (Op) then
 
-         --  Operator renames a user-defined operator of the same name. Use
-         --  the original operator in the node, which is the one that Gigi
-         --  knows about.
+         --  Operator renames a user-defined operator of the same name. Use the
+         --  original operator in the node, which is the one Gigi knows about.
 
          Set_Entity (N, Op);
          Set_Is_Overloaded (N, False);
@@ -9290,12 +9288,12 @@ package body Sem_Res is
    -- Set_Slice_Subtype --
    -----------------------
 
-   --  Build an implicit subtype declaration to represent the type delivered
-   --  by the slice. This is an abbreviated version of an array subtype. We
-   --  define an index subtype for the slice, using either the subtype name
-   --  or the discrete range of the slice. To be consistent with index usage
-   --  elsewhere, we create a list header to hold the single index. This list
-   --  is not otherwise attached to the syntax tree.
+   --  Build an implicit subtype declaration to represent the type delivered by
+   --  the slice. This is an abbreviated version of an array subtype. We define
+   --  an index subtype for the slice, using either the subtype name or the
+   --  discrete range of the slice. To be consistent with index usage elsewhere
+   --  we create a list header to hold the single index. This list is not
+   --  otherwise attached to the syntax tree.
 
    procedure Set_Slice_Subtype (N : Node_Id) is
       Loc           : constant Source_Ptr := Sloc (N);
@@ -9401,10 +9399,10 @@ package body Sem_Res is
 
       if Is_OK_Static_Expression (Low_Bound) then
 
-      --  The low bound is set from the low bound of the corresponding
-      --  index type. Note that we do not store the high bound in the
-      --  string literal subtype, but it can be deduced if necessary
-      --  from the length and the low bound.
+      --  The low bound is set from the low bound of the corresponding index
+      --  type. Note that we do not store the high bound in the string literal
+      --  subtype, but it can be deduced if necessary from the length and the
+      --  low bound.
 
          Set_String_Literal_Low_Bound (Subtype_Id, Low_Bound);
 
index d296597..98ad104 100644 (file)
@@ -591,10 +591,9 @@ package body Sinput.L is
 
                         if not Status then
                            Errout.Error_Msg
-                             ("could not write processed file """ &
+                             ("?could not write processed file """ &
                               Name_Buffer (1 .. Name_Len) & '"',
                               Lo);
-                           return No_Source_File;
                         end if;
                      end;
                   end if;