[multiple changes]

2009-04-29  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
	box-defaulted operator in an instantiation, when the type of the
	operands is not directly visible.

2009-04-29  Gary Dismukes  <dismukes@adacore.com>

	* sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
	(Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
	analysis of the ancestor part. Remove prohibition against limited
	interpretations of the ancestor expression in the case of Ada 2005.
	Revise error message in overloaded case, adding a message to cover
	the Ada 2005 case.

2009-04-29  Thomas Quinot  <quinot@adacore.com>

	* xoscons.adb: Minor reformatting

2009-04-29  Bob Duff  <duff@adacore.com>

	* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
	attribute_definition_clauses for the following attributes when the
	-gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
	Storage_Size, Write. Otherwise, we get spurious errors (for example,
	missing Read attribute on remote types).

	* gnat_ugn.texi: Document the change, and add a stern warning.

2009-04-29  Ed Schonberg  <schonberg@adacore.com>

	* sem_attr.adb (Check_Local_Access): Indicate that value tracing is
	disabled not just for the current scope, but for the innermost dynamic
	scope as well.

From-SVN: r146979
This commit is contained in:
Arnaud Charlet 2009-04-29 17:36:48 +02:00
parent 4cc51f5e38
commit 70b70ce8ca
7 changed files with 132 additions and 38 deletions

View File

@ -1,3 +1,38 @@
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
box-defaulted operator in an instantiation, when the type of the
operands is not directly visible.
2009-04-29 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
(Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
analysis of the ancestor part. Remove prohibition against limited
interpretations of the ancestor expression in the case of Ada 2005.
Revise error message in overloaded case, adding a message to cover
the Ada 2005 case.
2009-04-29 Thomas Quinot <quinot@adacore.com>
* xoscons.adb: Minor reformatting
2009-04-29 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
attribute_definition_clauses for the following attributes when the
-gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
Storage_Size, Write. Otherwise, we get spurious errors (for example,
missing Read attribute on remote types).
* gnat_ugn.texi: Document the change, and add a stern warning.
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Local_Access): Indicate that value tracing is
disabled not just for the current scope, but for the innermost dynamic
scope as well.
2009-04-29 Arnaud Charlet <charlet@adacore.com>
* gcc-interface/Make-lang.in: Update dependencies

View File

@ -4175,11 +4175,17 @@ see @ref{Character Set Control}.
@item ^-gnatI^/IGNORE_REP_CLAUSES^
@cindex @option{^-gnatI^IGNORE_REP_CLAUSES^} (@command{gcc})
Ignore representation clauses. When this switch is used, all
Ignore representation clauses. When this switch is used,
representation clauses are treated as comments. This is useful
when initially porting code where you want to ignore rep clause
problems, and also for compiling foreign code (particularly
for use with ASIS).
for use with ASIS). The representation clauses that are ignored
are: enumeration_representation_clause, record_representation_clause,
and attribute_definition_clause for the following attributes:
Address, Alignment, Bit_Order, Component_Size, Machine_Radix,
Object_Size, Size, Small, Stream_Size, and Value_Size.
Note that this option should be used only for compiling -- the
code is likely to malfunction at run time.
@item -gnatjnn
@cindex @option{-gnatjnn} (@command{gcc})

View File

