aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch7.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2016-04-27 15:05:41 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2016-04-27 15:05:41 +0200
commit680d5f6190bf5c90e600f47ee8c9e604d80b2f7b (patch)
treeced0897ff6a0f85f50870e91078f0df69a7eedf0 /gcc/ada/sem_ch7.adb
parent14f3895c40cd3f074ca17823c30a6cbf665836b5 (diff)
downloadgcc-680d5f6190bf5c90e600f47ee8c9e604d80b2f7b.zip
gcc-680d5f6190bf5c90e600f47ee8c9e604d80b2f7b.tar.gz
gcc-680d5f6190bf5c90e600f47ee8c9e604d80b2f7b.tar.bz2
[multiple changes]
2016-04-27 Ed Schonberg <schonberg@adacore.com> * sem_util.ads, sem_util.adb (Is_Null_Record_Type): New predicate to determine whether a record type is a null record. * sem_ch3.adb (Analyze_Object_Declaration): If the type is a null record and there is no expression in the declaration, no predicate check applies to the object. 2016-04-27 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch7.adb (Analyze_Package_Body_Helper): The body of an instantiated package should not cause freezing of previous contracts. 2016-04-27 Ed Schonberg <schonberg@adacore.com> * sem_dim.adb (Analyze_Dimension): Handle subtype declarations that do not come from source. (Analyze_Dimension_Subtype_Declaration): Allow confirming dimensions on subtype entity, either inherited from base type or provided by aspect specification. 2016-04-27 Ed Schonberg <schonberg@adacore.com> * s-gearop.ads (Matrix_Vector_Solution, Matrix_Matrix_Solution): Add scalar formal object Zero, to allow detection and report when the matrix is singular. * s-gearop.adb (Matrix_Vector_Solution, Matrix_Matrix_Solution): Raise Constraint_Error if the Forward_Eliminate pass has determined that determinant is Zero.o * s-ngrear.adb (Solve): Add actual for Zero in corresponding instantiations. * s-ngcoar.adb (Solve): Ditto. From-SVN: r235499
Diffstat (limited to 'gcc/ada/sem_ch7.adb')
-rw-r--r--gcc/ada/sem_ch7.adb65
1 files changed, 36 insertions, 29 deletions
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index dc742de..1a8786d 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -544,35 +544,6 @@ package body Sem_Ch7 is
-- Start of processing for Analyze_Package_Body_Helper
begin
- -- A [generic] package body "freezes" the contract of the nearest
- -- enclosing package body and all other contracts encountered in the
- -- same declarative part up to and excluding the package body:
-
- -- package body Nearest_Enclosing_Package
- -- with Refined_State => (State => Constit)
- -- is
- -- Constit : ...;
-
- -- package body Freezes_Enclosing_Package_Body
- -- with Refined_State => (State_2 => Constit_2)
- -- is
- -- Constit_2 : ...;
-
- -- procedure Proc
- -- with Refined_Depends => (Input => (Constit, Constit_2)) ...
-
- -- This ensures that any annotations referenced by the contract of a
- -- [generic] subprogram body declared within the current package body
- -- are available. This form of "freezing" is decoupled from the usual
- -- Freeze_xxx mechanism because it must also work in the context of
- -- generics where normal freezing is disabled.
-
- -- Only bodies coming from source should cause this type of "freezing"
-
- if Comes_From_Source (N) then
- Analyze_Previous_Contracts (N);
- end if;
-
-- Find corresponding package specification, and establish the current
-- scope. The visible defining entity for the package is the defining
-- occurrence in the spec. On exit from the package body, all body
@@ -628,6 +599,42 @@ package body Sem_Ch7 is
end if;
end if;
+ -- A [generic] package body "freezes" the contract of the nearest
+ -- enclosing package body and all other contracts encountered in the
+ -- same declarative part up to and excluding the package body:
+
+ -- package body Nearest_Enclosing_Package
+ -- with Refined_State => (State => Constit)
+ -- is
+ -- Constit : ...;
+
+ -- package body Freezes_Enclosing_Package_Body
+ -- with Refined_State => (State_2 => Constit_2)
+ -- is
+ -- Constit_2 : ...;
+
+ -- procedure Proc
+ -- with Refined_Depends => (Input => (Constit, Constit_2)) ...
+
+ -- This ensures that any annotations referenced by the contract of a
+ -- [generic] subprogram body declared within the current package body
+ -- are available. This form of "freezing" is decoupled from the usual
+ -- Freeze_xxx mechanism because it must also work in the context of
+ -- generics where normal freezing is disabled.
+
+ -- Only bodies coming from source should cause this type of "freezing".
+ -- Instantiated generic bodies are excluded because their processing is
+ -- performed in a separate compilation pass which lacks enough semantic
+ -- information with respect to contract analysis. It is safe to suppress
+ -- the "freezing" of contracts in this case because this action already
+ -- took place at the end of the enclosing declarative part.
+
+ if Comes_From_Source (N)
+ and then not Is_Generic_Instance (Spec_Id)
+ then
+ Analyze_Previous_Contracts (N);
+ end if;
+
-- A package body is Ghost when the corresponding spec is Ghost. Set
-- the mode now to ensure that any nodes generated during analysis and
-- expansion are properly flagged as ignored Ghost.