Commit c1645ac8 by Arnaud Charlet

[multiple changes]

2013-10-10  Bob Duff  <duff@adacore.com>

	* gnat_ugn.texi: Add gnat2xml doc.

2013-10-10  Doug Rupp  <rupp@adacore.com>

	* s-vxwork-arm.ads: Fix interface to FP_CONTEXT.

2013-10-10  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb (Analyze_Aspect_Specification): An aspect Import
	on a variable need not have a convention specified, as long as
	the implicit convention of the object, obtained from its type,
	is Ada or Ada-related.

2013-10-10  Robert Dewar  <dewar@adacore.com>

	* cstand.adb (Standard_Unsigned_64): New internal type.
	* gnat_rm.texi: Update documentation on To_Address.
	* sem_attr.adb (Analyze_Attribute, case To_Address): Fix
	problem with out of range static values given as literals or
	named numbers.
	* stand.ads (Standard_Unsigned_64): New internal type.
	* stand.adb: Minor reformatting.

From-SVN: r203346
parent f0e7963f
2013-10-10 Bob Duff <duff@adacore.com>
* gnat_ugn.texi: Add gnat2xml doc.
2013-10-10 Doug Rupp <rupp@adacore.com>
* s-vxwork-arm.ads: Fix interface to FP_CONTEXT.
2013-10-10 Ed Schonberg <schonberg@adacore.com>
* sem_ch13.adb (Analyze_Aspect_Specification): An aspect Import
on a variable need not have a convention specified, as long as
the implicit convention of the object, obtained from its type,
is Ada or Ada-related.
2013-10-10 Robert Dewar <dewar@adacore.com>
* cstand.adb (Standard_Unsigned_64): New internal type.
* gnat_rm.texi: Update documentation on To_Address.
* sem_attr.adb (Analyze_Attribute, case To_Address): Fix
problem with out of range static values given as literals or
named numbers.
* stand.ads (Standard_Unsigned_64): New internal type.
* stand.adb: Minor reformatting.
2013-10-10 Ed Schonberg <schonberg@adacore.com> 2013-10-10 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Analyze_Selected_Component, * sem_ch4.adb (Analyze_Selected_Component,
......
...@@ -1305,6 +1305,9 @@ package body CStand is ...@@ -1305,6 +1305,9 @@ package body CStand is
Set_Scope (Standard_Integer_64, Standard_Standard); Set_Scope (Standard_Integer_64, Standard_Standard);
Build_Signed_Integer_Type (Standard_Integer_64, 64); Build_Signed_Integer_Type (Standard_Integer_64, 64);
-- Standard_Unsigned is not user visible, but is used internally. It
-- is an unsigned type with the same length as Standard.Integer.
Standard_Unsigned := New_Standard_Entity; Standard_Unsigned := New_Standard_Entity;
Decl := New_Node (N_Full_Type_Declaration, Stloc); Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Standard_Unsigned); Set_Defining_Identifier (Decl, Standard_Unsigned);
...@@ -1329,6 +1332,32 @@ package body CStand is ...@@ -1329,6 +1332,32 @@ package body CStand is
Set_Etype (High_Bound (R_Node), Standard_Unsigned); Set_Etype (High_Bound (R_Node), Standard_Unsigned);
Set_Scalar_Range (Standard_Unsigned, R_Node); Set_Scalar_Range (Standard_Unsigned, R_Node);
-- Standard_Unsigned_64 is not user visible, but is used internally. It
-- is an unsigned type mod 2**64, 64-bits unsigned, size is 64.
Standard_Unsigned_64 := New_Standard_Entity;
Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Standard_Unsigned_64);
Make_Name (Standard_Unsigned_64, "unsigned_64");
Set_Ekind (Standard_Unsigned_64, E_Modular_Integer_Type);
Set_Scope (Standard_Unsigned_64, Standard_Standard);
Set_Etype (Standard_Unsigned_64, Standard_Unsigned_64);
Init_Size (Standard_Unsigned_64, 64);
Set_Elem_Alignment (Standard_Unsigned_64);
Set_Modulus (Standard_Unsigned_64, Uint_2 ** 64);
Set_Is_Unsigned_Type (Standard_Unsigned_64);
Set_Size_Known_At_Compile_Time
(Standard_Unsigned_64);
Set_Is_Known_Valid (Standard_Unsigned_64, True);
R_Node := New_Node (N_Range, Stloc);
Set_Low_Bound (R_Node, Make_Integer (Uint_0));
Set_High_Bound (R_Node, Make_Integer (Uint_2 ** 64 - 1));
Set_Etype (Low_Bound (R_Node), Standard_Unsigned_64);
Set_Etype (High_Bound (R_Node), Standard_Unsigned_64);
Set_Scalar_Range (Standard_Unsigned_64, R_Node);
-- Note: universal integer and universal real are constructed as fully -- Note: universal integer and universal real are constructed as fully
-- formed signed numeric types, with parameters corresponding to the -- formed signed numeric types, with parameters corresponding to the
-- longest runtime types (Long_Long_Integer and Long_Long_Float). This -- longest runtime types (Long_Long_Integer and Long_Long_Float). This
......
...@@ -8665,12 +8665,15 @@ denotes a function identical to ...@@ -8665,12 +8665,15 @@ denotes a function identical to
@code{System.Storage_Elements.To_Address} except that @code{System.Storage_Elements.To_Address} except that
it is a static attribute. This means that if its argument is it is a static attribute. This means that if its argument is
a static expression, then the result of the attribute is a a static expression, then the result of the attribute is a
static expression. The result is that such an expression can be static expression. This means that such an expression can be
used in contexts (e.g.@: preelaborable packages) which require a used in contexts (e.g.@: preelaborable packages) which require a
static expression and where the function call could not be used static expression and where the function call could not be used
(since the function call is always non-static, even if its (since the function call is always non-static, even if its
argument is static). The argument must be in the range 0 .. 2**m-1, argument is static). The argument must be in the range
where m is the memory size (typically 32 or 64). -(2**(m-1) .. 2**m-1, where m is the memory size
(typically 32 or 64). Negative values are intepreted in a
modular manner (e.g. -1 means the same as 16#FFFF_FFFF# on
a 32 bits machine).
@node Attribute Type_Class @node Attribute Type_Class
@unnumberedsec Attribute Type_Class @unnumberedsec Attribute Type_Class
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1998-2009, Free Software Foundation, Inc. -- -- Copyright (C) 1998-2013, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,15 +31,30 @@ ...@@ -31,15 +31,30 @@
-- This is the ARM VxWorks version of this package -- This is the ARM VxWorks version of this package
with Interfaces.C;
package System.VxWorks is package System.VxWorks is
pragma Preelaborate (System.VxWorks); pragma Preelaborate (System.VxWorks);
package IC renames Interfaces.C;
-- Floating point context record. ARM version -- Floating point context record. ARM version
FP_SGPR_NUM_REGS : constant := 32;
type Fpr_Sgpr_Array is array (1 .. FP_SGPR_NUM_REGS) of IC.unsigned;
-- The record definition below matches what arch/arm/fppArmLib.h says -- The record definition below matches what arch/arm/fppArmLib.h says
type FP_CONTEXT is record type FP_CONTEXT is record
Dummy : Integer; fpsid : IC.unsigned; -- system ID register
fpscr : IC.unsigned; -- status and control register
fpexc : IC.unsigned; -- exception register
fpinst : IC.unsigned; -- instruction register
fpinst2 : IC.unsigned; -- instruction register 2
mfvfr0 : IC.unsigned; -- media and VFP feature Register 0
mfvfr1 : IC.unsigned; -- media and VFP feature Register 1
pad : IC.unsigned;
vfp_gpr : Fpr_Sgpr_Array;
end record; end record;
for FP_CONTEXT'Alignment use 4; for FP_CONTEXT'Alignment use 4;
......
...@@ -5439,7 +5439,10 @@ package body Sem_Attr is ...@@ -5439,7 +5439,10 @@ package body Sem_Attr is
-- To_Address -- -- To_Address --
---------------- ----------------
when Attribute_To_Address => when Attribute_To_Address => To_Address : declare
Val : Uint;
begin
Check_E1; Check_E1;
Analyze (P); Analyze (P);
...@@ -5451,6 +5454,31 @@ package body Sem_Attr is ...@@ -5451,6 +5454,31 @@ package body Sem_Attr is
Analyze_And_Resolve (E1, Any_Integer); Analyze_And_Resolve (E1, Any_Integer);
Set_Etype (N, RTE (RE_Address)); Set_Etype (N, RTE (RE_Address));
-- Static expression case, check range and set appropriate type
if Is_OK_Static_Expression (E1) then
Val := Expr_Value (E1);
if Val < -(2 ** UI_From_Int (Standard'Address_Size - 1))
or else
Val > 2 ** UI_From_Int (Standard'Address_Size) - 1
then
Error_Attr ("address value out of range for % attribute", E1);
end if;
-- Set type to universal integer if negative
if Val < 0 then
Set_Etype (E1, Universal_Integer);
-- Otherwise set type to Unsigned_64 to accomodate max values
else
Set_Etype (E1, Standard_Unsigned_64);
end if;
end if;
end To_Address;
------------ ------------
-- To_Any -- -- To_Any --
------------ ------------
......
...@@ -888,7 +888,7 @@ package body Sem_Ch13 is ...@@ -888,7 +888,7 @@ package body Sem_Ch13 is
when Aspect_Scalar_Storage_Order => when Aspect_Scalar_Storage_Order =>
if (Is_Record_Type (E) or else Is_Array_Type (E)) if (Is_Record_Type (E) or else Is_Array_Type (E))
and then No (Get_Attribute_Definition_Clause and then No (Get_Attribute_Definition_Clause
(E, Attribute_Scalar_Storage_Order)) (E, Attribute_Scalar_Storage_Order))
and then Reverse_Storage_Order (P) and then Reverse_Storage_Order (P)
then then
Set_Reverse_Storage_Order (Base_Type (E)); Set_Reverse_Storage_Order (Base_Type (E));
...@@ -2208,7 +2208,29 @@ package body Sem_Ch13 is ...@@ -2208,7 +2208,29 @@ package body Sem_Ch13 is
Next (A); Next (A);
end loop; end loop;
-- It is legal to specify Import for a variable, in
-- order to suppress initialization for it, without
-- specifying explicitly its convention. However this
-- is only legal if the convention of the object type
-- is Ada or similar.
if No (A) then if No (A) then
if Ekind (E) = E_Variable
and then A_Id = Aspect_Import
then
declare
C : constant Convention_Id :=
Convention (Etype (E));
begin
if C = Convention_Ada or else
C = Convention_Ada_Pass_By_Copy or else
C = Convention_Ada_Pass_By_Reference
then
goto Continue;
end if;
end;
end if;
Error_Msg_N Error_Msg_N
("missing Convention aspect for Export/Import", ("missing Convention aspect for Export/Import",
Aspect); Aspect);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992,1993,1994,1995,2009 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -76,7 +76,6 @@ package body Stand is ...@@ -76,7 +76,6 @@ package body Stand is
Tree_Read_Int (Int (Standard_Op_Shift_Left)); Tree_Read_Int (Int (Standard_Op_Shift_Left));
Tree_Read_Int (Int (Standard_Op_Shift_Right)); Tree_Read_Int (Int (Standard_Op_Shift_Right));
Tree_Read_Int (Int (Standard_Op_Shift_Right_Arithmetic)); Tree_Read_Int (Int (Standard_Op_Shift_Right_Arithmetic));
end Tree_Read; end Tree_Read;
---------------- ----------------
...@@ -121,7 +120,6 @@ package body Stand is ...@@ -121,7 +120,6 @@ package body Stand is
Tree_Write_Int (Int (Standard_Op_Shift_Left)); Tree_Write_Int (Int (Standard_Op_Shift_Left));
Tree_Write_Int (Int (Standard_Op_Shift_Right)); Tree_Write_Int (Int (Standard_Op_Shift_Right));
Tree_Write_Int (Int (Standard_Op_Shift_Right_Arithmetic)); Tree_Write_Int (Int (Standard_Op_Shift_Right_Arithmetic));
end Tree_Write; end Tree_Write;
end Stand; end Stand;
...@@ -451,13 +451,15 @@ package Stand is ...@@ -451,13 +451,15 @@ package Stand is
Standard_Integer_16 : Entity_Id; Standard_Integer_16 : Entity_Id;
Standard_Integer_32 : Entity_Id; Standard_Integer_32 : Entity_Id;
Standard_Integer_64 : Entity_Id; Standard_Integer_64 : Entity_Id;
-- These are signed integer types with the indicated sizes, They are used -- These are signed integer types with the indicated sizes. Used for the
-- for the underlying implementation types for fixed-point and enumeration -- underlying implementation types for fixed-point and enumeration types.
-- types.
Standard_Unsigned : Entity_Id; Standard_Unsigned : Entity_Id;
-- An unsigned type of the same size as Standard_Integer -- An unsigned type of the same size as Standard_Integer
Standard_Unsigned_64 : Entity_Id;
-- An unsigned type, mod 2 ** 64, size of 64 bits.
Abort_Signal : Entity_Id; Abort_Signal : Entity_Id;
-- Entity for abort signal exception -- Entity for abort signal exception
......
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