Commit d63199d8 by Pierre-Marie de Rodat

exp_ch3.adb, [...]: Minor reformatting.

gcc/ada/

2017-11-09  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch3.adb, gnat1drv.adb, namet.adb, namet.ads, sem_aggr.adb,
	sem_ch2.adb, sem_ch4.adb: Minor reformatting.
	* sem_res.adb (Resolve_Entity_Name): Suppress spurious error on read of
	out parameter when in Ada_83 mode, the oarameter is of a composite
	type, and it appears as the prefix of an attribute.

2017-11-09  Bob Duff  <duff@adacore.com>

	* sinfo.ads: Minor comment fix.

2017-11-09  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_prag.ads: Add pragmas Unmodified and Unreferenced to table
	Pragma_Significant_In_SPARK.

gcc/testsuite/

2017-11-09  Hristian Kirtchev  <kirtchev@adacore.com>

	* gnat.dg/unreferenced.adb: New testcase.

2017-11-09  Ed Schonberg  <schonberg@adacore.com>

	* gnat.dg/out_param.adb: New testcase.

From-SVN: r254571
parent dcd5fd67
...@@ -8717,10 +8717,11 @@ package body Exp_Ch3 is ...@@ -8717,10 +8717,11 @@ package body Exp_Ch3 is
-- Initialize secondary tags -- Initialize secondary tags
else else
Initialize_Tag (Full_Typ, Initialize_Tag
Iface => Node (Iface_Elmt), (Typ => Full_Typ,
Tag_Comp => Tag_Comp, Iface => Node (Iface_Elmt),
Iface_Tag => Node (Iface_Tag_Elmt)); Tag_Comp => Tag_Comp,
Iface_Tag => Node (Iface_Tag_Elmt));
end if; end if;
-- Otherwise generate code to initialize the tag -- Otherwise generate code to initialize the tag
...@@ -8729,10 +8730,11 @@ package body Exp_Ch3 is ...@@ -8729,10 +8730,11 @@ package body Exp_Ch3 is
if (In_Variable_Pos and then Variable_Comps) if (In_Variable_Pos and then Variable_Comps)
or else (not In_Variable_Pos and then Fixed_Comps) or else (not In_Variable_Pos and then Fixed_Comps)
then then
Initialize_Tag (Full_Typ, Initialize_Tag
Iface => Node (Iface_Elmt), (Typ => Full_Typ,
Tag_Comp => Tag_Comp, Iface => Node (Iface_Elmt),
Iface_Tag => Node (Iface_Tag_Elmt)); Tag_Comp => Tag_Comp,
Iface_Tag => Node (Iface_Tag_Elmt));
end if; end if;
end if; end if;
......
...@@ -384,9 +384,10 @@ procedure Gnat1drv is ...@@ -384,9 +384,10 @@ procedure Gnat1drv is
Relaxed_RM_Semantics := True; Relaxed_RM_Semantics := True;
if not Generate_CodePeer_Messages then if not Generate_CodePeer_Messages then
-- Suppress compiler warnings by default when generating SCIL for -- Suppress compiler warnings by default when generating SCIL for
-- CodePeer, except when combined with -gnateC where we do want -- CodePeer, except when combined with -gnateC where we do want to
-- to emit GNAT warnings. -- emit GNAT warnings.
Warning_Mode := Suppress; Warning_Mode := Suppress;
end if; end if;
......
...@@ -175,7 +175,8 @@ package body Namet is ...@@ -175,7 +175,8 @@ package body Namet is
-------------------- --------------------
procedure Append_Decoded procedure Append_Decoded
(Buf : in out Bounded_String; Id : Valid_Name_Id) (Buf : in out Bounded_String;
Id : Valid_Name_Id)
is is
C : Character; C : Character;
P : Natural; P : Natural;
...@@ -599,7 +600,8 @@ package body Namet is ...@@ -599,7 +600,8 @@ package body Namet is
------------------------ ------------------------
procedure Append_Unqualified procedure Append_Unqualified
(Buf : in out Bounded_String; Id : Valid_Name_Id) (Buf : in out Bounded_String;
Id : Valid_Name_Id)
is is
Temp : Bounded_String; Temp : Bounded_String;
begin begin
...@@ -1476,7 +1478,10 @@ package body Namet is ...@@ -1476,7 +1478,10 @@ package body Namet is
-- Name_Equals -- -- Name_Equals --
----------------- -----------------
function Name_Equals (N1, N2 : Valid_Name_Id) return Boolean is function Name_Equals
(N1 : Valid_Name_Id;
N2 : Valid_Name_Id) return Boolean
is
begin begin
return N1 = N2 or else Get_Name_String (N1) = Get_Name_String (N2); return N1 = N2 or else Get_Name_String (N1) = Get_Name_String (N2);
end Name_Equals; end Name_Equals;
......
...@@ -358,7 +358,9 @@ package Namet is ...@@ -358,7 +358,9 @@ package Namet is
-- names, since these are efficiently located without hashing by Name_Find -- names, since these are efficiently located without hashing by Name_Find
-- in any case. -- in any case.
function Name_Equals (N1, N2 : Valid_Name_Id) return Boolean; function Name_Equals
(N1 : Valid_Name_Id;
N2 : Valid_Name_Id) return Boolean;
-- Return whether N1 and N2 denote the same character sequence -- Return whether N1 and N2 denote the same character sequence
function Get_Name_String (Id : Valid_Name_Id) return String; function Get_Name_String (Id : Valid_Name_Id) return String;
......
...@@ -2765,7 +2765,7 @@ package body Sem_Aggr is ...@@ -2765,7 +2765,7 @@ package body Sem_Aggr is
----------------------------- -----------------------------
procedure Resolve_Delta_Aggregate (N : Node_Id; Typ : Entity_Id) is procedure Resolve_Delta_Aggregate (N : Node_Id; Typ : Entity_Id) is
Base : constant Node_Id := Expression (N); Base : constant Node_Id := Expression (N);
begin begin
if not Is_Composite_Type (Typ) then if not Is_Composite_Type (Typ) then
...@@ -2789,12 +2789,14 @@ package body Sem_Aggr is ...@@ -2789,12 +2789,14 @@ package body Sem_Aggr is
procedure Resolve_Delta_Array_Aggregate (N : Node_Id; Typ : Entity_Id) is procedure Resolve_Delta_Array_Aggregate (N : Node_Id; Typ : Entity_Id) is
Deltas : constant List_Id := Component_Associations (N); Deltas : constant List_Id := Component_Associations (N);
Assoc : Node_Id; Assoc : Node_Id;
Choice : Node_Id; Choice : Node_Id;
Index_Type : Entity_Id; Index_Type : Entity_Id;
begin begin
Index_Type := Etype (First_Index (Typ)); Index_Type := Etype (First_Index (Typ));
Assoc := First (Deltas); Assoc := First (Deltas);
while Present (Assoc) loop while Present (Assoc) loop
if Nkind (Assoc) = N_Iterated_Component_Association then if Nkind (Assoc) = N_Iterated_Component_Association then
...@@ -2843,10 +2845,12 @@ package body Sem_Aggr is ...@@ -2843,10 +2845,12 @@ package body Sem_Aggr is
else else
Analyze (Choice); Analyze (Choice);
if Is_Entity_Name (Choice) if Is_Entity_Name (Choice)
and then Is_Type (Entity (Choice)) and then Is_Type (Entity (Choice))
then then
-- Choice covers a range of values. -- Choice covers a range of values
if Base_Type (Entity (Choice)) /= if Base_Type (Entity (Choice)) /=
Base_Type (Index_Type) Base_Type (Index_Type)
then then
...@@ -2874,28 +2878,17 @@ package body Sem_Aggr is ...@@ -2874,28 +2878,17 @@ package body Sem_Aggr is
------------------------------------ ------------------------------------
procedure Resolve_Delta_Record_Aggregate (N : Node_Id; Typ : Entity_Id) is procedure Resolve_Delta_Record_Aggregate (N : Node_Id; Typ : Entity_Id) is
Deltas : constant List_Id := Component_Associations (N);
Assoc : Node_Id;
Choice : Node_Id;
Comp_Type : Entity_Id;
-- Variables used to verify that discriminant-dependent components
-- appear in the same variant.
Variant : Node_Id;
Comp_Ref : Entity_Id;
procedure Check_Variant (Id : Entity_Id); procedure Check_Variant (Id : Entity_Id);
-- If a given component of the delta aggregate appears in a variant -- If a given component of the delta aggregate appears in a variant
-- part, verify that it is within the same variant as that of previous -- part, verify that it is within the same variant as that of previous
-- specified variant components of the delta. -- specified variant components of the delta.
function Nested_In (V1, V2 : Node_Id) return Boolean;
-- Determine whether variant V1 is within variant V2.
function Get_Component_Type (Nam : Node_Id) return Entity_Id; function Get_Component_Type (Nam : Node_Id) return Entity_Id;
-- Locate component with a given name and return its type. If none -- Locate component with a given name and return its type. If none found
-- found report error. -- report error.
function Nested_In (V1 : Node_Id; V2 : Node_Id) return Boolean;
-- Determine whether variant V1 is within variant V2
function Variant_Depth (N : Node_Id) return Integer; function Variant_Depth (N : Node_Id) return Integer;
-- Determine the distance of a variant to the enclosing type -- Determine the distance of a variant to the enclosing type
...@@ -2907,13 +2900,17 @@ package body Sem_Aggr is ...@@ -2907,13 +2900,17 @@ package body Sem_Aggr is
procedure Check_Variant (Id : Entity_Id) is procedure Check_Variant (Id : Entity_Id) is
Comp : Entity_Id; Comp : Entity_Id;
Comp_Ref : Entity_Id;
Comp_Variant : Node_Id; Comp_Variant : Node_Id;
Variant : Node_Id;
begin begin
if not Has_Discriminants (Typ) then if not Has_Discriminants (Typ) then
return; return;
end if; end if;
Variant := Empty;
Comp := First_Entity (Typ); Comp := First_Entity (Typ);
while Present (Comp) loop while Present (Comp) loop
exit when Chars (Comp) = Chars (Id); exit when Chars (Comp) = Chars (Id);
...@@ -2937,9 +2934,9 @@ package body Sem_Aggr is ...@@ -2937,9 +2934,9 @@ package body Sem_Aggr is
begin begin
if D1 = D2 if D1 = D2
or else or else
(D1 > D2 and then not Nested_In (Variant, Comp_Variant)) (D1 > D2 and then not Nested_In (Variant, Comp_Variant))
or else or else
(D2 > D1 and then not Nested_In (Comp_Variant, Variant)) (D2 > D1 and then not Nested_In (Comp_Variant, Variant))
then then
Error_Msg_Node_2 := Comp_Ref; Error_Msg_Node_2 := Comp_Ref;
Error_Msg_NE Error_Msg_NE
...@@ -2955,18 +2952,45 @@ package body Sem_Aggr is ...@@ -2955,18 +2952,45 @@ package body Sem_Aggr is
end if; end if;
end Check_Variant; end Check_Variant;
------------------------
-- Get_Component_Type --
------------------------
function Get_Component_Type (Nam : Node_Id) return Entity_Id is
Comp : Entity_Id;
begin
Comp := First_Entity (Typ);
while Present (Comp) loop
if Chars (Comp) = Chars (Nam) then
if Ekind (Comp) = E_Discriminant then
Error_Msg_N ("delta cannot apply to discriminant", Nam);
end if;
return Etype (Comp);
end if;
Comp := Next_Entity (Comp);
end loop;
Error_Msg_NE ("type& has no component with this name", Nam, Typ);
return Any_Type;
end Get_Component_Type;
--------------- ---------------
-- Nested_In -- -- Nested_In --
--------------- ---------------
function Nested_In (V1, V2 : Node_Id) return Boolean is function Nested_In (V1, V2 : Node_Id) return Boolean is
Par : Node_Id; Par : Node_Id;
begin begin
Par := Parent (V1); Par := Parent (V1);
while Nkind (Par) /= N_Full_Type_Declaration loop while Nkind (Par) /= N_Full_Type_Declaration loop
if Par = V2 then if Par = V2 then
return True; return True;
end if; end if;
Par := Parent (Par); Par := Parent (Par);
end loop; end loop;
...@@ -2980,53 +3004,35 @@ package body Sem_Aggr is ...@@ -2980,53 +3004,35 @@ package body Sem_Aggr is
function Variant_Depth (N : Node_Id) return Integer is function Variant_Depth (N : Node_Id) return Integer is
Depth : Integer; Depth : Integer;
Par : Node_Id; Par : Node_Id;
begin begin
Depth := 0; Depth := 0;
Par := Parent (N); Par := Parent (N);
while Nkind (Par) /= N_Full_Type_Declaration loop while Nkind (Par) /= N_Full_Type_Declaration loop
Depth := Depth + 1; Depth := Depth + 1;
Par := Parent (Par); Par := Parent (Par);
end loop; end loop;
return Depth; return Depth;
end Variant_Depth; end Variant_Depth;
------------------------ -- Local variables
-- Get_Component_Type --
------------------------
function Get_Component_Type (Nam : Node_Id) return Entity_Id is
Comp : Entity_Id;
begin
Comp := First_Entity (Typ);
while Present (Comp) loop
if Chars (Comp) = Chars (Nam) then
if Ekind (Comp) = E_Discriminant then
Error_Msg_N ("delta cannot apply to discriminant", Nam);
end if;
return Etype (Comp);
end if;
Comp := Next_Entity (Comp); Deltas : constant List_Id := Component_Associations (N);
end loop;
Error_Msg_NE ("type& has no component with this name", Nam, Typ); Assoc : Node_Id;
return Any_Type; Choice : Node_Id;
end Get_Component_Type; Comp_Type : Entity_Id;
-- Start of processing for Resolve_Delta_Record_Aggregate -- Start of processing for Resolve_Delta_Record_Aggregate
begin begin
Variant := Empty;
Assoc := First (Deltas); Assoc := First (Deltas);
while Present (Assoc) loop while Present (Assoc) loop
Choice := First (Choice_List (Assoc)); Choice := First (Choice_List (Assoc));
while Present (Choice) loop while Present (Choice) loop
Comp_Type := Get_Component_Type (Choice); Comp_Type := Get_Component_Type (Choice);
if Comp_Type /= Any_Type then if Comp_Type /= Any_Type then
Check_Variant (Choice); Check_Variant (Choice);
end if; end if;
......
...@@ -68,9 +68,7 @@ package body Sem_Ch2 is ...@@ -68,9 +68,7 @@ package body Sem_Ch2 is
-- this is the result of some kind of previous error generating a -- this is the result of some kind of previous error generating a
-- junk identifier. -- junk identifier.
if not Is_Valid_Name (Chars (N)) if not Is_Valid_Name (Chars (N)) and then Total_Errors_Detected /= 0 then
and then Total_Errors_Detected /= 0
then
return; return;
else else
Find_Direct_Name (N); Find_Direct_Name (N);
......
...@@ -412,12 +412,12 @@ package body Sem_Ch4 is ...@@ -412,12 +412,12 @@ package body Sem_Ch4 is
-- Analyze_Aggregate -- -- Analyze_Aggregate --
----------------------- -----------------------
-- Most of the analysis of Aggregates requires that the type be known, -- Most of the analysis of Aggregates requires that the type be known, and
-- and is therefore put off until resolution of the context. -- is therefore put off until resolution of the context. Delta aggregates
-- Delta aggregates have a base component that determines the type of the -- have a base component that determines the enclosing aggregate type so
-- enclosing aggregate so its type can be ascertained earlier. This also -- its type can be ascertained earlier. This also allows delta aggregates
-- allows delta aggregates to appear in the context of a record type with -- to appear in the context of a record type with a private extension, as
-- a private extension, as per the latest update of AI12-0127. -- per the latest update of AI12-0127.
procedure Analyze_Aggregate (N : Node_Id) is procedure Analyze_Aggregate (N : Node_Id) is
begin begin
...@@ -425,14 +425,15 @@ package body Sem_Ch4 is ...@@ -425,14 +425,15 @@ package body Sem_Ch4 is
if Nkind (N) = N_Delta_Aggregate then if Nkind (N) = N_Delta_Aggregate then
declare declare
Base : constant Node_Id := Expression (N); Base : constant Node_Id := Expression (N);
I : Interp_Index; I : Interp_Index;
It : Interp; It : Interp;
begin begin
Analyze (Base); Analyze (Base);
-- If the base is overloaded, propagate interpretations -- If the base is overloaded, propagate interpretations to the
-- to the enclosing aggregate. -- enclosing aggregate.
if Is_Overloaded (Base) then if Is_Overloaded (Base) then
Get_First_Interp (Base, I, It); Get_First_Interp (Base, I, It);
...@@ -1533,12 +1534,15 @@ package body Sem_Ch4 is ...@@ -1533,12 +1534,15 @@ package body Sem_Ch4 is
and then Present (Limited_View (Scope (Etype (N)))) and then Present (Limited_View (Scope (Etype (N))))
and then not Analyzed (Unit_Declaration_Node (Scope (Etype (N)))) and then not Analyzed (Unit_Declaration_Node (Scope (Etype (N))))
then then
Error_Msg_NE ("cannot call function that returns "
& "limited view of}", N, Etype (N));
Error_Msg_NE Error_Msg_NE
("\there must be a regular with_clause for package& " ("cannot call function that returns limited view of}",
& "in the current unit, or in some unit in its context", N, Etype (N));
N, Scope (Etype (N)));
Error_Msg_NE
("\there must be a regular with_clause for package & in the "
& "current unit, or in some unit in its context",
N, Scope (Etype (N)));
Set_Etype (N, Any_Type); Set_Etype (N, Any_Type);
end if; end if;
end if; end if;
......
...@@ -191,6 +191,8 @@ package Sem_Prag is ...@@ -191,6 +191,8 @@ package Sem_Prag is
Pragma_Remote_Types => False, Pragma_Remote_Types => False,
Pragma_Shared_Passive => False, Pragma_Shared_Passive => False,
Pragma_Task_Dispatching_Policy => False, Pragma_Task_Dispatching_Policy => False,
Pragma_Unmodified => False,
Pragma_Unreferenced => False,
Pragma_Warnings => False, Pragma_Warnings => False,
others => True); others => True);
......
...@@ -2442,8 +2442,8 @@ package body Sem_Res is ...@@ -2442,8 +2442,8 @@ package body Sem_Res is
elsif Nkind_In (N, N_Case_Expression, elsif Nkind_In (N, N_Case_Expression,
N_Character_Literal, N_Character_Literal,
N_If_Expression, N_Delta_Aggregate,
N_Delta_Aggregate) N_If_Expression)
then then
Set_Etype (N, Expr_Type); Set_Etype (N, Expr_Type);
...@@ -5197,11 +5197,11 @@ package body Sem_Res is ...@@ -5197,11 +5197,11 @@ package body Sem_Res is
-- user about it here. -- user about it here.
if Ekind (Typ) = E_Anonymous_Access_Type if Ekind (Typ) = E_Anonymous_Access_Type
and then Is_Controlled_Active (Desig_T) and then Is_Controlled_Active (Desig_T)
then then
Error_Msg_N ("??anonymous access-to-controlled object will " Error_Msg_N
& "be finalized when its enclosing unit goes out " ("??anonymous access-to-controlled object will be finalized "
& "of scope", N); & "when its enclosing unit goes out of scope", N);
end if; end if;
end if; end if;
end if; end if;
...@@ -7276,9 +7276,13 @@ package body Sem_Res is ...@@ -7276,9 +7276,13 @@ package body Sem_Res is
elsif Ekind (E) = E_Generic_Function then elsif Ekind (E) = E_Generic_Function then
Error_Msg_N ("illegal use of generic function", N); Error_Msg_N ("illegal use of generic function", N);
-- In Ada 83 an OUT parameter cannot be read -- In Ada 83 an OUT parameter cannot be read, but attributes of
-- array types (i.e. bounds and length) are legal.
elsif Ekind (E) = E_Out_Parameter elsif Ekind (E) = E_Out_Parameter
and then (Nkind (Parent (N)) /= N_Attribute_Reference
or else Is_Scalar_Type (Etype (E)))
and then (Nkind (Parent (N)) in N_Op and then (Nkind (Parent (N)) in N_Op
or else Nkind (Parent (N)) = N_Explicit_Dereference or else Nkind (Parent (N)) = N_Explicit_Dereference
or else Is_Assignment_Or_Object_Expression or else Is_Assignment_Or_Object_Expression
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
-- The tree contains not only the full syntactic representation of the -- The tree contains not only the full syntactic representation of the
-- program, but also the results of semantic analysis. In particular, the -- program, but also the results of semantic analysis. In particular, the
-- nodes for defining identifiers, defining character literals and defining -- nodes for defining identifiers, defining character literals, and defining
-- operator symbols, collectively referred to as entities, represent what -- operator symbols, collectively referred to as entities, represent what
-- would normally be regarded as the symbol table information. In addition a -- would normally be regarded as the symbol table information. In addition a
-- number of the tree nodes contain semantic information. -- number of the tree nodes contain semantic information.
...@@ -213,7 +213,7 @@ package Sinfo is ...@@ -213,7 +213,7 @@ package Sinfo is
-- The Present function tests for Empty, which in this case signals the end -- The Present function tests for Empty, which in this case signals the end
-- of the list. First returns Empty immediately if the list is empty. -- of the list. First returns Empty immediately if the list is empty.
-- Present is defined in Atree, First and Next are defined in Nlists. -- Present is defined in Atree; First and Next are defined in Nlists.
-- The exceptions to this rule occur with {DEFINING_IDENTIFIERS} in all -- The exceptions to this rule occur with {DEFINING_IDENTIFIERS} in all
-- contexts, which is handled as described in the previous section, and -- contexts, which is handled as described in the previous section, and
...@@ -389,7 +389,7 @@ package Sinfo is ...@@ -389,7 +389,7 @@ package Sinfo is
-- In the following node definitions, all fields, both syntactic and -- In the following node definitions, all fields, both syntactic and
-- semantic, are documented. The one exception is in the case of entities -- semantic, are documented. The one exception is in the case of entities
-- (defining identifiers, character literals and operator symbols), where -- (defining identifiers, character literals, and operator symbols), where
-- the usage of the fields depends on the entity kind. Entity fields are -- the usage of the fields depends on the entity kind. Entity fields are
-- fully documented in the separate package Einfo. -- fully documented in the separate package Einfo.
...@@ -1116,7 +1116,7 @@ package Sinfo is ...@@ -1116,7 +1116,7 @@ package Sinfo is
-- complete a subprogram declaration. -- complete a subprogram declaration.
-- Corresponding_Spec_Of_Stub (Node2-Sem) -- Corresponding_Spec_Of_Stub (Node2-Sem)
-- This field is present in subprogram, package, task and protected body -- This field is present in subprogram, package, task, and protected body
-- stubs where it points to the corresponding spec of the stub. Due to -- stubs where it points to the corresponding spec of the stub. Due to
-- clashes in the structure of nodes, we cannot use Corresponding_Spec. -- clashes in the structure of nodes, we cannot use Corresponding_Spec.
...@@ -1754,7 +1754,7 @@ package Sinfo is ...@@ -1754,7 +1754,7 @@ package Sinfo is
-- Is_Generic_Contract_Pragma (Flag2-Sem) -- Is_Generic_Contract_Pragma (Flag2-Sem)
-- This flag is present in N_Pragma nodes. It is set when the pragma is -- This flag is present in N_Pragma nodes. It is set when the pragma is
-- a source construct, applies to a generic unit or its body and denotes -- a source construct, applies to a generic unit or its body, and denotes
-- one of the following contract-related annotations: -- one of the following contract-related annotations:
-- Abstract_State -- Abstract_State
-- Contract_Cases -- Contract_Cases
...@@ -1910,7 +1910,7 @@ package Sinfo is ...@@ -1910,7 +1910,7 @@ package Sinfo is
-- nodes which emulate the body of a task unit. -- nodes which emulate the body of a task unit.
-- Is_Task_Master (Flag5-Sem) -- Is_Task_Master (Flag5-Sem)
-- A flag set in a Subprogram_Body, Block_Statement or Task_Body node to -- A flag set in a Subprogram_Body, Block_Statement, or Task_Body node to
-- indicate that the construct is a task master (i.e. has declared tasks -- indicate that the construct is a task master (i.e. has declared tasks
-- or declares an access to a task type). -- or declares an access to a task type).
...@@ -2019,7 +2019,7 @@ package Sinfo is ...@@ -2019,7 +2019,7 @@ package Sinfo is
-- calls to Freeze_Expression. -- calls to Freeze_Expression.
-- Next_Entity (Node2-Sem) -- Next_Entity (Node2-Sem)
-- Present in defining identifiers, defining character literals and -- Present in defining identifiers, defining character literals, and
-- defining operator symbols (i.e. in all entities). The entities of a -- defining operator symbols (i.e. in all entities). The entities of a
-- scope are chained, and this field is used as the forward pointer for -- scope are chained, and this field is used as the forward pointer for
-- this list. See Einfo for further details. -- this list. See Einfo for further details.
...@@ -2236,7 +2236,7 @@ package Sinfo is ...@@ -2236,7 +2236,7 @@ package Sinfo is
-- because Analyze wants to insert extra actions on this list. -- because Analyze wants to insert extra actions on this list.
-- Rounded_Result (Flag18-Sem) -- Rounded_Result (Flag18-Sem)
-- Present in N_Type_Conversion, N_Op_Divide and N_Op_Multiply nodes. -- Present in N_Type_Conversion, N_Op_Divide, and N_Op_Multiply nodes.
-- Used in the fixed-point cases to indicate that the result must be -- Used in the fixed-point cases to indicate that the result must be
-- rounded as a result of the use of the 'Round attribute. Also used for -- rounded as a result of the use of the 'Round attribute. Also used for
-- integer N_Op_Divide nodes to indicate that the result should be -- integer N_Op_Divide nodes to indicate that the result should be
...@@ -2269,7 +2269,7 @@ package Sinfo is ...@@ -2269,7 +2269,7 @@ package Sinfo is
-- operation named (statically) in a dispatching call. -- operation named (statically) in a dispatching call.
-- Scope (Node3-Sem) -- Scope (Node3-Sem)
-- Present in defining identifiers, defining character literals and -- Present in defining identifiers, defining character literals, and
-- defining operator symbols (i.e. in all entities). The entities of a -- defining operator symbols (i.e. in all entities). The entities of a
-- scope all use this field to reference the corresponding scope entity. -- scope all use this field to reference the corresponding scope entity.
-- See Einfo for further details. -- See Einfo for further details.
...@@ -2341,7 +2341,7 @@ package Sinfo is ...@@ -2341,7 +2341,7 @@ package Sinfo is
-- always set to No_List. -- always set to No_List.
-- Treat_Fixed_As_Integer (Flag14-Sem) -- Treat_Fixed_As_Integer (Flag14-Sem)
-- This flag appears in operator nodes for divide, multiply, mod and rem -- This flag appears in operator nodes for divide, multiply, mod, and rem
-- on fixed-point operands. It indicates that the operands are to be -- on fixed-point operands. It indicates that the operands are to be
-- treated as integer values, ignoring small values. This flag is only -- treated as integer values, ignoring small values. This flag is only
-- set as a result of expansion of fixed-point operations. Typically a -- set as a result of expansion of fixed-point operations. Typically a
...@@ -2731,7 +2731,7 @@ package Sinfo is ...@@ -2731,7 +2731,7 @@ package Sinfo is
-- pain to allow these aspects to pervade the pragma syntax, and the -- pain to allow these aspects to pervade the pragma syntax, and the
-- representation of pragma nodes internally. So what we do is to -- representation of pragma nodes internally. So what we do is to
-- replace these ASPECT_MARK forms with identifiers whose name is one -- replace these ASPECT_MARK forms with identifiers whose name is one
-- of the special internal names _Pre, _Post or _Type_Invariant. -- of the special internal names _Pre, _Post, or _Type_Invariant.
-- We do a similar replacement of these Aspect_Mark forms in the -- We do a similar replacement of these Aspect_Mark forms in the
-- Expression of a pragma argument association for the cases of -- Expression of a pragma argument association for the cases of
...@@ -3028,8 +3028,8 @@ package Sinfo is ...@@ -3028,8 +3028,8 @@ package Sinfo is
-- [abstract] [limited] new [NULL_EXCLUSION] parent_SUBTYPE_INDICATION -- [abstract] [limited] new [NULL_EXCLUSION] parent_SUBTYPE_INDICATION
-- [[and INTERFACE_LIST] RECORD_EXTENSION_PART] -- [[and INTERFACE_LIST] RECORD_EXTENSION_PART]
-- Note: ABSTRACT, LIMITED and record extension part are not permitted -- Note: ABSTRACT, LIMITED, and record extension part are not permitted
-- in Ada 83 mode -- in Ada 83 mode.
-- Note: a record extension part is required if ABSTRACT is present -- Note: a record extension part is required if ABSTRACT is present
...@@ -3340,7 +3340,7 @@ package Sinfo is ...@@ -3340,7 +3340,7 @@ package Sinfo is
-- Subtype_Indication field or else the Access_Definition field. -- Subtype_Indication field or else the Access_Definition field.
-- N_Component_Definition -- N_Component_Definition
-- Sloc points to ALIASED, ACCESS or to first token of subtype mark -- Sloc points to ALIASED, ACCESS, or to first token of subtype mark
-- Aliased_Present (Flag4) -- Aliased_Present (Flag4)
-- Null_Exclusion_Present (Flag11) -- Null_Exclusion_Present (Flag11)
-- Subtype_Indication (Node5) (set to Empty if not present) -- Subtype_Indication (Node5) (set to Empty if not present)
...@@ -3488,7 +3488,7 @@ package Sinfo is ...@@ -3488,7 +3488,7 @@ package Sinfo is
-- end record -- end record
-- | null record -- | null record
-- Note: the Abstract_Present, Tagged_Present and Limited_Present -- Note: the Abstract_Present, Tagged_Present, and Limited_Present
-- flags appear only for a record definition appearing in a record -- flags appear only for a record definition appearing in a record
-- type definition. -- type definition.
...@@ -4016,7 +4016,7 @@ package Sinfo is ...@@ -4016,7 +4016,7 @@ package Sinfo is
-- Instead the Attribute_Name and Expressions fields of the parent -- Instead the Attribute_Name and Expressions fields of the parent
-- node (N_Attribute_Reference node) hold the information. -- node (N_Attribute_Reference node) hold the information.
-- Note: if ACCESS, DELTA or DIGITS appears in an attribute -- Note: if ACCESS, DELTA, or DIGITS appears in an attribute
-- designator, then they are treated as identifiers internally -- designator, then they are treated as identifiers internally
-- rather than the keywords of the same name. -- rather than the keywords of the same name.
...@@ -7910,7 +7910,7 @@ package Sinfo is ...@@ -7910,7 +7910,7 @@ package Sinfo is
-- to aspects/pragmas Contract_Cases and Test_Case. The ordering in the -- to aspects/pragmas Contract_Cases and Test_Case. The ordering in the
-- list is in LIFO fashion. -- list is in LIFO fashion.
-- Classifications contains pragmas that either declare, categorize or -- Classifications contains pragmas that either declare, categorize, or
-- establish dependencies between subprogram or package inputs and -- establish dependencies between subprogram or package inputs and
-- outputs. Currently the following pragmas appear in this list: -- outputs. Currently the following pragmas appear in this list:
-- Abstract_States -- Abstract_States
...@@ -13067,7 +13067,7 @@ package Sinfo is ...@@ -13067,7 +13067,7 @@ package Sinfo is
4 => False, -- unused 4 => False, -- unused
5 => False), -- unused 5 => False), -- unused
-- Entries for Empty, Error and Unused. Even thought these have a Chars -- Entries for Empty, Error, and Unused. Even though these have a Chars
-- field for debugging purposes, they are not really syntactic fields, so -- field for debugging purposes, they are not really syntactic fields, so
-- we mark all fields as unused. -- we mark all fields as unused.
......
2017-11-09 Hristian Kirtchev <kirtchev@adacore.com> 2017-11-09 Hristian Kirtchev <kirtchev@adacore.com>
* gnat.dg/unreferenced.adb: New testcase.
2017-11-09 Ed Schonberg <schonberg@adacore.com>
* gnat.dg/out_param.adb: New testcase.
2017-11-09 Hristian Kirtchev <kirtchev@adacore.com>
* gnat.dg/elab3.adb, gnat.dg/elab3.ads, gnat.dg/elab3_pkg.adb, * gnat.dg/elab3.adb, gnat.dg/elab3.ads, gnat.dg/elab3_pkg.adb,
gnat.dg/elab3_pkg.ads: New testcase. gnat.dg/elab3_pkg.ads: New testcase.
......
-- { dg-do compile }
-- { dg-options "-gnat83" }
procedure Out_Param
(Source : in String; Dest : out String; Char_Count : out Natural) is
begin
--| Logic_Step:
--| Copy string Source to string Dest
Dest := (others => ' ');
Char_Count := 0;
if Source'Length > 0 and then Dest'Length > 0 then
if Source'Length > Dest'Length then
Char_Count := Dest'Length;
else
Dest (Dest'First .. (Dest'First + Source'Length - 1)) := Source;
Char_Count := Source'Length;
end if;
else
null;
end if;
end Out_Param;
-- { dg-do compile }
-- { dg-options "-gnatd.F" }
procedure Unreferenced is
X : aliased Integer;
Y : access Integer := X'Access;
Z : Integer renames Y.all;
pragma Unreferenced (Z);
begin
null;
end Unreferenced;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment