From: Arnaud Charlet Date: Mon, 4 Oct 2010 13:16:56 +0000 (+0200) Subject: [multiple changes] X-Git-Tag: releases/gcc-4.6.0~3921 X-Git-Url: https://gcc.gnu.org/git/?a=commitdiff_plain;h=1366997bf20c36a7d0701a4f4e09b7d8b523e828;p=gcc.git [multiple changes] 2010-10-04 Vincent Celier * 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 * sem_res.adb: Minor reformatting. 2010-10-04 Ed Schonberg * 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 * 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 * checks.adb: Update comment. From-SVN: r164933 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index abc84298ca9b..8596df4fb290 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,30 @@ +2010-10-04 Vincent Celier + + * 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 + + * sem_res.adb: Minor reformatting. + +2010-10-04 Ed Schonberg + + * 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 + + * 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 + + * checks.adb: Update comment. + 2010-09-30 Joseph Myers * gcc-interface/misc.c (optimize, optimize_size): Undefine as macros diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 7448168566cb..b67e8d6d66c3 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -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); diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index a379e3ae9847..80b3eb197764 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -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; diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index b61eeabc3d65..75e98ba188a8 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -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. diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 7cca8abe4636..fa0b66be5b45 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -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); diff --git a/gcc/ada/sinput-l.adb b/gcc/ada/sinput-l.adb index d29659755ff0..98ad104d020e 100644 --- a/gcc/ada/sinput-l.adb +++ b/gcc/ada/sinput-l.adb @@ -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;