From b619c88ebaa63de53de21684bdd4555598f68d49 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 25 Apr 2017 10:37:09 +0200 Subject: [multiple changes] 2017-04-25 Hristian Kirtchev * elists.ads, elists.adb (Prepend_Unique_Elmt): New routine. * exp_ch3.adb (Freeze_Type): Signal the DIC body is created for the purposes of freezing. * exp_util.adb Update the documentation and structure of the type map used in class-wide semantics of assertion expressions. (Add_Inherited_Tagged_DIC): There is really no need to preanalyze and resolve the triaged expression because all substitutions refer to the proper entities. Update the replacement of references. (Build_DIC_Procedure_Body): Add formal parameter For_Freeze. Add local variable Build_Body. Inherited DIC pragmas are now only processed when freezing occurs. Build a body only when one is needed. (Entity_Hash): Removed. (Map_Types): New routine. (Replace_Object_And_Primitive_References): Removed. (Replace_References): New routine. (Replace_Type_References): Moved to the library level of Exp_Util. (Type_Map_Hash): New routine. (Update_Primitives_Mapping): Update the mapping call. (Update_Primitives_Mapping_Of_Types): Removed. * exp_util.ads (Build_DIC_Procedure_Body): Add formal parameter For_Freeze and update the comment on usage. (Map_Types): New routine. (Replace_References): New routine. (Replace_Type_References): Moved to the library level of Exp_Util. (Update_Primitives_Mapping_Of_Types): Removed. * sem_ch7.adb (Preserve_Full_Attributes): Propagate the DIC properties of the private type to the full view in case the full view derives from a parent type and inherits a DIC pragma. * sem_prag.adb (Analyze_Pragma): Guard against a case where a DIC pragma is placed at the top of a declarative region. 2017-04-25 Arnaud Charlet * a-tasatt.adb: Complete previous change and use an unsigned int to avoid overflow checks. 2017-04-25 Ed Schonberg * sem_attr.adb (Analyze_Attribute, case 'Access): Specialize the error message when the attribute reference is an actual in a call to a subprogram inherited from a generic formal type with unknown discriminants, which makes the subprogram and its formal parameters intrinsic (see RM 6.3.1 (8) and (13)). From-SVN: r247148 --- gcc/ada/sem_attr.adb | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'gcc/ada/sem_attr.adb') diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 40ee462..21d88d7 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -10532,10 +10532,33 @@ package body Sem_Attr is if Convention (Designated_Type (Btyp)) /= Convention (Entity (P)) then - Error_Msg_FE - ("subprogram & has wrong convention", P, Entity (P)); - Error_Msg_Sloc := Sloc (Btyp); - Error_Msg_FE ("\does not match & declared#", P, Btyp); + -- The rule in 6.3.1 (8) deserves a special error + -- message. + + if Convention (Btyp) = Convention_Intrinsic + and then Nkind (Parent (N)) = N_Procedure_Call_Statement + and then Is_Entity_Name (Name (Parent (N))) + and then Inside_A_Generic + then + declare + Subp : constant Entity_Id := + Entity (Name (Parent (N))); + begin + if Convention (Subp) = Convention_Intrinsic then + Error_Msg_FE ("subprogram and its formal " + & "parameters have convention Intrinsic", + Parent (N), Subp); + Error_Msg_N + ("actual cannot be access attribute", N); + end if; + end; + + else + Error_Msg_FE + ("subprogram & has wrong convention", P, Entity (P)); + Error_Msg_Sloc := Sloc (Btyp); + Error_Msg_FE ("\does not match & declared#", P, Btyp); + end if; if not Is_Itype (Btyp) and then not Has_Convention_Pragma (Btyp) -- cgit v1.1