Commit 7c62a85a by Arnaud Charlet

[multiple changes]

2011-08-05  Pascal Obry  <obry@adacore.com>

	* a-iteint.ads: Fix copyright year.

2011-08-05  Thomas Quinot  <quinot@adacore.com>

	* par_sco.adb (Traverse_Declarations_Or_Statements): Do not generate a
	statement SCO for a USE clause or a representation clause.

2011-08-05  Yannick Moy  <moy@adacore.com>

	* lib-xref-alfa.adb (Collect_ALFA): generate the proper relation
	between body and spec for stub.
	(Detect_And_Add_ALFA_Scope): take into account subprogram stub
	* lib-xref.adb (Enclosing_Subprogram_Or_Package): in the case of a
	pragma precondition or postcondition, for which the enclosing
	subprogram or package in the AST is not the desired one, return empty.

From-SVN: r177450
parent e49208a9
2011-08-05 Pascal Obry <obry@adacore.com>
* a-iteint.ads: Fix copyright year.
2011-08-05 Thomas Quinot <quinot@adacore.com>
* par_sco.adb (Traverse_Declarations_Or_Statements): Do not generate a
statement SCO for a USE clause or a representation clause.
2011-08-05 Yannick Moy <moy@adacore.com>
* lib-xref-alfa.adb (Collect_ALFA): generate the proper relation
between body and spec for stub.
(Detect_And_Add_ALFA_Scope): take into account subprogram stub
* lib-xref.adb (Enclosing_Subprogram_Or_Package): in the case of a
pragma precondition or postcondition, for which the enclosing
subprogram or package in the AST is not the desired one, return empty.
2011-08-05 Thomas Quinot <quinot@adacore.com> 2011-08-05 Thomas Quinot <quinot@adacore.com>
* g-expect.adb: Minor reformatting. * g-expect.adb: Minor reformatting.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2004-2011, Free Software Foundation, Inc. -- -- Copyright (C) 2011, Free Software Foundation, Inc. --
-- -- -- --
-- This specification is derived from the Ada Reference Manual for use with -- -- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow -- -- GNAT. The copyright notice above, and the license provisions that follow --
......
...@@ -845,6 +845,9 @@ package body ALFA is ...@@ -845,6 +845,9 @@ package body ALFA is
if Present (Body_Entity) then if Present (Body_Entity) then
if Nkind (Body_Entity) = N_Defining_Program_Unit_Name then if Nkind (Body_Entity) = N_Defining_Program_Unit_Name then
Body_Entity := Parent (Body_Entity); Body_Entity := Parent (Body_Entity);
elsif Nkind (Body_Entity) = N_Subprogram_Body_Stub then
Body_Entity :=
Proper_Body (Unit (Library_Unit (Body_Entity)));
end if; end if;
Spec_Entity := Corresponding_Spec (Body_Entity); Spec_Entity := Corresponding_Spec (Body_Entity);
...@@ -874,10 +877,12 @@ package body ALFA is ...@@ -874,10 +877,12 @@ package body ALFA is
procedure Detect_And_Add_ALFA_Scope (N : Node_Id) is procedure Detect_And_Add_ALFA_Scope (N : Node_Id) is
begin begin
if Nkind_In (N, N_Subprogram_Declaration, if Nkind_In (N,
N_Subprogram_Body, N_Subprogram_Declaration,
N_Package_Declaration, N_Subprogram_Body,
N_Package_Body) N_Subprogram_Body_Stub,
N_Package_Declaration,
N_Package_Body)
then then
Add_ALFA_Scope (N); Add_ALFA_Scope (N);
end if; end if;
......
...@@ -129,7 +129,7 @@ package body Lib.Xref is ...@@ -129,7 +129,7 @@ package body Lib.Xref is
------------------------------------- -------------------------------------
function Enclosing_Subprogram_Or_Package (N : Node_Id) return Entity_Id is function Enclosing_Subprogram_Or_Package (N : Node_Id) return Entity_Id is
Result : Entity_Id; Result : Entity_Id;
begin begin
-- If N is the defining identifier for a subprogram, then return the -- If N is the defining identifier for a subprogram, then return the
...@@ -167,6 +167,20 @@ package body Lib.Xref is ...@@ -167,6 +167,20 @@ package body Lib.Xref is
Result := Defining_Unit_Name (Specification (Result)); Result := Defining_Unit_Name (Specification (Result));
exit; exit;
-- The enclosing subprogram for a pre- or postconditions should be
-- the subprogram to which the pragma is attached. This is not
-- always the case in the AST, as the pragma may be declared after
-- the declaration of the subprogram. Return Empty in this case.
when N_Pragma =>
if Get_Pragma_Id (Result) = Pragma_Precondition
or else Get_Pragma_Id (Result) = Pragma_Postcondition
then
return Empty;
else
Result := Parent (Result);
end if;
when others => when others =>
Result := Parent (Result); Result := Parent (Result);
end case; end case;
......
...@@ -1483,7 +1483,8 @@ package body Par_SCO is ...@@ -1483,7 +1483,8 @@ package body Par_SCO is
when others => when others =>
-- Determine required type character code -- Determine required type character code, or ASCII.NUL if
-- no SCO should be generated for this node.
declare declare
Typ : Character; Typ : Character;
...@@ -1505,11 +1506,19 @@ package body Par_SCO is ...@@ -1505,11 +1506,19 @@ package body Par_SCO is
when N_Generic_Instantiation => when N_Generic_Instantiation =>
Typ := 'i'; Typ := 'i';
when
N_Representation_Clause |
N_Use_Package_Clause |
N_Use_Type_Clause =>
Typ := ASCII.NUL;
when others => when others =>
Typ := ' '; Typ := ' ';
end case; end case;
Extend_Statement_Sequence (N, Typ); if Typ /= ASCII.NUL then
Extend_Statement_Sequence (N, Typ);
end if;
end; end;
-- Process any embedded decisions -- Process any embedded decisions
......
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