Commit 6d11af89 by Arnaud Charlet

[multiple changes]

2004-03-25  Vasiliy Fofanov  <fofanov@act-europe.fr>

	* memtrack.adb: Log realloc calls, which are treated as free followed
	by alloc.

2004-03-25  Vincent Celier  <celier@gnat.com>

	* prj-makr.adb (Process_Directories): Detect when a file contains
	several units. Do not include such files in the config pragmas or
	in the naming scheme.

	* prj-nmsc.adb (Record_Source): New parameter Trusted_Mode.
	Resolve links only when not in Trusted_Mode.
	(Find_Sources, Recursive_Find_Dirs, Find_Source_Dirs, Locate_Directory):
	Do not resolve links for the display names.

	* prj-part.adb (Parse_Single_Project, Project_Path_Name_Of): Do not
	resolve links when computing the display names.

2004-03-25  Thomas Quinot  <quinot@act-europe.fr>

	* sem_attr.adb (Check_Dereference): When the prefix of a 'Tag
	attribute reference does not denote a subtype, it can be any
	expression that has a classwide type, potentially after an implicit
	dereference.  In particular, the prefix can be a view conversion for
	a classwide type (for which Is_Object_Reference holds), but it can
	also be a value conversion for an access-to-classwide type. In the
	latter case, there is an implicit dereference, and the original node
	for the prefix does not verify Is_Object_Reference.

	* sem_util.adb (Is_Dependent_Component_Of_Mutable_Object): A view
	conversion of a discriminant-dependent component of a mutable object
	is one itself.

2004-03-25  Ed Schonberg  <schonberg@gnat.com>

	* freeze.adb (Freeze_Entity): When an inherited subprogram is
	inherited, has convention C, and has unconstrained array parameters,
	place the corresponding warning on the derived type declaration rather
	than the original subprogram.

	* sem_ch12.adb (Instantiate_Formal_Subprogram): Set From_Default
	indication on renaming declaration, if formal has a box and actual
	is absent.

	* sem_ch8.adb (Analyze_Subprogram_Renaming): Use From_Default flag to
	determine whether to generate an implicit or explicit reference to
	the renamed entity.

	* sinfo.ads, sinfo.adb: New flag From_Default, to indicate that a
	subprogram renaming comes from a defaulted formal subprogram in an
	instance.

2004-03-25  Gary Dismukes  <dismukes@gnat.com>

	* sem_elab.adb (Check_Elab_Call): Refine loop that checks for default
	value expressions to ensure that calls within a component definition
	will be checked (since those are evaluated during the record type's
	elaboration).

2004-03-25  Arnaud Charlet  <charlet@act-europe.fr>

	* s-tpobop.adb: Code clean up:
	(Requeue_Call): Extract from PO_Service_Entries to remove duplicated
	code.
	(PO_Do_Or_Queue): Remove duplicated code and use Requeue_Call.

2004-03-25  Jose Ruiz  <ruiz@act-europe.fr>

	* Makefile.in: Clean up in the ravenscar run time.

