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

login
register
mail settings
Submitter Arnaud Charlet
Date Aug. 29, 2011, 8:37 a.m.
Message ID <20110829083742.GA1498@adacore.com>
Download mbox | patch
Permalink /patch/111979/
State New
Headers show

Comments

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

generic
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;
begin

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
	declaration.

Patch

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