aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch3.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2004-01-12 12:45:26 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2004-01-12 12:45:26 +0100
commita397db9637a45274b4acc4ebcba14ae3506d5b80 (patch)
tree9a40f2549e1bdb5877d519b870509751de706702 /gcc/ada/sem_ch3.adb
parent16bf3959da2377ebbb88ff56ecdc618e70acae6d (diff)
downloadgcc-a397db9637a45274b4acc4ebcba14ae3506d5b80.zip
gcc-a397db9637a45274b4acc4ebcba14ae3506d5b80.tar.gz
gcc-a397db9637a45274b4acc4ebcba14ae3506d5b80.tar.bz2
[multiple changes]
2004-01-12 Laurent Pautet <pautet@act-europe.fr> * 3vsocthi.adb, 3vsocthi.ads, 3wsocthi.adb, 3wsocthi.ads, 3zsocthi.adb, 3zsocthi.ads, g-socthi.adb, g-socthi.ads (Socket_Error_Message): Return C.Strings.chars_ptr instead of String. * g-socket.adb (Raise_Socket_Error): Use new Socket_Error_Message signature. 2004-01-12 Javier Miranda <miranda@gnat.com> * cstand.adb, exp_aggr.adb, exp_ch3.adb, exp_ch9.adb, exp_dist.adb, exp_imgv.adb, exp_pakd.adb, exp_util.adb, par-ch3.adb, sem.adb, sem_ch3.adb, sem_dist.adb, sem_prag.adb, sem_res.adb, sem_util.adb, sinfo.adb, sinfo.ads, sprint.adb: Addition of Component_Definition node. 2004-01-12 Ed Falis <falis@gnat.com> * impunit.adb: Add GNAT.Secondary_Stack_Info as user-visible unit 2004-01-12 Thomas Quinot <quinot@act-europe.fr> * link.c: Change default libgnat kind to STATIC for FreeBSD. 2004-01-12 Ed Schonberg <schonberg@gnat.com> * lib-xref.adb (Get_Type_Reference): If the type is the subtype entity generated to rename a generic actual, go to the actual itself, the subtype is not a user-visible entity. * sem_ch7.adb (Uninstall_Declarations): If an entity in the visible part is a private subtype, reset the visibility of its full view, if any, to be consistent. 2004-01-12 Robert Dewar <dewar@gnat.com> * trans.c (Eliminate_Error_Msg): New procedure called to generate msg * usage.adb: Remove mention of obsolete -gnatwb switch Noticed during code reading 2004-01-12 Jerome Guitton <guitton@act-europe.fr> * 1ssecsta.adb: Minor changes for -gnatwa warnings 2004-01-12 GNAT Script <nobody@gnat.com> * Make-lang.in: Makefile automatically updated From-SVN: r75714
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r--gcc/ada/sem_ch3.adb53
1 files changed, 32 insertions, 21 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 93593cf..e7fb9d4 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2003, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2004, 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- --
@@ -906,7 +906,8 @@ package body Sem_Ch3 is
begin
Generate_Definition (Id);
Enter_Name (Id);
- T := Find_Type_Of_Object (Subtype_Indication (N), N);
+ T := Find_Type_Of_Object (Subtype_Indication (Component_Definition (N)),
+ N);
-- If the subtype is a constrained subtype of the enclosing record,
-- (which must have a partial view) the back-end does not handle
@@ -916,15 +917,16 @@ package body Sem_Ch3 is
-- removed from discriminant constraints.
if Ekind (T) = E_Access_Subtype
- and then Is_Entity_Name (Subtype_Indication (N))
+ and then Is_Entity_Name (Subtype_Indication (Component_Definition (N)))
and then Comes_From_Source (T)
and then Nkind (Parent (T)) = N_Subtype_Declaration
and then Etype (Directly_Designated_Type (T)) = Current_Scope
then
Rewrite
- (Subtype_Indication (N),
+ (Subtype_Indication (Component_Definition (N)),
New_Copy_Tree (Subtype_Indication (Parent (T))));
- T := Find_Type_Of_Object (Subtype_Indication (N), N);
+ T := Find_Type_Of_Object
+ (Subtype_Indication (Component_Definition (N)), N);
end if;
-- If the component declaration includes a default expression, then we
@@ -944,7 +946,7 @@ package body Sem_Ch3 is
if Is_Indefinite_Subtype (T) and then Chars (Id) /= Name_uParent then
Error_Msg_N
("unconstrained subtype in component declaration",
- Subtype_Indication (N));
+ Subtype_Indication (Component_Definition (N)));
-- Components cannot be abstract, except for the special case of
-- the _Parent field (case of extending an abstract tagged type)
@@ -954,9 +956,9 @@ package body Sem_Ch3 is
end if;
Set_Etype (Id, T);
- Set_Is_Aliased (Id, Aliased_Present (N));
+ Set_Is_Aliased (Id, Aliased_Present (Component_Definition (N)));
- -- If the this component is private (or depends on a private type),
+ -- If this component is private (or depends on a private type),
-- flag the record type to indicate that some operations are not
-- available.
@@ -2727,7 +2729,7 @@ package body Sem_Ch3 is
----------------------------
procedure Array_Type_Declaration (T : in out Entity_Id; Def : Node_Id) is
- Component_Def : constant Node_Id := Subtype_Indication (Def);
+ Component_Def : constant Node_Id := Component_Definition (Def);
Element_Type : Entity_Id;
Implicit_Base : Entity_Id;
Index : Node_Id;
@@ -2764,7 +2766,8 @@ package body Sem_Ch3 is
Nb_Index := Nb_Index + 1;
end loop;
- Element_Type := Process_Subtype (Component_Def, P, Related_Id, 'C');
+ Element_Type := Process_Subtype (Subtype_Indication (Component_Def),
+ P, Related_Id, 'C');
-- Constrained array case
@@ -2830,7 +2833,7 @@ package body Sem_Ch3 is
Set_Component_Type (Base_Type (T), Element_Type);
- if Aliased_Present (Def) then
+ if Aliased_Present (Component_Definition (Def)) then
Set_Has_Aliased_Components (Etype (T));
end if;
@@ -2874,12 +2877,13 @@ package body Sem_Ch3 is
if Is_Indefinite_Subtype (Element_Type) then
Error_Msg_N
- ("unconstrained element type in array declaration ",
- Component_Def);
+ ("unconstrained element type in array declaration",
+ Subtype_Indication (Component_Def));
elsif Is_Abstract (Element_Type) then
- Error_Msg_N ("The type of a component cannot be abstract ",
- Component_Def);
+ Error_Msg_N
+ ("The type of a component cannot be abstract",
+ Subtype_Indication (Component_Def));
end if;
end Array_Type_Declaration;
@@ -2900,15 +2904,15 @@ package body Sem_Ch3 is
Discr_Con_Elist : Elist_Id;
Discr_Con_El : Elmt_Id;
- Subt : Entity_Id;
+ Subt : Entity_Id;
begin
-- Set the designated type so it is available in case this is
-- an access to a self-referential type, e.g. a standard list
-- type with a next pointer. Will be reset after subtype is built.
- Set_Directly_Designated_Type (Derived_Type,
- Designated_Type (Parent_Type));
+ Set_Directly_Designated_Type
+ (Derived_Type, Designated_Type (Parent_Type));
Subt := Process_Subtype (S, N);
@@ -5592,10 +5596,10 @@ package body Sem_Ch3 is
if Discrim_Present then
null;
- elsif Nkind (Parent (Def)) = N_Component_Declaration
+ elsif Nkind (Parent (Parent (Def))) = N_Component_Declaration
and then
Has_Per_Object_Constraint
- (Defining_Identifier (Parent (Def)))
+ (Defining_Identifier (Parent (Parent (Def))))
then
null;
@@ -9525,11 +9529,18 @@ package body Sem_Ch3 is
Related_Nod : Node_Id) return Entity_Id
is
Def_Kind : constant Node_Kind := Nkind (Obj_Def);
- P : constant Node_Id := Parent (Obj_Def);
+ P : Node_Id := Parent (Obj_Def);
T : Entity_Id;
Nam : Name_Id;
begin
+ -- If the parent is a component_definition node we climb to the
+ -- component_declaration node
+
+ if Nkind (P) = N_Component_Definition then
+ P := Parent (P);
+ end if;
+
-- Case of an anonymous array subtype
if Def_Kind = N_Constrained_Array_Definition