[Ada] Set convention and inlined flag on default null procedure
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 23 Jan 2020 20:52:19 +0000 (21:52 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 4 Jun 2020 09:11:05 +0000 (05:11 -0400)
2020-06-04  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* sem_attr.adb (Resolve_Attribute) <Access>: Do not generate
the secondary message about a missing pragma if the convention
of the prefix is Intrinsic.
* sem_ch12.adb (Instantiate_Formal_Subprogram): Only set the
Convention and the Is_Inlined flag on a null procedure.

gcc/ada/sem_attr.adb
gcc/ada/sem_ch12.adb

index 07f0117878671dd1e8ec9d20c6533356cf36d3bd..005add8c59a5efb4174aac22a359d91b25834a80 100644 (file)
@@ -10678,6 +10678,7 @@ package body Sem_Attr is
 
                      if not Is_Itype (Btyp)
                        and then not Has_Convention_Pragma (Btyp)
+                       and then Convention (Entity (P)) /= Convention_Intrinsic
                      then
                         Error_Msg_FE
                           ("\probable missing pragma Convention for &",
index 49a8720b4823f9a0549f48348a98e5208a64e694..10680567ee12a68091b05dddeae603ef21f11623 100644 (file)
@@ -10785,7 +10785,13 @@ package body Sem_Ch12 is
                Make_Handled_Sequence_Of_Statements (Loc,
                  Statements => New_List (Make_Null_Statement (Loc))));
 
-         Set_Is_Intrinsic_Subprogram (Defining_Unit_Name (New_Spec));
+         --  RM 12.6 (16 2/2): The procedure has convention Intrinsic
+
+         Set_Convention (Defining_Unit_Name (New_Spec), Convention_Intrinsic);
+
+         --  Eliminate the calls to it when optimization is enabled
+
+         Set_Is_Inlined (Defining_Unit_Name (New_Spec));
          return Decl_Node;
 
       else