Commit e29e2483 by Arnaud Charlet

[multiple changes]

2009-06-19  Robert Dewar  <dewar@adacore.com>

	* sem_type.ads, sem_ch12.adb: Minor reformatting

	* s-wchcnv.adb (UTF_32_To_Char_Sequence): Handle invalid data properly

2009-06-19  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch9.adb (Build_Wrapper_Spec): Handle properly an overridden
	primitive operation of a rivate extension whose controlling argument
	is an out parameter.

	* sem.adb (Walk_Library_Units): exclude generic package declarations
	from check.

From-SVN: r148696
parent c3b74b8a
2009-06-19 Robert Dewar <dewar@adacore.com>
* sem_type.ads, sem_ch12.adb: Minor reformatting
* s-wchcnv.adb (UTF_32_To_Char_Sequence): Handle invalid data properly
2009-06-19 Ed Schonberg <schonberg@adacore.com>
* exp_ch9.adb (Build_Wrapper_Spec): Handle properly an overridden
primitive operation of a rivate extension whose controlling argument
is an out parameter.
* sem.adb (Walk_Library_Units): exclude generic package declarations
from check.
2009-06-19 Thomas Quinot <quinot@adacore.com> 2009-06-19 Thomas Quinot <quinot@adacore.com>
* i-vxwoio.ads: Add comments * i-vxwoio.ads: Add comments
......
...@@ -2073,14 +2073,15 @@ package body Exp_Ch9 is ...@@ -2073,14 +2073,15 @@ package body Exp_Ch9 is
Parameter_Type => Obj_Param_Typ); Parameter_Type => Obj_Param_Typ);
-- If we are dealing with a primitive declared between two views, -- If we are dealing with a primitive declared between two views,
-- create a default parameter. -- create a default parameter. The mode of the parameter must
-- match that of the primitive operation.
else pragma Assert (Is_Private_Primitive_Subprogram (Subp_Id)); else pragma Assert (Is_Private_Primitive_Subprogram (Subp_Id));
Obj_Param := Obj_Param :=
Make_Parameter_Specification (Loc, Make_Parameter_Specification (Loc,
Defining_Identifier => Defining_Identifier =>
Make_Defining_Identifier (Loc, Name_uO), Make_Defining_Identifier (Loc, Name_uO),
In_Present => True, In_Present => In_Present (Parent (First_Entity (Subp_Id))),
Out_Present => Ekind (Subp_Id) /= E_Function, Out_Present => Ekind (Subp_Id) /= E_Function,
Parameter_Type => New_Reference_To (Obj_Typ, Loc)); Parameter_Type => New_Reference_To (Obj_Typ, Loc));
end if; end if;
......
...@@ -284,6 +284,14 @@ package body System.WCh_Cnv is ...@@ -284,6 +284,14 @@ package body System.WCh_Cnv is
U : Unsigned_32; U : Unsigned_32;
begin begin
-- Raise CE for invalid UTF_32_Code
if not Val'Valid then
raise Constraint_Error;
end if;
-- Processing depends on encoding mode
case EM is case EM is
when WCEM_Hex => when WCEM_Hex =>
...@@ -425,10 +433,6 @@ package body System.WCh_Cnv is ...@@ -425,10 +433,6 @@ package body System.WCh_Cnv is
if Val > 16#FFFF# then if Val > 16#FFFF# then
if Val > 16#00FF_FFFF# then if Val > 16#00FF_FFFF# then
if Val > 16#7FFF_FFFF# then
raise Constraint_Error;
end if;
Out_Char (Hexc (Val / 16 ** 7)); Out_Char (Hexc (Val / 16 ** 7));
Out_Char (Hexc ((Val / 16 ** 6) mod 16)); Out_Char (Hexc ((Val / 16 ** 6) mod 16));
end if; end if;
......
...@@ -1600,13 +1600,13 @@ package body Sem is ...@@ -1600,13 +1600,13 @@ package body Sem is
begin begin
if not Done (Get_Cunit_Unit_Number (Withed_Unit)) then if not Done (Get_Cunit_Unit_Number (Withed_Unit)) then
if not Nkind_In if not Nkind_In
(Unit (Withed_Unit), N_Package_Body, (Unit (Withed_Unit),
N_Subprogram_Body) N_Generic_Package_Declaration,
N_Package_Body,
N_Subprogram_Body)
then then
Write_Unit_Name Write_Unit_Name
(Unit_Name (Unit_Name (Get_Cunit_Unit_Number (Withed_Unit)));
(Get_Cunit_Unit_Number
(Withed_Unit)));
Write_Str (" not yet walked!"); Write_Str (" not yet walked!");
if Get_Cunit_Unit_Number (Withed_Unit) = Unit_Num then if Get_Cunit_Unit_Number (Withed_Unit) = Unit_Num then
......
...@@ -4360,7 +4360,7 @@ package body Sem_Ch12 is ...@@ -4360,7 +4360,7 @@ package body Sem_Ch12 is
Old_Main : constant Entity_Id := Cunit_Entity (Main_Unit); Old_Main : constant Entity_Id := Cunit_Entity (Main_Unit);
begin begin
-- A new compilation unit node is built for the instance declaration. -- A new compilation unit node is built for the instance declaration
Decl_Cunit := Decl_Cunit :=
Make_Compilation_Unit (Sloc (N), Make_Compilation_Unit (Sloc (N),
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2009, 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- --
...@@ -55,12 +55,12 @@ package Sem_Type is ...@@ -55,12 +55,12 @@ package Sem_Type is
-- Corresponding to the set of interpretations for a given overloadable -- Corresponding to the set of interpretations for a given overloadable
-- identifier, there is a set of possible types corresponding to the types -- identifier, there is a set of possible types corresponding to the types
-- that the overloaded call may return. We keep a 1-to-1 correspondence -- that the overloaded call may return. We keep a 1-to-1 correspondence
-- between interpretations and types: for user-defined subprograms the -- between interpretations and types: for user-defined subprograms the type
-- type is the declared return type. For operators, the type is determined -- is the declared return type. For operators, the type is determined by
-- by the type of the arguments. If the arguments themselves are -- the type of the arguments. If the arguments themselves are overloaded,
-- overloaded, we enter the operator name in the names table for each -- we enter the operator name in the names table for each possible result
-- possible result type. In most cases, arguments are not overloaded and -- type. In most cases, arguments are not overloaded and only one
-- only one interpretation is present anyway. -- interpretation is present anyway.
type Interp is record type Interp is record
Nam : Entity_Id; Nam : Entity_Id;
...@@ -97,23 +97,22 @@ package Sem_Type is ...@@ -97,23 +97,22 @@ package Sem_Type is
-- Invoked by gnatf when processing multiple files -- Invoked by gnatf when processing multiple files
procedure Collect_Interps (N : Node_Id); procedure Collect_Interps (N : Node_Id);
-- Invoked when the name N has more than one visible interpretation. -- Invoked when the name N has more than one visible interpretation. This
-- This is the high level routine which accumulates the possible -- is the high level routine which accumulates the possible interpretations
-- interpretations of the node. The first meaning and type of N have -- of the node. The first meaning and type of N have already been stored
-- already been stored in N. If the name is an expanded name, the homonyms -- in N. If the name is an expanded name, the homonyms are only those that
-- are only those that belong to the same scope. -- belong to the same scope.
function Is_Invisible_Operator function Is_Invisible_Operator
(N : Node_Id; (N : Node_Id;
T : Entity_Id) T : Entity_Id)
return Boolean; return Boolean;
-- Check whether a predefined operation with universal operands appears -- Check whether a predefined operation with universal operands appears in
-- in a context in which the operators of the expected type are not -- a context in which the operators of the expected type are not visible.
-- visible.
procedure List_Interps (Nam : Node_Id; Err : Node_Id); procedure List_Interps (Nam : Node_Id; Err : Node_Id);
-- List candidate interpretations of an overloaded name. Used for -- List candidate interpretations of an overloaded name. Used for various
-- various error reports. -- error reports.
procedure Add_One_Interp procedure Add_One_Interp
(N : Node_Id; (N : Node_Id;
...@@ -121,13 +120,13 @@ package Sem_Type is ...@@ -121,13 +120,13 @@ package Sem_Type is
T : Entity_Id; T : Entity_Id;
Opnd_Type : Entity_Id := Empty); Opnd_Type : Entity_Id := Empty);
-- Add (E, T) to the list of interpretations of the node being resolved. -- Add (E, T) to the list of interpretations of the node being resolved.
-- For calls and operators, i.e. for nodes that have a name field, -- For calls and operators, i.e. for nodes that have a name field, E is an
-- E is an overloadable entity, and T is its type. For constructs such -- overloadable entity, and T is its type. For constructs such as indexed
-- as indexed expressions, the caller sets E equal to T, because the -- expressions, the caller sets E equal to T, because the overloading comes
-- overloading comes from other fields, and the node itself has no name -- from other fields, and the node itself has no name to resolve. Hidden
-- to resolve. Hidden denotes whether an interpretation has been disabled -- denotes whether an interpretation has been disabled by an abstract
-- by an abstract operator. Add_One_Interp includes semantic processing to -- operator. Add_One_Interp includes semantic processing to deal with
-- deal with adding entries that hide one another etc. -- adding entries that hide one another etc.
-- For operators, the legality of the operation depends on the visibility -- For operators, the legality of the operation depends on the visibility
-- of T and its scope. If the operator is an equality or comparison, T is -- of T and its scope. If the operator is an equality or comparison, T is
...@@ -166,10 +165,9 @@ package Sem_Type is ...@@ -166,10 +165,9 @@ package Sem_Type is
-- New_N, its new copy. It has no effect in the non-overloaded case. -- New_N, its new copy. It has no effect in the non-overloaded case.
function Covers (T1, T2 : Entity_Id) return Boolean; function Covers (T1, T2 : Entity_Id) return Boolean;
-- This is the basic type compatibility routine. T1 is the expected -- This is the basic type compatibility routine. T1 is the expected type,
-- type, imposed by context, and T2 is the actual type. The processing -- imposed by context, and T2 is the actual type. The processing reflects
-- reflects both the definition of type coverage and the rules -- both the definition of type coverage and the rules for operand matching.
-- for operand matching.
function Disambiguate function Disambiguate
(N : Node_Id; (N : Node_Id;
...@@ -188,24 +186,24 @@ package Sem_Type is ...@@ -188,24 +186,24 @@ package Sem_Type is
-- opposed to an operator, type and mode conformance are required. -- opposed to an operator, type and mode conformance are required.
function Find_Unique_Type (L : Node_Id; R : Node_Id) return Entity_Id; function Find_Unique_Type (L : Node_Id; R : Node_Id) return Entity_Id;
-- Used in second pass of resolution, for equality and comparison nodes. -- Used in second pass of resolution, for equality and comparison nodes. L
-- L is the left operand, whose type is known to be correct, and R is -- is the left operand, whose type is known to be correct, and R is the
-- the right operand, which has one interpretation compatible with that -- right operand, which has one interpretation compatible with that of L.
-- of L. Return the type intersection of the two. -- Return the type intersection of the two.
function Has_Compatible_Type function Has_Compatible_Type
(N : Node_Id; (N : Node_Id;
Typ : Entity_Id) Typ : Entity_Id)
return Boolean; return Boolean;
-- Verify that some interpretation of the node N has a type compatible -- Verify that some interpretation of the node N has a type compatible with
-- with Typ. If N is not overloaded, then its unique type must be -- Typ. If N is not overloaded, then its unique type must be compatible
-- compatible with Typ. Otherwise iterate through the interpretations -- with Typ. Otherwise iterate through the interpretations of N looking for
-- of N looking for a compatible one. -- a compatible one.
function Hides_Op (F : Entity_Id; Op : Entity_Id) return Boolean; function Hides_Op (F : Entity_Id; Op : Entity_Id) return Boolean;
-- A user-defined function hides a predefined operator if it is -- A user-defined function hides a predefined operator if it is matches the
-- matches the signature of the operator, and is declared in an -- signature of the operator, and is declared in an open scope, or in the
-- open scope, or in the scope of the result type. -- scope of the result type.
function Interface_Present_In_Ancestor function Interface_Present_In_Ancestor
(Typ : Entity_Id; (Typ : Entity_Id;
...@@ -241,15 +239,15 @@ package Sem_Type is ...@@ -241,15 +239,15 @@ package Sem_Type is
-- real type, or a one dimensional array with a discrete component type. -- real type, or a one dimensional array with a discrete component type.
function Valid_Boolean_Arg (T : Entity_Id) return Boolean; function Valid_Boolean_Arg (T : Entity_Id) return Boolean;
-- A valid argument of a boolean operator is either some boolean type, -- A valid argument of a boolean operator is either some boolean type, or a
-- or a one-dimensional array of boolean type. -- one-dimensional array of boolean type.
procedure Write_Interp_Ref (Map_Ptr : Int); procedure Write_Interp_Ref (Map_Ptr : Int);
-- Debugging procedure to display entry in Interp_Map. Would not be -- Debugging procedure to display entry in Interp_Map. Would not be needed
-- needed if it were possible to debug instantiations of Table. -- if it were possible to debug instantiations of Table.
procedure Write_Overloads (N : Node_Id); procedure Write_Overloads (N : Node_Id);
-- Debugging procedure to output info on possibly overloaded entities -- Debugging procedure to output info on possibly overloaded entities for
-- for specified node. -- specified node.
end Sem_Type; end Sem_Type;
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