diff options
author | Olivier Hainque <hainque@adacore.com> | 2016-04-19 13:19:45 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-04-19 15:19:45 +0200 |
commit | 27b95a65410ccb700752c8178fd19f1485a4b5bf (patch) | |
tree | 132f0b06c5933b23ab8d346737f54e784f7c852a | |
parent | b4213ffdafd1907f53c50b7bcdaa7fd269495592 (diff) | |
download | gcc-27b95a65410ccb700752c8178fd19f1485a4b5bf.zip gcc-27b95a65410ccb700752c8178fd19f1485a4b5bf.tar.gz gcc-27b95a65410ccb700752c8178fd19f1485a4b5bf.tar.bz2 |
sem_util.adb (Build_Elaboration_Entity): Always request an elab counter when preserving control-flow.
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
-rw-r--r-- | gcc/ada/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/ada/par_sco.adb | 31 | ||||
-rw-r--r-- | gcc/ada/sem_ch13.adb | 8 | ||||
-rw-r--r-- | gcc/ada/sem_prag.adb | 8 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 14 |
5 files changed, 59 insertions, 18 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3a514cd..3737bf36 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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 diff --git a/gcc/ada/par_sco.adb b/gcc/ada/par_sco.adb index c1e6f03..e55742d 100644 --- a/gcc/ada/par_sco.adb +++ b/gcc/ada/par_sco.adb @@ -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; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 2d6d922..b436b43 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -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. diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 289cfc8..d929c85 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -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 diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 0d9b4d1..ba4f032 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -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; |