From c90e1eca3782b667c081e08dad03aee5b4f16276 Mon Sep 17 00:00:00 2001 From: Javier Miranda Date: Fri, 13 Dec 2019 09:05:28 +0000 Subject: [PATCH] [Ada] Spurious error on precondition of subprogram instantiation 2019-12-13 Javier Miranda gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Specification): Processing a precondition, if the expression is of the form A and then B, do not generate separate Pre/Post aspects for the separate clases when we are processing a generic unit. Required to avoid reporting spurious visibility errors on the instantiations. From-SVN: r279365 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/sem_ch13.adb | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7282db42a2d..bfc9be15be2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2019-12-13 Javier Miranda + + * sem_ch13.adb (Analyze_Aspect_Specification): Processing a + precondition, if the expression is of the form A and then B, do + not generate separate Pre/Post aspects for the separate clases + when we are processing a generic unit. Required to avoid + reporting spurious visibility errors on the instantiations. + 2019-12-13 Eric Botcazou * sem_res.adb (Resolve_Actuals): Give canonical error for diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index b2b9efa2978..e266af9265d 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -3479,11 +3479,14 @@ package body Sem_Ch13 is -- don't do this in GNATprove mode, because it brings no -- benefit for proof and causes annoynace for flow analysis, -- which prefers to be as close to the original source code - -- as possible. + -- as possible. Also we don't do this when analyzing generic + -- units since it causes spurious visibility errors in the + -- preanalysis of instantiations. if not (ASIS_Mode or GNATprove_Mode) and then (Pname = Name_Postcondition or else not Class_Present (Aspect)) + and then not Inside_A_Generic then while Nkind (Expr) = N_And_Then loop Insert_After (Aspect, -- 2.30.2