]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sem_util.adb (Build_Elaboration_Entity): Always request an elab counter when preservi...
authorOlivier Hainque <hainque@adacore.com>
Tue, 19 Apr 2016 13:19:45 +0000 (13:19 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 19 Apr 2016 13:19:45 +0000 (15:19 +0200)
2016-04-19  Olivier Hainque  <hainque@adacore.com>

* sem_util.adb (Build_Elaboration_Entity): Always request an
elab counter when preserving control-flow.

2016-04-19  Olivier Hainque  <hainque@adacore.com>

* sem_ch13.adb (Build_Invariant_Procedure_Declaration): Set
Needs_Debug_Info when producing SCOs.
* par_sco.adb (Traverse_Aspects): Fix categorization of
Type_Invariant to match actual processing as activated depending
on pragma Assertion_Policy.
* sem_prag.adb (Analyze_Pragma): Remove special case for
Name_Invariant regarding SCO generation, which completely disabled
the production of SCOs for Invariant pragmas and aspects.

From-SVN: r235202

gcc/ada/ChangeLog
gcc/ada/par_sco.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_prag.adb
gcc/ada/sem_util.adb

index 3a514cd1d42349270aa8d60b11886529adfd9694..3737bf36eb3533fe3c1c4ba8186239fca5d6a513 100644 (file)
@@ -1,3 +1,19 @@
+2016-04-19  Olivier Hainque  <hainque@adacore.com>
+
+       * sem_util.adb (Build_Elaboration_Entity): Always request an
+       elab counter when preserving control-flow.
+
+2016-04-19  Olivier Hainque  <hainque@adacore.com>
+
+       * sem_ch13.adb (Build_Invariant_Procedure_Declaration): Set
+       Needs_Debug_Info when producing SCOs.
+       * par_sco.adb (Traverse_Aspects): Fix categorization of
+       Type_Invariant to match actual processing as activated depending
+       on pragma Assertion_Policy.
+       * sem_prag.adb (Analyze_Pragma): Remove special case for
+       Name_Invariant regarding SCO generation, which completely disabled
+       the production of SCOs for Invariant pragmas and aspects.
+
 2016-04-19  Hristian Kirtchev  <kirtchev@adacore.com>
 
        * checks.adb, sem_util.adb, sem_res.adb, sem_attr.adb: Minor
index c1e6f03778198b0b80f9e2250247053c460bef28..e55742df4ad6432576aa06708d26982d94f3ac3a 100644 (file)
@@ -1640,11 +1640,12 @@ package body Par_SCO is
                --  specification. The corresponding pragma will have the same
                --  sloc.
 
-               when Aspect_Pre           |
-                    Aspect_Precondition  |
-                    Aspect_Post          |
-                    Aspect_Postcondition |
-                    Aspect_Invariant     =>
+               when Aspect_Pre            |
+                    Aspect_Precondition   |
+                    Aspect_Post           |
+                    Aspect_Postcondition  |
+                    Aspect_Type_Invariant |
+                    Aspect_Invariant      =>
 
                   C1 := 'a';
 
@@ -1660,8 +1661,7 @@ package body Par_SCO is
 
                when Aspect_Predicate         |
                     Aspect_Static_Predicate  |
-                    Aspect_Dynamic_Predicate |
-                    Aspect_Type_Invariant    =>
+                    Aspect_Dynamic_Predicate =>
 
                   C1 := 'A';
 
@@ -2397,8 +2397,8 @@ package body Par_SCO is
       Sync_Def : Node_Id;
       --  N's protected or task definition
 
-      Vis_Decl : List_Id;
-      --  Sync_Def's Visible_Declarations
+      Vis_Decl, Priv_Decl : List_Id;
+      --  Sync_Def's Visible_Declarations and Private_Declarations
 
    begin
       case Nkind (N) is
@@ -2412,7 +2412,16 @@ package body Par_SCO is
             raise Program_Error;
       end case;
 
-      Vis_Decl := Visible_Declarations (Sync_Def);
+      --  Sync_Def may be Empty at least for empty Task_Type_Declarations.
+      --  Querying Visible or Private_Declarations is invalid in this case.
+
+      if Present (Sync_Def) then
+         Vis_Decl := Visible_Declarations (Sync_Def);
+         Priv_Decl := Private_Declarations (Sync_Def);
+      else
+         Vis_Decl := No_List;
+         Priv_Decl := No_List;
+      end if;
 
       Dom_Info := Traverse_Declarations_Or_Statements
                     (L => Vis_Decl,
@@ -2422,7 +2431,7 @@ package body Par_SCO is
       --  is dominated by the last visible declaration.
 
       Traverse_Declarations_Or_Statements
-        (L => Private_Declarations (Sync_Def),
+        (L => Priv_Decl,
          D => Dom_Info);
    end Traverse_Sync_Definition;
 
index 2d6d922f318f80fe8740eb5f5d4c7ac3500bfe4b..b436b43a08626e332700e4c0c28dbabe2ed1a81d 100644 (file)
@@ -7841,6 +7841,14 @@ package body Sem_Ch13 is
       Set_Is_Invariant_Procedure (SId);
       Set_Invariant_Procedure (Typ, SId);
 
+      --  Source Coverage Obligations might be attached to the invariant
+      --  expression this procedure evaluates, and we need debug info to be
+      --  able to assess the coverage achieved by evaluations.
+
+      if Opt.Generate_SCO then
+         Set_Needs_Debug_Info (SId);
+      end if;
+
       --  Mark the invariant procedure explicitly as Ghost because it does not
       --  come from source.
 
index 289cfc8274a5ac593d498017b43727672f8e4b39..d929c852c94b28c61455b463bb6370f4b075d69a 100644 (file)
@@ -12265,11 +12265,11 @@ package body Sem_Prag is
 
             case Cname is
 
-               --  Nothing to do for invariants and predicates as the checks
-               --  occur in the client units. The SCO for the aspect in the
-               --  declaration unit is conservatively always enabled.
+               --  Nothing to do for predicates as the checks occur in the
+               --  client units. The SCO for the aspect in the declaration
+               --  unit is conservatively always enabled.
 
-               when Name_Invariant | Name_Predicate =>
+               when Name_Predicate =>
                   null;
 
                --  Otherwise mark aspect/pragma SCO as enabled
index 0d9b4d14394f76b5e191fde5c5e219da07cb7dae..ba4f0321c2dbbb813d52b6b3471f55497f6f4d3e 100644 (file)
@@ -1662,9 +1662,17 @@ package body Sem_Util is
       elsif ASIS_Mode then
          return;
 
-      --  See if we need elaboration entity. We always need it for the dynamic
-      --  elaboration model, since it is needed to properly generate the PE
-      --  exception for access before elaboration.
+      --  See if we need elaboration entity.
+
+      --  We always need an elaboration entity when preserving control-flow, as
+      --  we want to remain explicit about the units elaboration order.
+
+      elsif Opt.Suppress_Control_Flow_Optimizations then
+         null;
+
+      --  We always need an elaboration entity for the dynamic elaboration
+      --  model, since it is needed to properly generate the PE exception for
+      --  access before elaboration.
 
       elsif Dynamic_Elaboration_Checks then
          null;