From 9233179635359b5065c8c6ea90712f1b10dbb767 Mon Sep 17 00:00:00 2001 From: charlet Date: Fri, 30 Jan 2015 11:02:18 +0000 Subject: 2015-01-30 Robert Dewar * sem_disp.adb: Minor reformatting. * sem_disp.ads: Documentation update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220278 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 ++++ gcc/ada/sem_disp.adb | 8 +++--- gcc/ada/sem_disp.ads | 71 ++++++++++++++++++++++++++++++---------------------- 3 files changed, 50 insertions(+), 34 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a67b7d37ded..9fc99b8f8c1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2015-01-30 Robert Dewar + + * sem_disp.adb: Minor reformatting. + * sem_disp.ads: Documentation update. + 2015-01-30 Ed Schonberg * sem_disp.adb (Is_Dynamically_Tagged): when applied to an entity diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb index 0a9bfba5942..b49913dd57a 100644 --- a/gcc/ada/sem_disp.adb +++ b/gcc/ada/sem_disp.adb @@ -563,8 +563,8 @@ package body Sem_Disp is null; elsif Ekind (Current_Scope) = E_Function - and then Nkind (Unit_Declaration_Node (Current_Scope)) - = N_Generic_Subprogram_Declaration + and then Nkind (Unit_Declaration_Node (Current_Scope)) = + N_Generic_Subprogram_Declaration then null; @@ -2172,7 +2172,7 @@ package body Sem_Disp is elsif Present (Find_Controlling_Arg (N)) then return True; - -- Special cases : entities, and calls that dispatch on result. + -- Special cases: entities, and calls that dispatch on result elsif Is_Entity_Name (N) then return Is_Class_Wide_Type (Etype (N)); @@ -2182,7 +2182,7 @@ package body Sem_Disp is then return True; - -- Otherwise check whether call has controlling argument. + -- Otherwise check whether call has controlling argument else return False; diff --git a/gcc/ada/sem_disp.ads b/gcc/ada/sem_disp.ads index 7dbec1b1c91..21d1da5fe39 100644 --- a/gcc/ada/sem_disp.ads +++ b/gcc/ada/sem_disp.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -30,26 +30,27 @@ with Types; use Types; package Sem_Disp is procedure Check_Controlling_Formals (Typ : Entity_Id; Subp : Entity_Id); - -- Check that all controlling parameters of Subp are of type Typ, - -- that defaults for controlling parameters are tag-indeterminate, - -- and that the nominal subtype of the parameters and result - -- statically match the first subtype of the controlling type. + -- Check that all controlling parameters of Subp are of type Typ, that + -- defaults for controlling parameters are tag-indeterminate, and that the + -- nominal subtype of the parameters and result statically match the first + -- subtype of the controlling type. Issues appropriate error messages if + -- any of these requirements is not met. procedure Check_Dispatching_Call (N : Node_Id); - -- Check if a call is a dispatching call. The subprogram is known to - -- be a dispatching operation. The call is dispatching if all the - -- controlling actuals are dynamically tagged. This procedure is called - -- after overload resolution, so the call is known to be unambiguous. + -- Check if the call N is a dispatching call. The subprogram is known to be + -- a dispatching operation. The call is dispatching if all the controlling + -- actuals are dynamically tagged. This procedure is called after overload + -- resolution, so the call is known to be unambiguous. procedure Check_Dispatching_Operation (Subp, Old_Subp : Entity_Id); - -- Add "Subp" to the list of primitive operations of the corresponding type + -- Add Subp to the list of primitive operations of the corresponding type -- if it has a parameter of this type and is defined at a proper place for -- primitive operations (new primitives are only defined in package spec, -- overridden operation can be defined in any scope). If Old_Subp is not -- Empty we are in the overriding case. If the tagged type associated with -- Subp is a concurrent type (case that occurs when the type is declared in -- a generic because the analysis of generics disables generation of the - -- corresponding record) then this routine does does not add "Subp" to the + -- corresponding record) then this routine does does not add Subp to the -- list of primitive operations but leaves Subp decorated as dispatching -- operation to enable checks associated with the Object.Operation notation @@ -59,12 +60,15 @@ package Sem_Disp is -- If a primitive operation was defined for the incomplete view of the -- type, and the full type declaration is a derived type definition, -- the operation may override an inherited one. + -- Need more description here, what are the parameters, and what does + -- this call actually do??? procedure Check_Operation_From_Private_View (Subp, Old_Subp : Entity_Id); - -- Add "Old_Subp" to the list of primitive operations of the corresponding + -- Add Old_Subp to the list of primitive operations of the corresponding -- tagged type if it is the full view of a private tagged type. The Alias - -- of "OldSubp" is adjusted to point to the inherited procedure of the + -- of Old_Subp is adjusted to point to the inherited procedure of the -- full view because it is always this one which has to be called. + -- What is Subp used for??? function Covers_Some_Interface (Prim : Entity_Id) return Boolean; -- Returns true if Prim covers some interface primitive of its associated @@ -72,21 +76,21 @@ package Sem_Disp is -- is invoked. function Find_Controlling_Arg (N : Node_Id) return Node_Id; - -- Returns the actual controlling argument if N is dynamically tagged, - -- and Empty if it is not dynamically tagged. + -- Returns the actual controlling argument if N is dynamically tagged, and + -- Empty if it is not dynamically tagged. function Find_Dispatching_Type (Subp : Entity_Id) return Entity_Id; - -- Check whether a subprogram is dispatching, and find the tagged type of - -- the controlling argument or arguments. Returns Empty if Subp is not a - -- dispatching operation. + -- Check whether the subprogram Subp is dispatching, and find the tagged + -- type of the controlling argument or arguments. Returns Empty if Subp + -- is not a dispatching operation. function Find_Primitive_Covering_Interface (Tagged_Type : Entity_Id; Iface_Prim : Entity_Id) return Entity_Id; - -- Search in the homonym chain for the primitive of Tagged_Type that covers + -- Search the homonym chain for the primitive of Tagged_Type that covers -- Iface_Prim. The homonym chain traversal is required to catch primitives -- associated with the partial view of private types when processing the - -- corresponding full view. If the entity is not found then search for it + -- corresponding full view. If the entity is not found, then search for it -- in the list of primitives of Tagged_Type. This latter search is needed -- when the interface primitive is covered by a private subprogram. If the -- primitive has not been covered yet then return the entity that will be @@ -115,32 +119,39 @@ package Sem_Disp is -- and Interfaces_Only should be True. function Is_Dynamically_Tagged (N : Node_Id) return Boolean; - -- Used to determine whether a call is dispatching, i.e. if is an + -- Used to determine whether a call is dispatching, i.e. if it is -- an expression of a class_Wide type, or a call to a function with -- controlling result where at least one operand is dynamically tagged. + -- Also used to determine whether an entity has a class-wide type, or a + -- function call that dispatches on the result. Used to verify that all the + -- dependent expressions in a conditional expression are equally tagged. function Is_Null_Interface_Primitive (E : Entity_Id) return Boolean; -- Returns True if E is a null procedure that is an interface primitive function Is_Tag_Indeterminate (N : Node_Id) return Boolean; - -- An expression is tag-indeterminate if it is a call that dispatches - -- on result, and all controlling operands are also indeterminate. - -- Such a function call may inherit a tag from an enclosing call. + -- Returns true if the expression N is tag-indeterminate. An expression + -- is tag-indeterminate if it is a call that dispatches on result, and all + -- controlling operands are also indeterminate. Such a function call may + -- inherit a tag from an enclosing call. procedure Override_Dispatching_Operation (Tagged_Type : Entity_Id; Prev_Op : Entity_Id; New_Op : Entity_Id; Is_Wrapper : Boolean := False); - -- Replace an implicit dispatching operation with an explicit one. - -- Prev_Op is an inherited primitive operation which is overridden - -- by the explicit declaration of New_Op. Is_Wrapper is True when - -- New_Op is an internally generated wrapper of a controlling function. + -- Replace an implicit dispatching operation of the type Tagged_Type + -- with an explicit one. Prev_Op is an inherited primitive operation which + -- is overridden by the explicit declaration of New_Op. Is_Wrapper is + -- True when New_Op is an internally generated wrapper of a controlling + -- function. The caller checks that Tagged_Type is indeed a tagged type. procedure Propagate_Tag (Control : Node_Id; Actual : Node_Id); - -- If a function call is tag-indeterminate, its controlling argument is - -- found in the context; either an enclosing call, or the left-hand side + -- If a function call is tag-indeterminate, its controlling argument is + -- found in the context: either an enclosing call, or the left-hand side -- of the enclosing assignment statement. The tag must be propagated -- recursively to the tag-indeterminate actuals of the call. + -- Need clear description of the parameters Control and Actual, especially + -- since the comments above refer to actuals in the plural ??? end Sem_Disp; -- cgit v1.2.1