[Ada] Instantiations and subprogram declarations do not break statement SCO seq

Message ID 20110829083742.GA1498@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Aug. 29, 2011, 8:37 a.m.
This change ensures that a subprogram declaration or a generic instantiation
does not create a new entry point in the sequence of statement SCOs.

For the following compilation, a single statement sequence SCO line shall
be output for the declaration of X, the instantiation I, and the declaration
of Y.

$ gcc -c -gnateS inst.adb
$ grep "^CS" inst.ali | head -1
CS o3:4-3:19 i5:4-5:21 o6:4-6:19

package Gen is
end Gen;

with Gen;
procedure Inst is
   X : Integer := 1;
   procedure P;
   package I is new Gen;
   Y : Integer := 1;

   procedure P is begin null; end;

Tested on x86_64-pc-linux-gnu, committed on trunk

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

	* par_sco.adb (Traverse_Declarations_Or_Statements): Do not flush
	current statement sequence on a generic instantiation or a subprogram


Index: par_sco.adb
--- par_sco.adb	(revision 178156)
+++ par_sco.adb	(working copy)
@@ -1204,7 +1204,6 @@ 
                when N_Subprogram_Declaration =>
                     (Parameter_Specifications (Specification (N)), 'X');
-                  Set_Statement_Entry;
                --  Generic subprogram declaration
@@ -1213,7 +1212,6 @@ 
                     (Generic_Formal_Declarations (N), 'X');
                     (Parameter_Specifications (Specification (N)), 'X');
-                  Set_Statement_Entry;
                --  Task or subprogram body