Commit 8a49a499 by Arnaud Charlet

[multiple changes]

2012-05-15  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch10.adb (Expand_With_Clause): In the context of a generic
	package declaration, a private with-clause on a child unit implies
	that the implicit with clauses on its parents are private as well.

2012-05-15  Javier Miranda  <miranda@adacore.com>

	* sem_ch6.adb (Is_Interface_Conformant): Add missing call to
	Base_Type to handle subtypes.
	* exp_ch6.adb (Expand_Call): For calls located in thunks handle
	unchecked conversions of access types found in actuals.
	* exp_disp.adb (Expand_Interface_Thunk): Add missing unchecked
	conversion to actuals whose type is an access type. Done to
	avoid reporting spurious errors.

2012-05-15  Vincent Celier  <celier@adacore.com>

	* prj-env.adb (Create_Mapping): Ignore sources that are
	suppressed (Create_Mapping_File.Process): Ditto
	* prj-nmsc.adb (Add_Source): Update to take into
	account suppressed files that may hide inherited sources.
	(Mark_Excluded_Sources): Mark excluded sources of the current
	project as suppressed.
	* prj.ads (Source_Data): New Boolean component Suppressed,
	defaulted to False

2012-05-15  Thomas Quinot  <quinot@adacore.com>

	* exp_intr.adb: Minor reformatting.

2012-05-15  Thomas Quinot  <quinot@adacore.com>

	* gnat_rm.texi: Document attribute Scalar_Storage_Order.

2012-05-15  Javier Miranda  <miranda@adacore.com>

	* exp_ch3.adb (Build_Offset_To_Top): Modify the
	expansion of the offset_to_top functions to ensure that their
	profile is conformant with the profile specified in Ada.Tags. No
	change in functionality.

2012-05-15  Eric Botcazou  <ebotcazou@adacore.com>

	* inline.adb (Subp_Info): Remove Count and Next_Nopred
	components, add Processed component and move around Next component.
	(Add_Call): Reverse meaning of Successors table to the natural one.
	(Add_Inlined_Body): Do not inline a package if it is in the main unit.
	(Add_Inlined_Subprogram): Do not add the subprogram to the list if the
	package is in the main unit. Do not recurse on the successors.
	(Add_Subp): Adjust to new contents of Subp_Info.
	(Analyze_Inlined_Bodies): Do not attempt
	to compute a topological order on the list of inlined subprograms,
	but compute the transitive closure from the main unit instead.
	(Get_Code_Unit_Entity): Always return the spec for a package.

