Commit 2642f998 by Robert Dewar Committed by Arnaud Charlet

checks.adb, [...]: Improve warnings for address overlays.

2007-09-26  Robert Dewar  <dewar@adacore.com>

	* checks.adb, gnat1drv.adb, sem_util.ads: Improve warnings for address
	overlays.

	* sem_ch13.ads, sem_ch13.adb: Improve warnings for address overlays
	(Analyze_Record_Representation_Clause): Suppress junk warning for
	missing component clause.
	(Analyze_Attribute_Definition_Clause, case Address): Apply the special
	tests for controlled type overlay to composites with controlled
	components.
	(Analyze_Record_Representation_Clause): Add reference for component name

From-SVN: r128785
parent 6e818918
......@@ -543,6 +543,7 @@ package body Checks is
Error_Msg_FE
("\?program execution may be erroneous (RM 13.3(27))",
Aexp, E);
Set_Address_Warning_Posted (AC);
end if;
end Compile_Time_Bad_Alignment;
......@@ -626,6 +627,7 @@ package body Checks is
Error_Msg_FE
("\?program execution may be erroneous", Aexp, E);
Size_Warning_Output := True;
Set_Address_Warning_Posted (AC);
end if;
end if;
end;
......
......@@ -442,6 +442,7 @@ begin
if Compilation_Errors then
Treepr.Tree_Dump;
Sem_Ch13.Validate_Unchecked_Conversions;
Sem_Ch13.Validate_Address_Clauses;
Errout.Output_Messages;
Namet.Finalize;
......@@ -622,6 +623,7 @@ begin
Write_Eol;
Sem_Ch13.Validate_Unchecked_Conversions;
Sem_Ch13.Validate_Address_Clauses;
Errout.Finalize (Last_Call => True);
Errout.Output_Messages;
Treepr.Tree_Dump;
......@@ -654,6 +656,7 @@ begin
or else Targparm.VM_Target /= No_VM)
then
Sem_Ch13.Validate_Unchecked_Conversions;
Sem_Ch13.Validate_Address_Clauses;
Errout.Finalize (Last_Call => True);
Errout.Output_Messages;
Write_ALI (Object => False);
......@@ -704,6 +707,11 @@ begin
Sem_Ch13.Validate_Unchecked_Conversions;
-- Validate address clauses (again using alignment values annotated
-- by the backend where possible).
Sem_Ch13.Validate_Address_Clauses;
-- Now we complete output of errors, rep info and the tree info. These
-- are delayed till now, since it is perfectly possible for gigi to
-- generate errors, modify the tree (in particular by setting flags
......
......@@ -161,4 +161,10 @@ package Sem_Ch13 is
-- The reason it is called that late is to take advantage of any
-- back-annotation of size and alignment performed by the backend.
procedure Validate_Address_Clauses;
-- This is called after the back end has been called (and thus after the
-- alignments of objects have been back annotated). It goes through the
-- table of saved address clauses checking for suspicious alignments and
-- if necessary issuing warnings.
end Sem_Ch13;
......@@ -292,6 +292,13 @@ package Sem_Util is
-- denotes when analyzed. Subsequent uses of this id on a different
-- type denote the discriminant at the same position in this new type.
function Find_Overlaid_Object (N : Node_Id) return Entity_Id;
-- The node N should be an address representation clause. This function
-- checks if the target expression is the address of some stand alone
-- object (variable or constant), and if so, returns its entity. If N is
-- not an address representation clause, or if it is not possible to
-- determine that the address is of this form, then Empty is returned.
function Find_Overridden_Synchronized_Primitive
(Def_Id : Entity_Id;
First_Hom : Entity_Id;
......@@ -304,6 +311,11 @@ package Sem_Util is
-- declared inside the scope of the synchronized type or after. Return
-- the overridden entity or Empty.
function Find_Static_Alternative (N : Node_Id) return Node_Id;
-- N is a case statement whose expression is a compile-time value.
-- Determine the alternative chosen, so that the code of non-selected
-- alternatives, and the warnings that may apply to them, are removed.
function First_Actual (Node : Node_Id) return Node_Id;
-- Node is an N_Function_Call or N_Procedure_Call_Statement node. The
-- result returned is the first actual parameter in declaration order
......@@ -321,11 +333,6 @@ package Sem_Util is
-- name in upper case. An ASCII.NUL is appended as the last character.
-- The names in the string are generated by Namet.Get_Decoded_Name_String.
function Find_Static_Alternative (N : Node_Id) return Node_Id;
-- N is a case statement whose expression is a compile-time value.
-- Determine the alternative chosen, so that the code of non-selected
-- alternatives, and the warnings that may apply to them, are removed.
procedure Gather_Components
(Typ : Entity_Id;
Comp_List : Node_Id;
......
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