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  <qui...@adacore.com>

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

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
 

Reply via email to