[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 6 Feb 2013 10:08:09 +0000 (11:08 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 6 Feb 2013 10:08:09 +0000 (11:08 +0100)
2013-02-06  Robert Dewar  <dewar@adacore.com>

* s-dim.ads, clean.adb: Minor reformatting.

2013-02-06  Javier Miranda  <miranda@adacore.com>

* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Undo previous patch.
(Can_Split_Unconstrained_Function): Only split the inlined function if
the compiler generates the code of its body.

From-SVN: r195789

gcc/ada/ChangeLog
gcc/ada/clean.adb
gcc/ada/s-dim.ads
gcc/ada/sem_ch6.adb

index 4ab64a9e923630031221c9b1363e0c1869601540..309f7e7c4fb9d467a6df25c727cb7f406f3437bb 100644 (file)
@@ -1,3 +1,13 @@
+2013-02-06  Robert Dewar  <dewar@adacore.com>
+
+       * s-dim.ads, clean.adb: Minor reformatting.
+
+2013-02-06  Javier Miranda  <miranda@adacore.com>
+
+       * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Undo previous patch.
+       (Can_Split_Unconstrained_Function): Only split the inlined function if
+       the compiler generates the code of its body.
+
 2013-02-06  Robert Dewar  <dewar@adacore.com>
 
        * exp_prag.adb, sem_ch3.adb, exp_attr.adb, sem_prag.adb, sem_ch6.adb,
index e2d2446e500f1f53313ea90eda80b9457ff46cb1..9d9c4d457df10f0ad71e57321b6ecd201ef67ee2 100644 (file)
@@ -1261,10 +1261,8 @@ package body Clean is
                     or else Host_Full_Name'Length = 0
                   then
                      Success := False;
-
                   else
-                     Delete_File
-                       (Host_Full_Name.all & ";*", Success);
+                     Delete_File (Host_Full_Name.all & ";*", Success);
                   end if;
                end;
 
index 9896de8dd79abb165b512939f3f600f4a6e18be8..f4b10030a1f575a2a1daf672220bb797eeb2b797 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---             Copyright (C) 2012, Free Software Foundation, Inc.           --
+--          Copyright (C) 2012-2013, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
index b6db1ce6be6261075f3590b8fff1064d6322c802..728e4a7a8d7bef3beb1cc49d02982aef404edbea 100644 (file)
@@ -2909,10 +2909,6 @@ package body Sem_Ch6 is
         and then Serious_Errors_Detected = 0
         and then Present (Spec_Id)
         and then Has_Pragma_Inline (Spec_Id)
-
-        --  This test needs commenting ???
-
-        and then In_Extended_Main_Code_Unit (N)
       then
          Check_And_Build_Body_To_Inline (N, Spec_Id, Body_Id);
       end if;
@@ -4268,9 +4264,9 @@ package body Sem_Ch6 is
       --  This body is subsequently used for inline expansions at call sites.
 
       function Can_Split_Unconstrained_Function (N : Node_Id) return Boolean;
-      --  Return true if the function body N has no local declarations and its
-      --  unique statement is a single extended return statement with a handled
-      --  statements sequence.
+      --  Return true if we generate code for the function body N, the function
+      --  body N has no local declarations and its unique statement is a single
+      --  extended return statement with a handled statements sequence.
 
       function Check_Body_To_Inline
         (N    : Node_Id;
@@ -5005,7 +5001,13 @@ package body Sem_Ch6 is
             end loop;
          end if;
 
-         return Present (Ret_Node)
+         --  We only split the inlined function when we are generating the code
+         --  of its body; otherwise we leave duplicated split subprograms in
+         --  the tree which (if referenced) generate wrong references at link
+         --  time.
+
+         return In_Extended_Main_Code_Unit (N)
+           and then Present (Ret_Node)
            and then Nkind (Ret_Node) = N_Extended_Return_Statement
            and then No (Next (Ret_Node))
            and then Present (Handled_Statement_Sequence (Ret_Node));