From-SVN: r79953
parent 9728c9d1
2004-03-25 Vasiliy Fofanov <fofanov@act-europe.fr>
* memtrack.adb: Log realloc calls, which are treated as free followed
by alloc.
2004-03-25 Vincent Celier <celier@gnat.com>
* prj-makr.adb (Process_Directories): Detect when a file contains
several units. Do not include such files in the config pragmas or
in the naming scheme.
* prj-nmsc.adb (Record_Source): New parameter Trusted_Mode.
Resolve links only when not in Trusted_Mode.
(Find_Sources, Recursive_Find_Dirs, Find_Source_Dirs, Locate_Directory):
Do not resolve links for the display names.
* prj-part.adb (Parse_Single_Project, Project_Path_Name_Of): Do not
resolve links when computing the display names.
2004-03-25 Thomas Quinot <quinot@act-europe.fr>
* sem_attr.adb (Check_Dereference): When the prefix of a 'Tag
attribute reference does not denote a subtype, it can be any
expression that has a classwide type, potentially after an implicit
dereference. In particular, the prefix can be a view conversion for
a classwide type (for which Is_Object_Reference holds), but it can
also be a value conversion for an access-to-classwide type. In the
latter case, there is an implicit dereference, and the original node
for the prefix does not verify Is_Object_Reference.
* sem_util.adb (Is_Dependent_Component_Of_Mutable_Object): A view
conversion of a discriminant-dependent component of a mutable object
is one itself.
2004-03-25 Ed Schonberg <schonberg@gnat.com>
* freeze.adb (Freeze_Entity): When an inherited subprogram is
inherited, has convention C, and has unconstrained array parameters,
place the corresponding warning on the derived type declaration rather
than the original subprogram.
* sem_ch12.adb (Instantiate_Formal_Subprogram): Set From_Default
indication on renaming declaration, if formal has a box and actual
is absent.
* sem_ch8.adb (Analyze_Subprogram_Renaming): Use From_Default flag to
determine whether to generate an implicit or explicit reference to
the renamed entity.
* sinfo.ads, sinfo.adb: New flag From_Default, to indicate that a
subprogram renaming comes from a defaulted formal subprogram in an
instance.
2004-03-25 Gary Dismukes <dismukes@gnat.com>
* sem_elab.adb (Check_Elab_Call): Refine loop that checks for default
value expressions to ensure that calls within a component definition
will be checked (since those are evaluated during the record type's
elaboration).
2004-03-25 Arnaud Charlet <charlet@act-europe.fr>
* s-tpobop.adb: Code clean up:
(Requeue_Call): Extract from PO_Service_Entries to remove duplicated
code.
(PO_Do_Or_Queue): Remove duplicated code and use Requeue_Call.
2004-03-25 Jose Ruiz <ruiz@act-europe.fr>
* Makefile.in: Clean up in the ravenscar run time.
2004-03-23 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* decl.c (gnat_to_gnu_entity, case E_Access_Type): Pass value
......
......@@ -567,6 +567,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(targ))),)
s-interr.adb<1sinterr.adb \
s-taskin.ads<1staskin.ads \
s-taskin.adb<1staskin.adb \
s-taspri.ads<1staspri.ads \
s-tarest.adb<1starest.adb \
s-tposen.ads<1stposen.ads \
s-tposen.adb<1stposen.adb \
......
......@@ -1868,10 +1868,8 @@ package body Freeze is
-- It is improper to freeze an external entity within a generic
-- because its freeze node will appear in a non-valid context.
-- ??? We should probably freeze the entity at that point and insert
-- the freeze node in a proper place but this proper place is not
-- easy to find, and the proper scope is not easy to restore. For
-- now, just wait to get out of the generic to freeze ???
-- The entity will be frozen in the proper scope after the current
-- generic is analyzed.
elsif Inside_A_Generic and then External_Ref_In_Generic (E) then
return No_List;
......@@ -2005,7 +2003,8 @@ package body Freeze is
if Is_Subprogram (E) then
if not Is_Internal (E) then
declare
F_Type : Entity_Id;
F_Type : Entity_Id;
Warn_Node : Node_Id;
function Is_Fat_C_Ptr_Type (T : Entity_Id) return Boolean;
-- Determines if given type entity is a fat pointer type
......@@ -2082,12 +2081,30 @@ package body Freeze is
and then Warn_On_Export_Import
then
Error_Msg_Qual_Level := 1;
Error_Msg_N
-- If this is an inherited operation, place the
-- warning on the derived type declaration, rather
-- than on the original subprogram.
if Nkind (Original_Node (Parent (E))) =
N_Full_Type_Declaration
then
Warn_Node := Parent (E);
if Formal = First_Formal (E) then
Error_Msg_NE
("?in inherited operation&!", Warn_Node, E);
end if;
else
Warn_Node := Formal;
end if;
Error_Msg_NE
("?type of argument& is unconstrained array",
Formal);
Error_Msg_N
Warn_Node, Formal);
Error_Msg_NE
("?foreign caller must pass bounds explicitly",
Formal);
Warn_Node, Formal);
Error_Msg_Qual_Level := 0;
end if;
......
......@@ -297,15 +297,68 @@ package body System.Memory is
function Realloc
(Ptr : System.Address; Size : size_t) return System.Address
is
Result : System.Address;
Addr : aliased constant System.Address := Ptr;
Result : aliased System.Address;
begin
-- For the purposes of allocations logging, we treat realloc as a free
-- followed by malloc. This is not exactly accurate, but is a good way
-- to fit it into malloc/free-centered reports.
if Size = size_t'Last then
Raise_Exception (Storage_Error'Identity, "object too large");
end if;
Abort_Defer.all;
Result := c_realloc (Ptr, Size);
Lock_Task.all;
if First_Call then
First_Call := False;
-- We first log deallocation call
Gmem_Initialize;
Call_Chain (Tracebk'Address, Max_Call_Stack, Num_Calls,
Skip_Frames => 2);
fputc (Character'Pos ('D'), Gmemfile);
fwrite (Addr'Address, Address_Size, 1, Gmemfile);
fwrite (Num_Calls'Address, Integer'Max_Size_In_Storage_Elements, 1,
Gmemfile);
for J in Tracebk'First .. Tracebk'First + Num_Calls - 1 loop
declare
Ptr : System.Address := PC_For (Tracebk (J));
begin
fwrite (Ptr'Address, Address_Size, 1, Gmemfile);
end;
end loop;
-- Now perform actual realloc
Result := c_realloc (Ptr, Size);
-- Log allocation call using the same backtrace
fputc (Character'Pos ('A'), Gmemfile);
fwrite (Result'Address, Address_Size, 1, Gmemfile);
fwrite (Size'Address, size_t'Max_Size_In_Storage_Elements, 1,
Gmemfile);
fwrite (Num_Calls'Address, Integer'Max_Size_In_Storage_Elements, 1,
Gmemfile);
for J in Tracebk'First .. Tracebk'First + Num_Calls - 1 loop
declare
Ptr : System.Address := PC_For (Tracebk (J));
begin
fwrite (Ptr'Address, Address_Size, 1, Gmemfile);
end;
end loop;
First_Call := True;
end if;
Unlock_Task.all;
Abort_Undefer.all;
if Result = System.Null_Address then
......
......@@ -136,7 +136,8 @@ package body Prj.Nmsc is
Data : in out Project_Data;
Location : Source_Ptr;
Current_Source : in out String_List_Id;
Source_Recorded : in out Boolean);
Source_Recorded : in out Boolean;
Trusted_Mode : Boolean);
-- Put a unit in the list of units of a project, if the file name
-- corresponds to a valid unit name.
......@@ -703,7 +704,8 @@ package body Prj.Nmsc is
(Name => Name_Buffer (1 .. Name_Len),
Directory => Source_Directory
(Source_Directory'First .. Dir_Last),
Resolve_Links => not Trusted_Mode);
Resolve_Links => False,
Case_Sensitive => True);
Path_Name : Name_Id;
begin
......@@ -725,7 +727,8 @@ package body Prj.Nmsc is
Data => Data,
Location => No_Location,
Current_Source => Current_Source,
Source_Recorded => Source_Recorded);
Source_Recorded => Source_Recorded,
Trusted_Mode => Trusted_Mode);
end if;
end;
end loop;
......@@ -841,7 +844,8 @@ package body Prj.Nmsc is
Data => Data,
Location => NL.Location,
Current_Source => Current_Source,
Source_Recorded => Source_Recorded);
Source_Recorded => Source_Recorded,
Trusted_Mode => Trusted_Mode);
end if;
end loop;
......@@ -2591,7 +2595,7 @@ package body Prj.Nmsc is
The_Path : constant String :=
Normalize_Pathname (Get_Name_String (Path)) &
Directory_Separator;
Directory_Separator;
The_Path_Last : constant Natural :=
Compute_Directory_Last (The_Path);
......@@ -2692,7 +2696,9 @@ package body Prj.Nmsc is
(Name => Name (1 .. Last),
Directory =>
The_Path
(The_Path'First .. The_Path_Last));
(The_Path'First .. The_Path_Last),
Resolve_Links => False,
Case_Sensitive => True);
begin
if Is_Directory (Path_Name) then
......@@ -2761,7 +2767,9 @@ package body Prj.Nmsc is
Normalize_Pathname
(Name => Get_Name_String (Base_Dir),
Directory =>
Get_Name_String (Data.Display_Directory));
Get_Name_String (Data.Display_Directory),
Resolve_Links => False,
Case_Sensitive => True);
begin
if Root_Dir'Length = 0 then
......@@ -3544,13 +3552,24 @@ package body Prj.Nmsc is
if Is_Directory (The_Name) then
declare
Normed : constant String :=
Normalize_Pathname (The_Name);
Normalize_Pathname
(The_Name,
Resolve_Links => False,
Case_Sensitive => True);
Canonical_Path : constant String :=
Normalize_Pathname
(Normed,
Resolve_Links => True,
Case_Sensitive => False);
begin
Name_Len := Normed'Length;
Name_Buffer (1 .. Name_Len) := Normed;
Display := Name_Find;
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Name_Len := Canonical_Path'Length;
Name_Buffer (1 .. Name_Len) := Canonical_Path;
Dir := Name_Find;
end;
end if;
......@@ -3565,13 +3584,24 @@ package body Prj.Nmsc is
if Is_Directory (Full_Path) then
declare
Normed : constant String :=
Normalize_Pathname (Full_Path);
Normalize_Pathname
(Full_Path,
Resolve_Links => False,
Case_Sensitive => True);
Canonical_Path : constant String :=
Normalize_Pathname
(Normed,
Resolve_Links => True,
Case_Sensitive => False);
begin
Name_Len := Normed'Length;
Name_Buffer (1 .. Name_Len) := Normed;
Display := Name_Find;
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Name_Len := Canonical_Path'Length;
Name_Buffer (1 .. Name_Len) := Canonical_Path;
Dir := Name_Find;
end;
end if;
......@@ -3637,7 +3667,8 @@ package body Prj.Nmsc is
Data : in out Project_Data;
Location : Source_Ptr;
Current_Source : in out String_List_Id;
Source_Recorded : in out Boolean)
Source_Recorded : in out Boolean;
Trusted_Mode : Boolean)
is
Canonical_File_Name : Name_Id;
Canonical_Path_Name : Name_Id;
......@@ -3655,9 +3686,18 @@ package body Prj.Nmsc is
Get_Name_String (File_Name);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Canonical_File_Name := Name_Find;
Get_Name_String (Path_Name);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Canonical_Path_Name := Name_Find;
declare
Canonical_Path : constant String :=
Normalize_Pathname
(Get_Name_String (Path_Name),
Resolve_Links => not Trusted_Mode,
Case_Sensitive => False);
begin
Name_Len := 0;
Add_Str_To_Name_Buffer (Canonical_Path);
Canonical_Path_Name := Name_Find;
end;
-- Find out the unit name, the unit kind and if it needs
-- a specific SFN pragma.
......
......@@ -863,14 +863,17 @@ package body Prj.Part is
Extends_All := False;
declare
Normed : String := Normalize_Pathname (Path_Name);
Normed_Path : constant String := Normalize_Pathname
(Path_Name, Resolve_Links => False, Case_Sensitive => True);
Canonical_Path : constant String := Normalize_Pathname
(Normed_Path, Resolve_Links => True, Case_Sensitive => False);
begin
Name_Len := Normed'Length;
Name_Buffer (1 .. Name_Len) := Normed;
Name_Len := Normed_Path'Length;
Name_Buffer (1 .. Name_Len) := Normed_Path;
Normed_Path_Name := Name_Find;
Canonical_Case_File_Name (Normed);
Name_Len := Normed'Length;
Name_Buffer (1 .. Name_Len) := Normed;
Name_Len := Canonical_Path'Length;
Name_Buffer (1 .. Name_Len) := Canonical_Path;
Canonical_Path_Name := Name_Find;
end;
......@@ -1670,7 +1673,10 @@ package body Prj.Part is
else
declare
Final_Result : constant String :=
GNAT.OS_Lib.Normalize_Pathname (Result.all);
GNAT.OS_Lib.Normalize_Pathname
(Result.all,
Resolve_Links => False,
Case_Sensitive => True);
begin
Free (Result);
return Final_Result;
......
......@@ -861,9 +861,19 @@ package body Sem_Attr is
procedure Check_Dereference is
begin
if Is_Object_Reference (P)
and then Is_Access_Type (P_Type)
-- Case of a subtype mark
if Is_Entity_Name (P)
and then Is_Type (Entity (P))
then
return;
end if;
-- Case of an expression
Resolve (P);
if Is_Access_Type (P_Type) then
Rewrite (P,
Make_Explicit_Dereference (Sloc (P),
Prefix => Relocate_Node (P)));
......
......@@ -6672,6 +6672,10 @@ package body Sem_Ch12 is
Specification => New_Spec,
Name => Nam);
if No (Actual) and then Box_Present (Formal) then
Set_From_Default (Decl_Node);
end if;
-- Gather possible interpretations for the actual before analyzing the
-- instance. If overloaded, it will be resolved when analyzing the
-- renaming declaration.
......
......@@ -1356,7 +1356,7 @@ package body Sem_Ch8 is
if Old_S /= Any_Id then
if Is_Actual
and then Box_Present (Inst_Node)
and then From_Default (N)
then
-- This is an implicit reference to the default actual
......
......@@ -963,7 +963,10 @@ package body Sem_Elab is
-- will be doing the actual call later, not now, and it
-- is at the time of the actual call (statically speaking)
-- that we must do our static check, not at the time of
-- its initial analysis).
-- its initial analysis). However, we have to check calls
-- within component definitions (e.g., a function call
-- that determines an array component bound), so we
-- terminate the loop in that case.
P := Parent (N);
while Present (P) loop
......@@ -972,6 +975,13 @@ package body Sem_Elab is
Nkind (P) = N_Component_Declaration
then
return;
-- The call occurs within the constraint of a component,
-- so it must be checked.
elsif Nkind (P) = N_Component_Definition then
exit;
else
P := Parent (P);
end if;
......
......@@ -3330,6 +3330,13 @@ package body Sem_Util is
or else Nkind (Object) = N_Slice
then
return Is_Dependent_Component_Of_Mutable_Object (Prefix (Object));
elsif Nkind (Object) = N_Type_Conversion then
-- A type conversion that Is_Variable is a view conversion:
-- go back to the denoted object.
return Is_Dependent_Component_Of_Mutable_Object
(Expression (Object));
end if;
end if;
......
......@@ -1193,6 +1193,14 @@ package body Sinfo is
return Flag4 (N);
end From_At_Mod;
function From_Default
(N : Node_Id) return Boolean is
begin
pragma Assert (False
or else NT (N).Nkind = N_Subprogram_Renaming_Declaration);
return Flag6 (N);
end From_Default;
function Generic_Associations
(N : Node_Id) return List_Id is
begin
......@@ -3641,6 +3649,14 @@ package body Sinfo is
Set_Flag4 (N, Val);
end Set_From_At_Mod;
procedure Set_From_Default
(N : Node_Id; Val : Boolean := True) is
begin
pragma Assert (False
or else NT (N).Nkind = N_Subprogram_Renaming_Declaration);
Set_Flag6 (N, Val);
end Set_From_Default;
procedure Set_Generic_Associations
(N : Node_Id; Val : List_Id) is
begin
......
......@@ -968,6 +968,13 @@ package Sinfo is
-- and the representation clause is considered to be type specific
-- instead of subtype specific.
-- From_Default (Flag6-Sem)
-- This flag is set on the subprogram renaming declaration created in
-- an instance for a formal subprogram, when the formal is declared
-- with a box, and there is no explicit actual. If the flag is present,
-- the declaration is treated as an implicit reference to the formal in
-- the ali file.
-- Generic_Parent (Node5-Sem)
-- Generic_parent is defined on declaration nodes that are instances.
-- The value of Generic_Parent is the generic entity from which the
......@@ -4341,6 +4348,7 @@ package Sinfo is
-- Name (Node2)
-- Parent_Spec (Node4-Sem)
-- Corresponding_Spec (Node5-Sem)
-- From_Default (Flag6-Sem)
-----------------------------------------
-- 8.5.5 Generic Renaming Declaration --
......@@ -6356,20 +6364,19 @@ package Sinfo is
-- The front end also deals with specific cases that are not allowed
-- e.g. involving unconstrained array types.
-- However, some checks, e.g. the check for suspicious aliasing
-- when converting to a pointer type, can more conveniently be
-- performed in the back end where alias sets are known.
-- For the case of the standard gigi backend, this means that all
-- checks are done in the front-end.
-- In addition, for specialized back ends, notably the JVM-based
-- back end for JGNAT, additional requirements and restrictions apply
-- However, in the case of specialized back-ends, notably the JVM
-- backend for JGNAT, additional requirements and restrictions apply
-- to unchecked conversion, and these are most conveniently performed
-- in the specialized back-end.
-- To accommodate this requirement, the following special node is
-- generated recording an unchecked conversion that needs to be
-- validated. The back end should post an appropriate error message
-- error message if the unchecked conversion is invalid or a warning
-- message if a special warning is warranted.
-- To accommodate this requirement, for such back ends, the following
-- special node is generated recording an unchecked conversion that
-- needs to be validated. The back end should post an appropriate
-- error message if the unchecked conversion is invalid or warrants
-- a special warning message.
-- Source_Type and Target_Type point to the entities for the two
-- types involved in the unchecked conversion instantiation that
......@@ -7230,6 +7237,9 @@ package Sinfo is
function From_At_Mod
(N : Node_Id) return Boolean; -- Flag4
function From_Default
(N : Node_Id) return Boolean; -- Flag6
function Generic_Associations
(N : Node_Id) return List_Id; -- List3
......@@ -8013,6 +8023,9 @@ package Sinfo is
procedure Set_From_At_Mod
(N : Node_Id; Val : Boolean := True); -- Flag4
procedure Set_From_Default
(N : Node_Id; Val : Boolean := True); -- Flag6
procedure Set_Generic_Associations
(N : Node_Id; Val : List_Id); -- List3
......@@ -8579,6 +8592,7 @@ package Sinfo is
pragma Inline (Formal_Type_Definition);
pragma Inline (Forwards_OK);
pragma Inline (From_At_Mod);
pragma Inline (From_Default);
pragma Inline (Generic_Associations);
pragma Inline (Generic_Formal_Declarations);
pragma Inline (Generic_Parent);
......@@ -8837,6 +8851,7 @@ package Sinfo is
pragma Inline (Set_Formal_Type_Definition);
pragma Inline (Set_Forwards_OK);
pragma Inline (Set_From_At_Mod);
pragma Inline (Set_From_Default);
pragma Inline (Set_Generic_Associations);
pragma Inline (Set_Generic_Formal_Declarations);
pragma Inline (Set_Generic_Parent);
......
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