@ -2147,14 +2147,6 @@ package body Sem_Aggr is
elsif Nkind_In (Anc, N_Aggregate, N_Function_Call) then
return True;
-- Check for a function name, to cover the case of a parameterless
-- function call which hasn't been resolved yet.
elsif Is_Entity_Name (Anc)
and then Ekind (Entity (Anc)) = E_Function
then
return True;
elsif Nkind (Anc) = N_Attribute_Reference
and then Attribute_Name (Anc) = Name_Input
then
@ -2208,7 +2200,11 @@ package body Sem_Aggr is
-- Start of processing for Resolve_Extension_Aggregate
begin
-- Analyze the ancestor part and account for the case where it's
-- a parameterless function call.
Analyze (A);
Check_Parameterless_Call (A);
if not Is_Tagged_Type (Typ) then
Error_Msg_N ("type of extension aggregate must be tagged", N);
@ -2255,8 +2251,11 @@ package body Sem_Aggr is
Get_First_Interp (A, I, It);
while Present (It.Typ) loop
-- Only consider limited interpretations in the Ada 2005 case
if Is_Tagged_Type (It.Typ)
and then not Is_Limited_Type (It.Typ)
and then (Ada_Version >= Ada_05
or else not Is_Limited_Type (It.Typ))
then
if A_Type /= Any_Type then
Error_Msg_N ("cannot resolve expression", A);
@ -2270,8 +2269,13 @@ package body Sem_Aggr is
end loop;
if A_Type = Any_Type then
Error_Msg_N
("ancestor part must be non-limited tagged type", A);
if Ada_Version >= Ada_05 then
Error_Msg_N ("ancestor part must be of a tagged type", A);
else
Error_Msg_N
("ancestor part must be of a nonlimited tagged type", A);
end if;
return;
end if;

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2008, 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -420,7 +420,8 @@ package body Sem_Attr is
-- an access, we set a flag to kill all tracked values on any call
-- because this access value may be passed around, and any called
-- code might use it to access a local procedure which clobbers a
-- tracked value.
-- tracked value. If the scope is a loop or block, indicate that
-- value tracking is disabled for the enclosing subprogram.
function Get_Kind (E : Entity_Id) return Entity_Kind;
-- Distinguish between access to regular/protected subprograms
@ -433,6 +434,8 @@ package body Sem_Attr is
begin
if not Is_Library_Level_Entity (E) then
Set_Suppress_Value_Tracking_On_Call (Current_Scope);
Set_Suppress_Value_Tracking_On_Call
(Nearest_Dynamic_Scope (Current_Scope));
end if;
end Check_Local_Access;

View File

@ -692,8 +692,40 @@ package body Sem_Ch13 is
begin
if Ignore_Rep_Clauses then
Rewrite (N, Make_Null_Statement (Sloc (N)));
return;
case Id is
-- The following should be ignored
when Attribute_Address |
Attribute_Alignment |
Attribute_Bit_Order |
Attribute_Component_Size |
Attribute_Machine_Radix |
Attribute_Object_Size |
Attribute_Size |
Attribute_Small |
Attribute_Stream_Size |
Attribute_Value_Size =>
Rewrite (N, Make_Null_Statement (Sloc (N)));
return;
-- The following should not be ignored
when Attribute_External_Tag |
Attribute_Input |
Attribute_Output |
Attribute_Read |
Attribute_Storage_Pool |
Attribute_Storage_Size |
Attribute_Write =>
null;
-- Other cases are errors, which will be caught below
when others =>
null;
end case;
end if;
Analyze (Nam);

View File

