exp_ch9.adb (Expand_N_Protected_Type_Declaration): If a protected operation has an...
authorEd Schonberg <schonberg@adacore.com>
Thu, 16 Apr 2009 09:35:38 +0000 (09:35 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 16 Apr 2009 09:35:38 +0000 (11:35 +0200)
2009-04-16  Ed Schonberg  <schonberg@adacore.com>

* exp_ch9.adb (Expand_N_Protected_Type_Declaration): If a protected
operation has an inline pragma, propagate the flag to the internal
unprotected subprogram.

From-SVN: r146156

gcc/ada/ChangeLog
gcc/ada/exp_ch9.adb

index 7c1000579f55578b8bc1b1e934ee00d464613329..6b706bd225a63e4f84c66ba9f6adf6c8fe6c6734 100644 (file)
@@ -1,3 +1,9 @@
+2009-04-16  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_ch9.adb (Expand_N_Protected_Type_Declaration): If a protected
+       operation has an inline pragma, propagate the flag to the internal
+       unprotected subprogram.
+
 2009-04-16  Doug Rupp  <rupp@adacore.com>
 
        * s-taprop-vxworks.adb, s-taprop-tru64.adb, s-taprop-mingw.adb,
index e4afe673cecb79df8aa03c2330a4a18b68460417..0284943cda0938caef2dcb87700eca28cbb1df8d 100644 (file)
@@ -7470,10 +7470,27 @@ package body Exp_Ch9 is
       E_Count      : Int;
       Object_Comp  : Node_Id;
 
+      procedure Check_Inlining (Subp : Entity_Id);
+      --  If the original operation has a pragma Inline, propagate the flag
+      --  to the internal body, for possible inlining later on. The source
+      --  operation is invisible to the back-end and is never actually called.
+
       procedure Register_Handler;
       --  For a protected operation that is an interrupt handler, add the
       --  freeze action that will register it as such.
 
+      --------------------
+      -- Check_Inlining --
+      --------------------
+
+      procedure Check_Inlining (Subp : Entity_Id) is
+      begin
+         if Is_Inlined (Subp) then
+            Set_Is_Inlined (Protected_Body_Subprogram (Subp));
+            Set_Is_Inlined (Subp, False);
+         end if;
+      end Check_Inlining;
+
       ----------------------
       -- Register_Handler --
       ----------------------
@@ -7722,7 +7739,7 @@ package body Exp_Ch9 is
                Set_Protected_Body_Subprogram
                  (Defining_Unit_Name (Specification (Priv)),
                   Defining_Unit_Name (Specification (Sub)));
-
+               Check_Inlining (Defining_Unit_Name (Specification (Priv)));
                Current_Node := Sub;
 
                Sub :=
@@ -7809,6 +7826,7 @@ package body Exp_Ch9 is
             Set_Protected_Body_Subprogram
               (Defining_Unit_Name (Specification (Comp)),
                Defining_Unit_Name (Specification (Sub)));
+               Check_Inlining (Defining_Unit_Name (Specification (Comp)));
 
             --  Make the protected version of the subprogram available for
             --  expansion of external calls.