[multiple changes]
2011-12-21 Gary Dismukes <dismukes@adacore.com> * gnat_ugn.texi: Minor reformatting. 2011-12-21 Ed Schonberg <schonberg@adacore.com> * exp_ch5.adb (Expand_Iterator_Loop): The cursor operation Has_Element is the formal of Iterator_Interfaces, and within the instantion of this package it is a renaming of some local function with an unrelated name. Retrieve the operation from the instance itself, not from the container package. 2011-12-21 Vincent Pucci <pucci@adacore.com> * exp_ch6.adb (Expand_Call): Expand_Put_Call_With_Dimension_String replaced by Expand_Put_Call_With_Dimension_Symbol * sem_ch12.adb (Analyze_Package_Instantiation): New check for System.Dim_Float_IO and System.Dim_Integer_IO instantiation. * sem_ch3.adb (Analyze_Declarations): Removed Remove_Dimension_In_Declaration call. * sem_dim.adb: Update comments. Redefine the representation of a Rational. Propagate all changes involving data structures and types throughout the pakage. Output the dimension aggregates for each error messages. ("/"): Rational constructor "/" removed for Whole operands. ("/"): New rational operation "/" for Rational operands. ("*"): Operation "*" between Rational and Int removed. ("abs"): New unary operator "abs" for Rational. (Analyze_Aspect_Dimension_System): Reorganized. (Analyze_Dimension_Identifier): Removed. (Copy_Dimensions): Removed. (Create_Rational_From_Expr): New Boolean parameter. (Dimensions_Msg_Of): New routine. Return a string with the dimensions of the parameter. (From_Dimension_To_String_Of_Symbols): Renaming of From_Dimension_To_String_Id. * sem_dim.ads: Update comments. (Is_Dim_IO_Package_Instantiation): New routine. (Remove_Dimension_In_Declaration): Removed. * sem_res.adb (Resolve_Op_Expon): Reorganized calls of Eval_Op_Expon_For_Dimensioned_Type and Eval_Op_Expon. * s-diflio.ads, s-diinio.ads: Update comments. From-SVN: r182575
This commit is contained in:
parent
26cd9add74
commit
6c57023b0c
@ -1,3 +1,46 @@
|
||||
2011-12-21 Gary Dismukes <dismukes@adacore.com>
|
||||
|
||||
* gnat_ugn.texi: Minor reformatting.
|
||||
|
||||
2011-12-21 Ed Schonberg <schonberg@adacore.com>
|
||||
|
||||
* exp_ch5.adb (Expand_Iterator_Loop): The cursor operation
|
||||
Has_Element is the formal of Iterator_Interfaces, and within
|
||||
the instantion of this package it is a renaming of some local
|
||||
function with an unrelated name. Retrieve the operation from
|
||||
the instance itself, not from the container package.
|
||||
|
||||
2011-12-21 Vincent Pucci <pucci@adacore.com>
|
||||
|
||||
* exp_ch6.adb (Expand_Call): Expand_Put_Call_With_Dimension_String
|
||||
replaced by Expand_Put_Call_With_Dimension_Symbol
|
||||
* sem_ch12.adb (Analyze_Package_Instantiation): New check for
|
||||
System.Dim_Float_IO and System.Dim_Integer_IO instantiation.
|
||||
* sem_ch3.adb (Analyze_Declarations): Removed
|
||||
Remove_Dimension_In_Declaration call.
|
||||
* sem_dim.adb: Update comments. Redefine the
|
||||
representation of a Rational. Propagate all changes involving
|
||||
data structures and types throughout the pakage. Output the
|
||||
dimension aggregates for each error messages.
|
||||
("/"): Rational constructor "/" removed for Whole operands.
|
||||
("/"): New rational operation "/" for Rational operands.
|
||||
("*"): Operation "*" between Rational and Int removed.
|
||||
("abs"): New unary operator "abs" for Rational.
|
||||
(Analyze_Aspect_Dimension_System): Reorganized.
|
||||
(Analyze_Dimension_Identifier): Removed.
|
||||
(Copy_Dimensions): Removed.
|
||||
(Create_Rational_From_Expr): New Boolean parameter.
|
||||
(Dimensions_Msg_Of): New routine. Return
|
||||
a string with the dimensions of the parameter.
|
||||
(From_Dimension_To_String_Of_Symbols): Renaming of
|
||||
From_Dimension_To_String_Id.
|
||||
* sem_dim.ads: Update comments.
|
||||
(Is_Dim_IO_Package_Instantiation): New routine.
|
||||
(Remove_Dimension_In_Declaration): Removed.
|
||||
* sem_res.adb (Resolve_Op_Expon): Reorganized calls of
|
||||
Eval_Op_Expon_For_Dimensioned_Type and Eval_Op_Expon.
|
||||
* s-diflio.ads, s-diinio.ads: Update comments.
|
||||
|
||||
2011-12-21 Pascal Obry <obry@adacore.com>
|
||||
|
||||
* prj-attr.adb, snames.ads-tmpl: Add Library_Standalone,
|
||||
|
@ -3049,10 +3049,6 @@ package body Exp_Ch5 is
|
||||
|
||||
Iter_Type := Etype (Name (I_Spec));
|
||||
|
||||
if Is_Iterator (Iter_Type) then
|
||||
Pack := Scope (Pack);
|
||||
end if;
|
||||
|
||||
-- The "of" case uses an internally generated cursor whose type
|
||||
-- is found in the container package. The domain of iteration
|
||||
-- is expanded into a call to the default Iterator function, but
|
||||
@ -3074,41 +3070,41 @@ package body Exp_Ch5 is
|
||||
begin
|
||||
Cursor := Make_Temporary (Loc, 'I');
|
||||
|
||||
if Is_Iterator (Iter_Type) then
|
||||
null;
|
||||
-- For an container element iterator, the iterator type
|
||||
-- is obtained from the corresponding aspect.
|
||||
|
||||
Iter_Type := Etype (Default_Iter);
|
||||
Pack := Scope (Iter_Type);
|
||||
|
||||
-- Rewrite domain of iteration as a call to the default
|
||||
-- iterator for the container type. If the container is
|
||||
-- a derived type and the aspect is inherited, convert
|
||||
-- container to parent type. The Cursor type is also
|
||||
-- inherited from the scope of the parent.
|
||||
|
||||
if Base_Type (Etype (Container)) =
|
||||
Base_Type (Etype (First_Formal (Default_Iter)))
|
||||
then
|
||||
Container_Arg := New_Copy_Tree (Container);
|
||||
|
||||
else
|
||||
Iter_Type := Etype (Default_Iter);
|
||||
|
||||
-- Rewrite domain of iteration as a call to the default
|
||||
-- iterator for the container type. If the container is
|
||||
-- a derived type and the aspect is inherited, convert
|
||||
-- container to parent type. The Cursor type is also
|
||||
-- inherited from the scope of the parent.
|
||||
|
||||
if Base_Type (Etype (Container)) =
|
||||
Base_Type (Etype (First_Formal (Default_Iter)))
|
||||
then
|
||||
Container_Arg := New_Copy_Tree (Container);
|
||||
|
||||
else
|
||||
Container_Arg :=
|
||||
Make_Type_Conversion (Loc,
|
||||
Subtype_Mark =>
|
||||
New_Occurrence_Of
|
||||
(Etype (First_Formal (Default_Iter)), Loc),
|
||||
Expression => New_Copy_Tree (Container));
|
||||
end if;
|
||||
|
||||
Rewrite (Name (I_Spec),
|
||||
Make_Function_Call (Loc,
|
||||
Name => New_Occurrence_Of (Default_Iter, Loc),
|
||||
Parameter_Associations =>
|
||||
New_List (Container_Arg)));
|
||||
Analyze_And_Resolve (Name (I_Spec));
|
||||
Container_Arg :=
|
||||
Make_Type_Conversion (Loc,
|
||||
Subtype_Mark =>
|
||||
New_Occurrence_Of
|
||||
(Etype (First_Formal (Default_Iter)), Loc),
|
||||
Expression => New_Copy_Tree (Container));
|
||||
end if;
|
||||
|
||||
-- Find cursor type in proper container package.
|
||||
Rewrite (Name (I_Spec),
|
||||
Make_Function_Call (Loc,
|
||||
Name => New_Occurrence_Of (Default_Iter, Loc),
|
||||
Parameter_Associations =>
|
||||
New_List (Container_Arg)));
|
||||
Analyze_And_Resolve (Name (I_Spec));
|
||||
|
||||
-- Find cursor type in proper iterator package, which
|
||||
-- is an instantiation of Iterator_Interfaces.
|
||||
|
||||
Ent := First_Entity (Pack);
|
||||
while Present (Ent) loop
|
||||
@ -3145,7 +3141,7 @@ package body Exp_Ch5 is
|
||||
|
||||
-- Generate:
|
||||
-- declare
|
||||
-- Id : Element_Type := Pack.Element (curosr);
|
||||
-- Id : Element_Type := Element (curosr);
|
||||
-- begin
|
||||
-- <original loop statements>
|
||||
-- end;
|
||||
@ -3222,6 +3218,8 @@ package body Exp_Ch5 is
|
||||
-- while Iterator.Has_Element loop
|
||||
-- <Stats>
|
||||
-- end loop;
|
||||
--
|
||||
-- Has_Element is the second actual in the iterator package
|
||||
|
||||
New_Loop :=
|
||||
Make_Loop_Statement (Loc,
|
||||
@ -3230,16 +3228,18 @@ package body Exp_Ch5 is
|
||||
Condition =>
|
||||
Make_Function_Call (Loc,
|
||||
Name =>
|
||||
Make_Selected_Component (Loc,
|
||||
Prefix => New_Occurrence_Of (Pack, Loc),
|
||||
Selector_Name =>
|
||||
Make_Identifier (Loc, Name_Has_Element)),
|
||||
|
||||
New_Occurrence_Of (
|
||||
Next_Entity (First_Entity (Pack)), Loc),
|
||||
Parameter_Associations =>
|
||||
New_List (
|
||||
New_Reference_To (Cursor, Loc)))),
|
||||
|
||||
Statements => Stats,
|
||||
End_Label => Empty);
|
||||
-- Make_Selected_Component (Loc,
|
||||
-- Prefix => New_Reference_To (Cursor, Loc),
|
||||
-- Selector_Name =>
|
||||
-- Make_Identifier (Loc, Name_Has_Element))),
|
||||
|
||||
-- Create the declarations for Iterator and cursor and insert then
|
||||
-- before the source loop. Given that the domain of iteration is
|
||||
@ -3248,7 +3248,7 @@ package body Exp_Ch5 is
|
||||
-- Generate:
|
||||
|
||||
-- I : Iterator_Type renames Container;
|
||||
-- C : Pack.Cursor_Type := Container.[First | Last];
|
||||
-- C : Cursor_Type := Container.[First | Last];
|
||||
|
||||
Insert_Action (N,
|
||||
Make_Object_Renaming_Declaration (Loc,
|
||||
|
@ -2111,7 +2111,7 @@ package body Exp_Ch6 is
|
||||
and then Nkind (Call_Node) = N_Procedure_Call_Statement
|
||||
and then Present (Parameter_Associations (Call_Node))
|
||||
then
|
||||
Expand_Put_Call_With_Dimension_String (Call_Node);
|
||||
Expand_Put_Call_With_Dimension_Symbol (Call_Node);
|
||||
end if;
|
||||
|
||||
-- Remove the dimensions of every parameters in call
|
||||
|
@ -16360,12 +16360,12 @@ imported from Ada units outside of the library. If other units are imported,
|
||||
the binding phase will fail.
|
||||
|
||||
@noindent
|
||||
It is also possible to build a fully standalone library where not only
|
||||
It is also possible to build a fully stand-alone library where not only
|
||||
the code to elaborate and finalize the library is embedded but also
|
||||
ensuring that the library is linked only against static
|
||||
libraries. So a fully standalone library only depends on system
|
||||
libraries. So a fully stand-alone library only depends on system
|
||||
libraries, all other code, including the GNAT runtime, is embedded. To
|
||||
build a fully standalone library the attribute
|
||||
build a fully stand-alone library the attribute
|
||||
@code{Library_Standalone} must be set to @code{full}:
|
||||
|
||||
@smallexample @c projectfile
|
||||
@ -16379,7 +16379,7 @@ build a fully standalone library the attribute
|
||||
|
||||
@noindent
|
||||
The default value for this attribute is @code{standard} in which case
|
||||
a not fully standalone library is built.
|
||||
a not fully stand-alone library is built.
|
||||
|
||||
The attribute @code{Library_Src_Dir} may be specified for a
|
||||
Stand-Alone Library. @code{Library_Src_Dir} is a simple attribute that has a
|
||||
@ -18530,7 +18530,7 @@ g++ -c -fdump-ada-spec -DXLIB_ILLEGAL_ACCESS -C /usr/include/X11/Xlib.h
|
||||
The above will generate more complete bindings than a straight call without
|
||||
the @option{-DXLIB_ILLEGAL_ACCESS} switch.
|
||||
|
||||
In other cases, it is not possible to parse a header file in a stand alone
|
||||
In other cases, it is not possible to parse a header file in a stand-alone
|
||||
manner, because other include files need to be included first. In this
|
||||
case, the solution is to create a small header file including the needed
|
||||
@code{#include} and possible @code{#define} directives. For example, to
|
||||
|
@ -29,9 +29,6 @@
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- Note that this package should only be instantiated with a float dimensioned
|
||||
-- type. Shouldn't this be checked???
|
||||
|
||||
-- This package is a generic package that provides IO facilities for float
|
||||
-- dimensioned types.
|
||||
|
||||
|
@ -29,9 +29,6 @@
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- Note that this package should only be instantiated with an integer
|
||||
-- dimensioned type. Shouldn't this be checked ???
|
||||
|
||||
-- This package is a generic package that provides IO facilities for integer
|
||||
-- dimensioned types.
|
||||
|
||||
|
@ -54,6 +54,7 @@ with Sem_Ch7; use Sem_Ch7;
|
||||
with Sem_Ch8; use Sem_Ch8;
|
||||
with Sem_Ch10; use Sem_Ch10;
|
||||
with Sem_Ch13; use Sem_Ch13;
|
||||
with Sem_Dim; use Sem_Dim;
|
||||
with Sem_Disp; use Sem_Disp;
|
||||
with Sem_Elab; use Sem_Elab;
|
||||
with Sem_Elim; use Sem_Elim;
|
||||
@ -3786,6 +3787,23 @@ package body Sem_Ch12 is
|
||||
|
||||
Style_Check := Save_Style_Check;
|
||||
|
||||
-- Check that if N is an instantiation of System.Dim_Float_IO or
|
||||
-- System.Dim_Integer_IO, the formal type has a dimension system.
|
||||
|
||||
if Nkind (N) = N_Package_Instantiation
|
||||
and then Is_Dim_IO_Package_Instantiation (N)
|
||||
then
|
||||
declare
|
||||
Assoc : constant Node_Id := First (Generic_Associations (N));
|
||||
|
||||
begin
|
||||
if not Has_Dimension_System
|
||||
(Etype (Explicit_Generic_Actual_Parameter (Assoc))) then
|
||||
Error_Msg_N ("type with a dimension system expected", Assoc);
|
||||
end if;
|
||||
end;
|
||||
end if;
|
||||
|
||||
<<Leave>>
|
||||
if Has_Aspects (N) then
|
||||
Analyze_Aspect_Specifications (N, Act_Decl_Id);
|
||||
|
@ -2092,11 +2092,6 @@ package body Sem_Ch3 is
|
||||
-- Complete analysis of declaration
|
||||
|
||||
Analyze (D);
|
||||
|
||||
-- Removal of the dimension in the expression for object & component
|
||||
-- declaration.
|
||||
|
||||
Remove_Dimension_In_Declaration (D);
|
||||
Next_Node := Next (D);
|
||||
|
||||
if No (Freeze_From) then
|
||||
|
2116
gcc/ada/sem_dim.adb
2116
gcc/ada/sem_dim.adb
File diff suppressed because it is too large
Load Diff
@ -95,19 +95,23 @@ package Sem_Dim is
|
||||
|
||||
procedure Analyze_Aspect_Dimension
|
||||
(N : Node_Id;
|
||||
Id : Node_Id;
|
||||
Id : Entity_Id;
|
||||
Aggr : Node_Id);
|
||||
-- Analyze the contents of aspect Dimension. Associate the provided values
|
||||
-- and quantifiers with the related context N.
|
||||
-- ??? comment on usage of formals needed
|
||||
-- Id is the corresponding Aspect_Id (Aspect_Dimension)
|
||||
-- Aggr is the corresponding expression for the aspect Dimension declared
|
||||
-- by the declaration of N.
|
||||
|
||||
procedure Analyze_Aspect_Dimension_System
|
||||
(N : Node_Id;
|
||||
Id : Node_Id;
|
||||
Expr : Node_Id);
|
||||
Id : Entity_Id;
|
||||
Aggr : Node_Id);
|
||||
-- Analyze the contents of aspect Dimension_System. Extract the numerical
|
||||
-- type, unit name and corresponding symbol from each indivitual dimension.
|
||||
-- ??? comment on usage of formals needed
|
||||
-- Id is the corresponding Aspect_Id (Aspect_Dimension_System)
|
||||
-- Aggr is the corresponding expression for the aspect Dimension_System
|
||||
-- declared by the declaration of N.
|
||||
|
||||
procedure Analyze_Dimension (N : Node_Id);
|
||||
-- N may denote any of the following contexts:
|
||||
@ -133,13 +137,15 @@ package Sem_Dim is
|
||||
-- involved do not violate the rules of a system.
|
||||
|
||||
procedure Eval_Op_Expon_For_Dimensioned_Type
|
||||
(N : Node_Id;
|
||||
B_Typ : Entity_Id);
|
||||
-- Evaluate the Expon operator for dimensioned type with rational exponent
|
||||
-- ??? the above doesn't explain the purpose of this routine. why is this
|
||||
-- procedure needed?
|
||||
(N : Node_Id;
|
||||
Btyp : Entity_Id);
|
||||
-- Evaluate the Expon operator for dimensioned type with rational exponent.
|
||||
-- Indeed the regular Eval_Op_Expon routine (see package Sem_Eval) is
|
||||
-- restricted to Integer exponent.
|
||||
-- This routine deals only with rational exponent which is not an integer
|
||||
-- if Btyp is a dimensioned type.
|
||||
|
||||
procedure Expand_Put_Call_With_Dimension_String (N : Node_Id);
|
||||
procedure Expand_Put_Call_With_Dimension_Symbol (N : Node_Id);
|
||||
-- Determine whether N denotes a subprogram call to one of the routines
|
||||
-- defined in System.Dim_Float_IO or System.Dim_Integer_IO and add an
|
||||
-- extra actual to the call to represent the symbolic representation of
|
||||
@ -148,12 +154,13 @@ package Sem_Dim is
|
||||
function Has_Dimension_System (Typ : Entity_Id) return Boolean;
|
||||
-- Return True if type Typ has aspect Dimension_System applied to it
|
||||
|
||||
function Is_Dim_IO_Package_Instantiation (N : Node_Id) return Boolean;
|
||||
-- Return True if N is a package instantiation of System.Dim_Integer_IO or
|
||||
-- of System.Dim_Float_IO.
|
||||
|
||||
procedure Remove_Dimension_In_Call (Call : Node_Id);
|
||||
-- Remove the dimensions from all formal parameters of Call
|
||||
|
||||
procedure Remove_Dimension_In_Declaration (Decl : Node_Id);
|
||||
-- Remove the dimensions from the expression of Decl
|
||||
|
||||
procedure Remove_Dimension_In_Statement (Stmt : Node_Id);
|
||||
-- Remove the dimensions associated with Stmt
|
||||
|
||||
|
@ -8013,21 +8013,14 @@ package body Sem_Res is
|
||||
|
||||
Analyze_Dimension (N);
|
||||
|
||||
-- Evaluate the exponentiation operator for dimensioned type with
|
||||
-- rational exponent.
|
||||
|
||||
if Ada_Version >= Ada_2012 and then Has_Dimension_System (B_Typ) then
|
||||
-- Evaluate the exponentiation operator for dimensioned type
|
||||
|
||||
Eval_Op_Expon_For_Dimensioned_Type (N, B_Typ);
|
||||
|
||||
-- Skip the Eval_Op_Expon if the node has already been evaluated
|
||||
|
||||
if Nkind (N) = N_Type_Conversion then
|
||||
return;
|
||||
end if;
|
||||
else
|
||||
Eval_Op_Expon (N);
|
||||
end if;
|
||||
|
||||
Eval_Op_Expon (N);
|
||||
|
||||
-- Set overflow checking bit. Much cleverer code needed here eventually
|
||||
-- and perhaps the Resolve routines should be separated for the various
|
||||
-- arithmetic operations, since they will need different processing. ???
|
||||
|
Loading…
Reference in New Issue
Block a user