@ -2370,10 +2370,12 @@ package body Sem_Ch8 is
declare
F1 : Entity_Id;
F2 : Entity_Id;
T1 : Entity_Id;
begin
F1 := First_Formal (Candidate_Renaming);
F2 := First_Formal (New_S);
T1 := First_Subtype (Etype (F1));
while Present (F1) and then Present (F2) loop
Next_Formal (F1);
@ -2390,6 +2392,15 @@ package body Sem_Ch8 is
("\missing specification for &", Spec, F1);
end if;
end if;
if Nkind (Nam) = N_Operator_Symbol
and then From_Default (N)
then
Error_Msg_Node_2 := T1;
Error_Msg_NE
("default & on & is not directly visible",
Nam, Nam);
end if;
end;
end if;
end if;
@ -5040,10 +5051,12 @@ package body Sem_Ch8 is
Candidate_Renaming := Empty;
if not Is_Overloaded (Nam) then
if Entity_Matches_Spec (Entity (Nam), New_S)
and then Is_Visible_Operation (Entity (Nam))
then
Old_S := Entity (Nam);
if Entity_Matches_Spec (Entity (Nam), New_S) then
Candidate_Renaming := New_S;
if Is_Visible_Operation (Entity (Nam)) then
Old_S := Entity (Nam);
end if;
elsif
Present (First_Formal (Entity (Nam)))

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008, Free Software Foundation, Inc. --
-- Copyright (C) 2008-2009, Free Software Foundation, Inc. --
-- --
-- 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- --
@ -30,7 +30,7 @@
-- - the preprocessed C file: s-oscons-tmplt.i
-- - the generated assembly file: s-oscons-tmplt.s
-- The contents of s-oscons.ads is written on standard output
-- The contents of s-oscons.ads is written on standard output.
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Exceptions; use Ada.Exceptions;
@ -59,13 +59,13 @@ procedure XOSCons is
-- Information retrieved from assembly listing --
-------------------------------------------------
-- We need to deal with integer values that can be signed or unsigned,
-- so we need to cater for the maximum range of both cases.
type String_Access is access all String;
-- Note: we can't use GNAT.Strings for this definition, since that unit
-- is not available in older base compilers.
-- We need to deal with integer values that can be signed or unsigned, so
-- we need to accomodate the maximum range of both cases.
type Int_Value_Type is record
Positive : Boolean;
Abs_Value : Long_Unsigned := 0;
@ -75,8 +75,8 @@ procedure XOSCons is
(CND, -- Constant (decimal)
CNS, -- Constant (freeform string)
TXT); -- Literal text
-- Recognized markers found in assembly file. These markers are produced
-- by the same-named macros from the C template.
-- Recognized markers found in assembly file. These markers are produced by
-- the same-named macros from the C template.
type Asm_Info (Kind : Asm_Info_Kind := TXT) is record
Line_Number : Integer;
@ -98,16 +98,16 @@ procedure XOSCons is
-- Additional descriptive comment for constant, or free-form text (TXT)
end record;
package Asm_Infos is new GNAT.Table (
Table_Component_Type => Asm_Info,
package Asm_Infos is new GNAT.Table
(Table_Component_Type => Asm_Info,
Table_Index_Type => Integer,
Table_Low_Bound => 1,
Table_Initial => 100,
Table_Increment => 10);
Max_Const_Name_Len : Natural := 0;
Max_Const_Name_Len : Natural := 0;
Max_Constant_Value_Len : Natural := 0;
-- Longest name and longest value lengths
-- Lengths of longest name and longest value
type Language is (Lang_Ada, Lang_C);
@ -152,6 +152,7 @@ procedure XOSCons is
Info : Asm_Info renames Asm_Infos.Table (Info_Index);
procedure Put (S : String);
-- Write S to OFile
---------
-- Put --
@ -253,9 +254,7 @@ procedure XOSCons is
-- On some platforms, immediate integer values are prefixed with
-- a $ or # character in assembly output.
if S (First) = '$'
or else S (First) = '#'
then
if S (First) = '$' or else S (First) = '#' then
First := First + 1;
end if;
@ -306,6 +305,7 @@ procedure XOSCons is
if Info.Kind = CND then
Info.Int_Value := Parse_Int (Line (Index1 .. Index2 - 1));
Info.Value_Len := Index2 - Index1 - 1;
else
Info.Text_Value := Field_Alloc;
Info.Value_Len := Info.Text_Value'Length;
@ -322,8 +322,8 @@ procedure XOSCons is
if Info.Kind = TXT then
Info.Text_Value := Info.Comment;
-- Update Max_Constant_Value_Len, but only if this constant has
-- a comment (else the value is allowed to be longer).
-- Update Max_Constant_Value_Len, but only if this constant has a
-- comment (else the value is allowed to be longer).
elsif Info.Comment'Length > 0 then
if Info.Value_Len > Max_Constant_Value_Len then
@ -398,7 +398,7 @@ begin
-- Load C template and output definitions
Open (Tmpl_File, In_File, Tmpl_File_Name);
Open (Tmpl_File, In_File, Tmpl_File_Name);
Create (Ada_OFile, Out_File, Ada_File_Name);
Create (C_OFile, Out_File, C_File_Name);
@ -446,6 +446,7 @@ begin
Output_Info (Lang_C, C_OFile, Current_Info);
Current_Info := Current_Info + 1;
end if;
Current_Line := Current_Line + 1;
end if;
end loop;