diff options
author | Ed Schonberg <schonberg@adacore.com> | 2018-12-11 11:09:19 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-12-11 11:09:19 +0000 |
commit | 5f531feff7ed6651354ed5b1cbd2a83cf204d170 (patch) | |
tree | 516bc968672662fd2a9636ff4234661f1e7aaefd /gcc/ada/sem_ch13.ads | |
parent | 15bdffc4963b842cf104a0075921965a3cee272b (diff) | |
download | gcc-5f531feff7ed6651354ed5b1cbd2a83cf204d170.zip gcc-5f531feff7ed6651354ed5b1cbd2a83cf204d170.tar.gz gcc-5f531feff7ed6651354ed5b1cbd2a83cf204d170.tar.bz2 |
[Ada] Spurious errors on aspect specifications in generic units
This patch fixes spurious errors on aspect specifications on record
types when the aspect expression references a component of the type that
is not a discriminant. The patch also cleans up the legality checks on
aspect specifications, and improves error message on illegal aspect
specifications whose expressions are not conformant between
specification and freeze point, because of changes in visibility.
2018-12-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch13.adb (Push_Type, Pop_Type): New procedures, used for
analysis of aspect expressions for record types, whose
components (not only discriminants) may be referenced in aspect
expressions.
(Analyze_Aspect_Specifications, Analyze_Aspects_At_Freeze_Point,
Analyze_Aspect_At_End-Of_Declarations,
Resolve_Aspect_Expressions): Use the new subprograms.
(Check_Aspect_At_End_Of_Declarations): Improve error message.
(Build_Predicate_Functions): Do not build their bodies in a
generic unit.
(Is_Derived_Type_With_Constraint): New subprogram to uncover and
reject aspect specificationss on types that appear after the
type is frozen.
* sem_ch13.ads (Push_Scope_And_Install_Discriminants,
Uninstall_Discriminants_And_Pop_Scope): Remove.
* sem_ch6.adb, sem_ch6.ads (Fully_Conformant_Expressions):
Additional parameter to improve error message on illegal aspect
specifications whose resolution differ between aspect
specification and freeze point.
* freeze.adb: Remove references to
Install/Uninstall_Discriminants.
gcc/testsuite/
* gnat.dg/aspect1.adb, gnat.dg/aspect1_horizontal.adb,
gnat.dg/aspect1_horizontal.ads, gnat.dg/aspect1_vectors_2d.ads:
New testcase.
* gnat.dg/static_pred1.adb: Expect an error message.
From-SVN: r266980
Diffstat (limited to 'gcc/ada/sem_ch13.ads')
-rw-r--r-- | gcc/ada/sem_ch13.ads | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/gcc/ada/sem_ch13.ads b/gcc/ada/sem_ch13.ads index 3c626e8..00d7c3b 100644 --- a/gcc/ada/sem_ch13.ads +++ b/gcc/ada/sem_ch13.ads @@ -354,27 +354,10 @@ package Sem_Ch13 is -- for First, Next, and Has_Element. Optionally an Element primitive may -- also be defined. - ----------------------------------------------------------- - -- Visibility of Discriminants in Aspect Specifications -- - ----------------------------------------------------------- - - -- The discriminants of a type are visible when analyzing the aspect - -- specifications of a type declaration or protected type declaration, - -- but not when analyzing those of a subtype declaration. The following - -- routines enforce this distinction. - procedure Install_Discriminants (E : Entity_Id); -- Make visible the discriminants of type entity E - procedure Push_Scope_And_Install_Discriminants (E : Entity_Id); - -- Push scope E and makes visible the discriminants of type entity E if E - -- has discriminants and is not a subtype. - procedure Uninstall_Discriminants (E : Entity_Id); -- Remove visibility to the discriminants of type entity E - procedure Uninstall_Discriminants_And_Pop_Scope (E : Entity_Id); - -- Remove visibility to the discriminants of type entity E and pop the - -- scope stack if E has discriminants and is not a subtype. - end Sem_Ch13; |