From-SVN: r187526
parent 8c5b2819
2012-05-15 Ed Schonberg <schonberg@adacore.com>
* sem_ch10.adb (Expand_With_Clause): In the context of a generic
package declaration, a private with-clause on a child unit implies
that the implicit with clauses on its parents are private as well.
2012-05-15 Javier Miranda <miranda@adacore.com>
* sem_ch6.adb (Is_Interface_Conformant): Add missing call to
Base_Type to handle subtypes.
* exp_ch6.adb (Expand_Call): For calls located in thunks handle
unchecked conversions of access types found in actuals.
* exp_disp.adb (Expand_Interface_Thunk): Add missing unchecked
conversion to actuals whose type is an access type. Done to
avoid reporting spurious errors.
2012-05-15 Vincent Celier <celier@adacore.com>
* prj-env.adb (Create_Mapping): Ignore sources that are
suppressed (Create_Mapping_File.Process): Ditto
* prj-nmsc.adb (Add_Source): Update to take into
account suppressed files that may hide inherited sources.
(Mark_Excluded_Sources): Mark excluded sources of the current
project as suppressed.
* prj.ads (Source_Data): New Boolean component Suppressed,
defaulted to False
2012-05-15 Thomas Quinot <quinot@adacore.com>
* exp_intr.adb: Minor reformatting.
2012-05-15 Thomas Quinot <quinot@adacore.com>
* gnat_rm.texi: Document attribute Scalar_Storage_Order.
2012-05-15 Javier Miranda <miranda@adacore.com>
* exp_ch3.adb (Build_Offset_To_Top): Modify the
expansion of the offset_to_top functions to ensure that their
profile is conformant with the profile specified in Ada.Tags. No
change in functionality.
2012-05-15 Eric Botcazou <ebotcazou@adacore.com>
* inline.adb (Subp_Info): Remove Count and Next_Nopred
components, add Processed component and move around Next component.
(Add_Call): Reverse meaning of Successors table to the natural one.
(Add_Inlined_Body): Do not inline a package if it is in the main unit.
(Add_Inlined_Subprogram): Do not add the subprogram to the list if the
package is in the main unit. Do not recurse on the successors.
(Add_Subp): Adjust to new contents of Subp_Info.
(Analyze_Inlined_Bodies): Do not attempt
to compute a topological order on the list of inlined subprograms,
but compute the transitive closure from the main unit instead.
(Get_Code_Unit_Entity): Always return the spec for a package.
2012-05-15 Yannick Moy <moy@adacore.com>
* aspects.ads: Minor addition of comments to provide info on
......
......@@ -1883,9 +1883,10 @@ package body Exp_Ch3 is
procedure Build_Offset_To_Top_Function (Iface_Comp : Entity_Id);
-- Generate:
-- function Fxx (O : in Rec_Typ) return Storage_Offset is
-- function Fxx (O : Address) return Storage_Offset is
-- type Acc is access all <Typ>;
-- begin
-- return O.Iface_Comp'Position;
-- return Acc!(O).Iface_Comp'Position;
-- end Fxx;
----------------------------------
......@@ -1896,6 +1897,7 @@ package body Exp_Ch3 is
Body_Node : Node_Id;
Func_Id : Entity_Id;
Spec_Node : Node_Id;
Acc_Type : Entity_Id;
begin
Func_Id := Make_Temporary (Loc, 'F');
......@@ -1912,7 +1914,7 @@ package body Exp_Ch3 is
Make_Defining_Identifier (Loc, Name_uO),
In_Present => True,
Parameter_Type =>
New_Reference_To (Rec_Type, Loc))));
New_Reference_To (RTE (RE_Address), Loc))));
Set_Result_Definition (Spec_Node,
New_Reference_To (RTE (RE_Storage_Offset), Loc));
......@@ -1924,7 +1926,19 @@ package body Exp_Ch3 is
Body_Node := New_Node (N_Subprogram_Body, Loc);
Set_Specification (Body_Node, Spec_Node);
Set_Declarations (Body_Node, New_List);
Acc_Type := Make_Temporary (Loc, 'T');
Set_Declarations (Body_Node, New_List (
Make_Full_Type_Declaration (Loc,
Defining_Identifier => Acc_Type,
Type_Definition =>
Make_Access_To_Object_Definition (Loc,
All_Present => True,
Null_Exclusion_Present => False,
Constant_Present => False,
Subtype_Indication =>
New_Reference_To (Rec_Type, Loc)))));
Set_Handled_Statement_Sequence (Body_Node,
Make_Handled_Sequence_Of_Statements (Loc,
Statements => New_List (
......@@ -1933,7 +1947,9 @@ package body Exp_Ch3 is
Make_Attribute_Reference (Loc,
Prefix =>
Make_Selected_Component (Loc,
Prefix => Make_Identifier (Loc, Name_uO),
Prefix =>
Unchecked_Convert_To (Acc_Type,
Make_Identifier (Loc, Name_uO)),
Selector_Name =>
New_Reference_To (Iface_Comp, Loc)),
Attribute_Name => Name_Position)))));
......
......@@ -2711,6 +2711,14 @@ package body Exp_Ch6 is
Next_Entity (Parm_Ent);
end loop;
-- Handle unchecked conversion of access types generated
-- in thunks (cf. Expand_Interface_Thunk)
elsif Is_Access_Type (Etype (Actual))
and then Nkind (Actual) = N_Unchecked_Type_Conversion
then
Parm_Ent := Entity (Expression (Actual));
else pragma Assert (Is_Entity_Name (Actual));
Parm_Ent := Entity (Actual);
end if;
......
......@@ -1829,6 +1829,14 @@ package body Exp_Disp is
Make_Explicit_Dereference (Loc,
New_Reference_To (Defining_Identifier (Decl_2), Loc))));
-- Ensure proper matching of access types. Required to avoid
-- reporting spurious errors.
elsif Is_Access_Type (Etype (Target_Formal)) then
Append_To (Actuals,
Unchecked_Convert_To (Base_Type (Etype (Target_Formal)),
New_Reference_To (Defining_Identifier (Formal), Loc)));
-- No special management required for this actual
else
......
......@@ -564,16 +564,15 @@ package body Exp_Intr is
-- conventions and this has already been checked.
elsif Present (Alias (E)) then
Expand_Intrinsic_Call (N, Alias (E));
Expand_Intrinsic_Call (N, Alias (E));
elsif Nkind (N) in N_Binary_Op then
Expand_Binary_Operator_Call (N);
-- The only other case is where an external name was specified,
-- since this is the only way that an otherwise unrecognized
-- name could escape the checking in Sem_Prag. Nothing needs
-- to be done in such a case, since we pass such a call to the
-- back end unchanged.
-- The only other case is where an external name was specified, since
-- this is the only way that an otherwise unrecognized name could
-- escape the checking in Sem_Prag. Nothing needs to be done in such
-- a case, since we pass such a call to the back end unchanged.
else
null;
......
......@@ -272,6 +272,7 @@ Implementation Defined Attributes
* Result::
* Safe_Emax::
* Safe_Large::
* Scalar_Storage_Order::
* Simple_Storage_Pool::
* Small::
* Storage_Unit::
......@@ -6023,6 +6024,7 @@ consideration, you should minimize the use of these attributes.
* Result::
* Safe_Emax::
* Safe_Large::
* Scalar_Storage_Order::
* Simple_Storage_Pool::
* Small::
* Storage_Unit::
......@@ -6750,6 +6752,54 @@ The @code{Safe_Large} attribute is provided for compatibility with Ada 83. See
the Ada 83 reference manual for an exact description of the semantics of
this attribute.
@node Scalar_Storage_Order
@unnumberedsec Scalar_Storage_Order
@cindex Endianness
@cindex Scalar storage order
@findex Scalar_Storage_Order
@noindent
For every record subtype @var{S}, the representation attribute
@code{Scalar_Storage_Order} denotes the order in which storage elements
that make up scalar components are ordered within S. Other properties are
as for standard representation attribute @code{Bit_Order}, as defined by
Ada RM 13.5.3(4). The default is @code{System.Default_Bit_Order}.
If @code{@var{S}'Scalar_Storage_Order} is specified explicitly, it shall be
equal to @code{@var{S}'Bit_Order}. Note: This means that if a
@code{Scalar_Storage_Order} attribute definition clause is not confirming,
then the type's @code{Bit_Order} shall be specified explicitly and set to
the same value.
A confirming @code{Scalar_Storage_Order} attribute definition clause (i.e.
with a value equal to @code{System.Default_Bit_Order}) has no effect.
If the opposite storage order is specified, then whenever the
value of a scalar component of S is read, the storage elements of the
enclosing machine scalar are first reversed (before retrieving the
component value, possibly applying some shift and mask operatings on the
enclosing machine scalar), and the opposite operation is done for
writes.
In that case, the restrictions set forth in 10.3/2 for scalar components
are relaxed. Instead, the following rules apply:
@itemize @bullet
@item the underlying storage elements are those at positions
@code{(position + first_bit / storage_element_size) ..
(position + (last_bit + storage_element_size - 1) /
storage_element_size)}
@item the sequence of underlying storage elements shall have
a size no greater than the largest machine scalar
@item the enclosing machine scalar is defined as the smallest machine
scalar starting at a position no greater than
@code{position + first_bit / storage_element_size} and covering
storage elements at least up to @code{position + (last_bit +
storage_element_size - 1) / storage_element_size}
@item the position of the component is interpreted relative to that machine
scalar.
@end itemize
@node Simple_Storage_Pool
@unnumberedsec Simple_Storage_Pool
@cindex Storage pool, simple
......@@ -15452,7 +15502,7 @@ sequences for various UCS input formats.
@section @code{GNAT.Byte_Swapping} (@file{g-bytswa.ads})
@cindex @code{GNAT.Byte_Swapping} (@file{g-bytswa.ads})
@cindex Byte swapping
@cindex Endian
@cindex Endianness
@noindent
General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
......
......@@ -754,7 +754,7 @@ package body Prj.Env is
exit when Data = No_Source;
if Data.Unit /= No_Unit_Index then
if Data.Locally_Removed then
if Data.Locally_Removed and then (not Data.Suppressed) then
Fmap.Add_Forbidden_File_Name (Data.File);
else
Fmap.Add_To_File_Map
......@@ -829,7 +829,8 @@ package body Prj.Env is
Source := Prj.Element (Iter);
exit when Source = No_Source;
if Source.Replaced_By = No_Source
if (not Source.Suppressed)
and then Source.Replaced_By = No_Source
and then Source.Path.Name /= No_Path
and then (Source.Language.Config.Kind = File_Based
or else Source.Unit /= No_Unit_Index)
......
......@@ -642,32 +642,45 @@ package body Prj.Nmsc is
Add_Src := True;
-- Always add the source if it is locally removed, to avoid incorrect
-- duplicate checks.
if Unit /= No_Name then
Prev_Unit := Units_Htable.Get (Data.Tree.Units_HT, Unit);
end if;
if not Locally_Removed then
if Unit /= No_Name then
Prev_Unit := Units_Htable.Get (Data.Tree.Units_HT, Unit);
end if;
if Prev_Unit /= No_Unit_Index
and then (Kind = Impl or else Kind = Spec)
and then Prev_Unit.File_Names (Kind) /= null
then
-- Suspicious, we need to check later whether this is authorized
if Prev_Unit /= No_Unit_Index
and then (Kind = Impl or else Kind = Spec)
and then Prev_Unit.File_Names (Kind) /= null
then
-- Suspicious, we need to check later whether this is authorized
Add_Src := False;
Source := Prev_Unit.File_Names (Kind);
else
Source := Source_Files_Htable.Get
(Data.Tree.Source_Files_HT, File_Name);
if Source /= No_Source and then Source.Index = Index then
Add_Src := False;
Source := Prev_Unit.File_Names (Kind);
end if;
end if;
else
Source := Source_Files_Htable.Get
(Data.Tree.Source_Files_HT, File_Name);
-- Always add the source if it is locally removed, to avoid incorrect
-- duplicate checks.
if Source /= No_Source and then Source.Index = Index then
Add_Src := False;
end if;
if Locally_Removed then
Add_Src := True;
-- A locally removed source may first replace a source in a project
-- being extended.
if Source /= No_Source
and then Is_Extending (Project, Source.Project)
and then Naming_Exception /= Inherited
then
Source_To_Replace := Source;
end if;
else
-- Duplication of file/unit in same project is allowed if order of
-- source directories is known, or if there is no compiler for the
-- language.
......@@ -725,7 +738,7 @@ package body Prj.Nmsc is
elsif Is_Extending (Project, Source.Project) then
if not Locally_Removed
and then Naming_Exception /= Inherited
and then Naming_Exception /= Inherited
then
Source_To_Replace := Source;
end if;
......@@ -733,6 +746,7 @@ package body Prj.Nmsc is
elsif Prev_Unit /= No_Unit_Index
and then Prev_Unit.File_Names (Kind) /= null
and then not Source.Locally_Removed
and then Source.Replaced_By = No_Source
and then not Data.In_Aggregate_Lib
then
-- Path is set if this is a source we found on the disk, in
......@@ -768,6 +782,7 @@ package body Prj.Nmsc is
Add_Src := False;
elsif not Source.Locally_Removed
and then Source.Replaced_By /= No_Source
and then not Data.Flags.Allow_Duplicate_Basenames
and then Lang_Id.Config.Kind = Unit_Based
and then Source.Language.Config.Kind = Unit_Based
......@@ -785,10 +800,10 @@ package body Prj.Nmsc is
Add_Src := True;
end if;
end if;
end if;
if not Add_Src then
return;
end if;
if not Add_Src then
return;
end if;
-- Add the new file
......@@ -868,7 +883,7 @@ package body Prj.Nmsc is
-- Note that this updates Unit information as well
if Naming_Exception /= Inherited then
if Naming_Exception /= Inherited and then not Locally_Removed then
Override_Kind (Id, Kind);
end if;
end if;
......@@ -7799,8 +7814,12 @@ package body Prj.Nmsc is
(Project.Excluded, Source.File);
if Excluded /= No_File_Found then
Source.Locally_Removed := True;
Source.In_Interfaces := False;
Source.Locally_Removed := True;
if Proj = Project.Project then
Source.Suppressed := True;
end if;
if Current_Verbosity = High then
Debug_Indent;
......
......@@ -783,8 +783,13 @@ package Prj is
Locally_Removed : Boolean := False;
-- True if the source has been "excluded"
Suppressed : Boolean := False;
-- True if the source is a locally removed direct source of the project.
-- These sources should not be put in the mapping file.
Replaced_By : Source_Id := No_Source;
-- Missing comment ???
-- Indicate the source in an extending project that replaces the current
-- source.
File : File_Name_Type := No_File;
-- Canonical file name of the source
......@@ -866,6 +871,7 @@ package Prj is
Unit => No_Unit_Index,
Index => 0,
Locally_Removed => False,
Suppressed => False,
Compilable => Unknown,
In_The_Queue => False,
Replaced_By => No_Source,
......
......@@ -2987,10 +2987,13 @@ package body Sem_Ch10 is
Set_First_Name (Withn, True);
Set_Implicit_With (Withn, True);
-- If the unit is a package declaration, a private_with_clause on a
-- child unit implies the implicit with on the parent is also private.
-- If the unit is a package or generic package declaration, a private_
-- with_clause on a child unit implies that the implicit with on the
-- parent is also private.
if Nkind (Unit (N)) = N_Package_Declaration then
if Nkind_In
(Unit (N), N_Package_Declaration, N_Generic_Package_Declaration)
then
Set_Private_Present (Withn, Private_Present (Item));
end if;
......
......@@ -8934,7 +8934,7 @@ package body Sem_Ch6 is
or else not Is_Dispatching_Operation (Prim)
or else Scope (Prim) /= Scope (Tagged_Type)
or else No (Typ)
or else Base_Type (Typ) /= Tagged_Type
or else Base_Type (Typ) /= Base_Type (Tagged_Type)
or else not Primitive_Names_Match (Iface_Prim, Prim)
then
return False;
......
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