SCOs for disabled pragma statements (Assert or Debug) should be output with
a marker indicating that they are disabled, rather than suppresed, because
references to them can appear in dominance markers for subsequent statement
sequences.

In the following compilation, the dominance marker must designate the sloc
of an existing SCO statement entry with a code character 'p' (disabled
pragma):

$ gcc -c -gnateS dom_debug.adb
$ grep ^C dom_debug.ali
C 9 dom_debug.adb
CS o3:4-3:9 pDEBUG:4:4-4:40
CS 5:25-5:25
CS >S4:4 o6:4-6:9
CS 8:4-8:4

with Ada.Text_IO;
procedure Dom_Debug is
   X0 : Integer;
   pragma Debug (Ada.Text_IO.Put_Line ("hello"));
   procedure P is begin null; end P;
   X1 : Integer;
begin
   null;
end Dom_Debug;

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

2012-01-23  Thomas Quinot  <qui...@adacore.com>

        * scos.ads, put_scos.adb, get_scos.adb (Get_SCOs, Put_SCOs): Do not
        omit statement SCOs for disabled pragmas.

Index: scos.ads
===================================================================
--- scos.ads    (revision 183406)
+++ scos.ads    (working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2009-2011, Free Software Foundation, Inc.         --
+--          Copyright (C) 2009-2012, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -157,6 +157,7 @@
    --      F        FOR loop (from FOR through end of iteration scheme)
    --      I        IF statement (from IF through end of condition)
    --      P[name:] PRAGMA with the indicated name
+   --      p[name:] disabled PRAGMA with the indicated name
    --      R        extended RETURN statement
    --      W        WHILE loop statement (from WHILE through end of condition)
 
Index: put_scos.adb
===================================================================
--- put_scos.adb        (revision 183406)
+++ put_scos.adb        (working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2009-2011, Free Software Foundation, Inc.         --
+--          Copyright (C) 2009-2012, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -139,12 +139,6 @@
                      Ctr := 0;
                      Continuation := False;
                      loop
-                        if SCO_Pragma_Disabled
-                             (SCO_Table.Table (Start).Pragma_Sloc)
-                        then
-                           goto Next_Statement;
-                        end if;
-
                         if Ctr = 0 then
                            Write_SCO_Initiate (U);
                            if not Continuation then
@@ -169,7 +163,7 @@
                               Write_Info_Char (Sent.C2);
 
                               if Sent.C1 = 'S'
-                                and then Sent.C2 = 'P'
+                                and then (Sent.C2 = 'P' or else Sent.C2 = 'p')
                                 and then Sent.Pragma_Name /= Unknown_Pragma
                               then
                                  --  Strip leading "PRAGMA_"
@@ -205,7 +199,6 @@
                            Ctr := 0;
                         end if;
 
-                     <<Next_Statement>>
                         exit when SCO_Table.Table (Start).Last;
                         Start := Start + 1;
                      end loop;
Index: get_scos.adb
===================================================================
--- get_scos.adb        (revision 183406)
+++ get_scos.adb        (working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2009-2011, Free Software Foundation, Inc.         --
+--          Copyright (C) 2009-2012, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -301,7 +301,7 @@
 
                      when others =>
                         Skipc;
-                        if Typ = 'P' then
+                        if Typ = 'P' or else Typ = 'p' then
                            if Nextc not in '1' .. '9' then
                               N := 1;
                               loop

Reply via email to