mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-27 12:01:06 +08:00
exp_ch4.adb, [...]: Minor typo fix and reformatting.
2017-04-27 Gary Dismukes <dismukes@adacore.com> * exp_ch4.adb, sem_ch4.adb: Minor typo fix and reformatting. From-SVN: r247294
This commit is contained in:
parent
985b839307
commit
0c3ef0cc2a
@ -1,3 +1,7 @@
|
||||
2017-04-27 Gary Dismukes <dismukes@adacore.com>
|
||||
|
||||
* exp_ch4.adb, sem_ch4.adb: Minor typo fix and reformatting.
|
||||
|
||||
2017-04-25 Arnaud Charlet <charlet@adacore.com>
|
||||
|
||||
* gnat_rm.texi, gnat_ugn.texi,
|
||||
|
@ -4869,11 +4869,10 @@ package body Exp_Ch4 is
|
||||
else
|
||||
if Generate_C_Code then
|
||||
|
||||
-- We cannot ensure that correct C code will be generated if
|
||||
-- any temporary is created down the line (to e.g. handle
|
||||
-- checks or capture values) since we might end up with
|
||||
-- dangling references to local variables, so better be safe
|
||||
-- and reject the construct.
|
||||
-- We cannot ensure that correct C code will be generated if any
|
||||
-- temporary is created down the line (to e.g. handle checks or
|
||||
-- capture values) since we might end up with dangling references
|
||||
-- to local variables, so better be safe and reject the construct.
|
||||
|
||||
Error_Msg_N
|
||||
("case expression too complex, use case statement instead", N);
|
||||
|
@ -7521,20 +7521,20 @@ package body Sem_Ch4 is
|
||||
is
|
||||
Pref_Typ : constant Entity_Id := Etype (Prefix);
|
||||
|
||||
function Constant_Indexing_OK return Boolean;
|
||||
-- Constant_Indexing is legal if there is no Variable_Indexing defined
|
||||
-- for the type, or else node not a target of assignment, or an actual
|
||||
-- for an IN OUT or OUT formal (RM 4.1.6 (11)).
|
||||
|
||||
function Expr_Matches_In_Formal
|
||||
(Subp : Entity_Id;
|
||||
Par : Node_Id) return Boolean;
|
||||
-- Find formal corresponding to given indexed component that is an
|
||||
-- actual in a call. Note that the enclosing subprogram call has not
|
||||
-- beenanalyzed yet, and the parameter list is not normalized, so
|
||||
-- been analyzed yet, and the parameter list is not normalized, so
|
||||
-- that if the argument is a parameter association we must match it
|
||||
-- by name and not by position.
|
||||
|
||||
function Constant_Indexing_OK return Boolean;
|
||||
-- Constant_Indexing is legal if there is no Variable_Indexing defined
|
||||
-- for the type, or else node not a target of assignment, or an actual
|
||||
-- for an IN OUT or OUT formal (RM 4.1.6 (11)).
|
||||
|
||||
function Find_Indexing_Operations
|
||||
(T : Entity_Id;
|
||||
Nam : Name_Id;
|
||||
@ -7544,56 +7544,6 @@ package body Sem_Ch4 is
|
||||
-- interpretations. Flag Is_Constant should be set when the context is
|
||||
-- constant indexing.
|
||||
|
||||
-----------------------------
|
||||
-- Expr_Matches_In_Formal --
|
||||
-----------------------------
|
||||
|
||||
function Expr_Matches_In_Formal
|
||||
(Subp : Entity_Id;
|
||||
Par : Node_Id) return Boolean
|
||||
is
|
||||
Actual : Node_Id;
|
||||
Formal : Node_Id;
|
||||
|
||||
begin
|
||||
Formal := First_Formal (Subp);
|
||||
Actual := First (Parameter_Associations ((Parent (Par))));
|
||||
|
||||
if Nkind (Par) /= N_Parameter_Association then
|
||||
|
||||
-- Match by position.
|
||||
|
||||
while Present (Actual) and then Present (Formal) loop
|
||||
exit when Actual = Par;
|
||||
Next (Actual);
|
||||
|
||||
if Present (Formal) then
|
||||
Next_Formal (Formal);
|
||||
|
||||
-- Otherwise this is a parameter mismatch, the error is
|
||||
-- reported elsewhere, or else variable indexing is implied.
|
||||
|
||||
else
|
||||
return False;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
else
|
||||
-- Match by name
|
||||
|
||||
while Present (Formal) loop
|
||||
exit when Chars (Formal) = Chars (Selector_Name (Par));
|
||||
Next_Formal (Formal);
|
||||
|
||||
if No (Formal) then
|
||||
return False;
|
||||
end if;
|
||||
end loop;
|
||||
end if;
|
||||
|
||||
return Present (Formal) and then Ekind (Formal) = E_In_Parameter;
|
||||
end Expr_Matches_In_Formal;
|
||||
|
||||
--------------------------
|
||||
-- Constant_Indexing_OK --
|
||||
--------------------------
|
||||
@ -7653,7 +7603,7 @@ package body Sem_Ch4 is
|
||||
end loop;
|
||||
end;
|
||||
|
||||
-- All interpretations have a matching in-formal.
|
||||
-- All interpretations have a matching in-mode formal
|
||||
|
||||
return True;
|
||||
|
||||
@ -7711,6 +7661,56 @@ package body Sem_Ch4 is
|
||||
return True;
|
||||
end Constant_Indexing_OK;
|
||||
|
||||
-----------------------------
|
||||
-- Expr_Matches_In_Formal --
|
||||
-----------------------------
|
||||
|
||||
function Expr_Matches_In_Formal
|
||||
(Subp : Entity_Id;
|
||||
Par : Node_Id) return Boolean
|
||||
is
|
||||
Actual : Node_Id;
|
||||
Formal : Node_Id;
|
||||
|
||||
begin
|
||||
Formal := First_Formal (Subp);
|
||||
Actual := First (Parameter_Associations ((Parent (Par))));
|
||||
|
||||
if Nkind (Par) /= N_Parameter_Association then
|
||||
|
||||
-- Match by position
|
||||
|
||||
while Present (Actual) and then Present (Formal) loop
|
||||
exit when Actual = Par;
|
||||
Next (Actual);
|
||||
|
||||
if Present (Formal) then
|
||||
Next_Formal (Formal);
|
||||
|
||||
-- Otherwise this is a parameter mismatch, the error is
|
||||
-- reported elsewhere, or else variable indexing is implied.
|
||||
|
||||
else
|
||||
return False;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
else
|
||||
-- Match by name
|
||||
|
||||
while Present (Formal) loop
|
||||
exit when Chars (Formal) = Chars (Selector_Name (Par));
|
||||
Next_Formal (Formal);
|
||||
|
||||
if No (Formal) then
|
||||
return False;
|
||||
end if;
|
||||
end loop;
|
||||
end if;
|
||||
|
||||
return Present (Formal) and then Ekind (Formal) = E_In_Parameter;
|
||||
end Expr_Matches_In_Formal;
|
||||
|
||||
------------------------------
|
||||
-- Find_Indexing_Operations --
|
||||
------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user