]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 6 Feb 2014 10:19:06 +0000 (11:19 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 6 Feb 2014 10:19:06 +0000 (11:19 +0100)
2014-02-06  Eric Botcazou  <ebotcazou@adacore.com>

* gnat_rm.texi: Small wording tweak.

2014-02-06  Pascal Obry  <obry@adacore.com>

* prj-attr.adb, projects.texi, snames.ads-tmpl: Add Included_Patterns
and Included_Artifact_Patterns attribute definitions.

2014-02-06  Yannick Moy  <moy@adacore.com>

* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Set
SPARK_Mode pragma component for all subprograms, including stubs.

2014-02-06  Hristian Kirtchev  <kirtchev@adacore.com>

* sem_ch10.adb (Analyze_Package_Body_Stub): Maintain
the configuration options of the enclosing context in a
stack-like fasion.
(Analyze_Subprogram_Body_Stub): Maintain the
configuration options of the enclosing context in a stack-like
fashion.

2014-02-06  Robert Dewar  <dewar@adacore.com>

* debug.adb: -gnatd.u sets Modify_Tree_For C
* exp_ch4.adb (Expand_N_Op_Rotate_Left): Expand out
if Modify_Tree_For_C (Expand_N_Op_Rotate_Right): ditto.
(Expand_N_Op_Arithmetic_Right_Shift): ditto.
* exp_intr.adb (Expand_Shift): Call expander so we do
Modify_Tree_For_C expansions.
* gnat1drv.adb (Adjust_Global_Switches): Set Modify_Tree_For_C
if -gnatd.u set.

2014-02-06  Fedor Rybin  <frybin@adacore.com>

* prj-proc.ads (Tree_Loaded_Callback): new type Callback used
after the phase 1 of the processing of each aggregated project
to get access to project trees of aggregated projects.
(Process_Project_Tree_Phase_1): new parameter On_New_Tree_Loaded
If specified, On_New_Tree_Loaded is called after each aggregated
project has been processed succesfully.
(Process): new parameter On_New_Tree_Loaded.
* prj-proc.adb (Process_Aggregated_Projects): On_New_Tree_Loaded
callback added after processing of each aggregated project.
(Recursive_Process): new parameter On_New_Tree_Loaded.
(Process): new parameter On_New_Tree_Loaded.
(Process_Project_Tree_Phase_1): new parameter On_New_Tree_Loaded.
* prj-conf.ads (Parse_Project_And_Apply_Config): new parameter
On_New_Tree_Loaded.
* prj-conf.adb (Parse_Project_And_Apply_Config): new parameter
On_New_Tree_Loaded.

2014-02-06  Bob Duff  <duff@adacore.com>

* gnat_ugn.texi: Implement --insert-blank-lines and
--preserve-blank-lines switches.

From-SVN: r207545

16 files changed:
gcc/ada/ChangeLog
gcc/ada/debug.adb
gcc/ada/exp_ch4.adb
gcc/ada/exp_intr.adb
gcc/ada/gnat1drv.adb
gcc/ada/gnat_rm.texi
gcc/ada/gnat_ugn.texi
gcc/ada/prj-attr.adb
gcc/ada/prj-conf.adb
gcc/ada/prj-conf.ads
gcc/ada/prj-proc.adb
gcc/ada/prj-proc.ads
gcc/ada/projects.texi
gcc/ada/sem_ch10.adb
gcc/ada/sem_ch6.adb
gcc/ada/snames.ads-tmpl

index 8e027575e76bef66c10544059493da5e83d9e732..70bd9fc908f409328994eb505060d5a8697a4481 100644 (file)
@@ -1,3 +1,61 @@
+2014-02-06  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat_rm.texi: Small wording tweak.
+
+2014-02-06  Pascal Obry  <obry@adacore.com>
+
+       * prj-attr.adb, projects.texi, snames.ads-tmpl: Add Included_Patterns
+       and Included_Artifact_Patterns attribute definitions.
+
+2014-02-06  Yannick Moy  <moy@adacore.com>
+
+       * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Set
+       SPARK_Mode pragma component for all subprograms, including stubs.
+
+2014-02-06  Hristian Kirtchev  <kirtchev@adacore.com>
+
+       * sem_ch10.adb (Analyze_Package_Body_Stub): Maintain
+       the configuration options of the enclosing context in a
+       stack-like fasion.
+       (Analyze_Subprogram_Body_Stub): Maintain the
+       configuration options of the enclosing context in a stack-like
+       fashion.
+
+2014-02-06  Robert Dewar  <dewar@adacore.com>
+
+       * debug.adb: -gnatd.u sets Modify_Tree_For C
+       * exp_ch4.adb (Expand_N_Op_Rotate_Left): Expand out
+       if Modify_Tree_For_C (Expand_N_Op_Rotate_Right): ditto.
+       (Expand_N_Op_Arithmetic_Right_Shift): ditto.
+       * exp_intr.adb (Expand_Shift): Call expander so we do
+       Modify_Tree_For_C expansions.
+       * gnat1drv.adb (Adjust_Global_Switches): Set Modify_Tree_For_C
+       if -gnatd.u set.
+
+2014-02-06  Fedor Rybin  <frybin@adacore.com>
+
+       * prj-proc.ads (Tree_Loaded_Callback): new type Callback used
+       after the phase 1 of the processing of each aggregated project
+       to get access to project trees of aggregated projects.
+       (Process_Project_Tree_Phase_1): new parameter On_New_Tree_Loaded
+       If specified, On_New_Tree_Loaded is called after each aggregated
+       project has been processed succesfully.
+       (Process): new parameter On_New_Tree_Loaded.
+       * prj-proc.adb (Process_Aggregated_Projects): On_New_Tree_Loaded
+       callback added after processing of each aggregated project.
+       (Recursive_Process): new parameter On_New_Tree_Loaded.
+       (Process): new parameter On_New_Tree_Loaded.
+       (Process_Project_Tree_Phase_1): new parameter On_New_Tree_Loaded.
+       * prj-conf.ads (Parse_Project_And_Apply_Config): new parameter
+       On_New_Tree_Loaded.
+       * prj-conf.adb (Parse_Project_And_Apply_Config): new parameter
+       On_New_Tree_Loaded.
+
+2014-02-06  Bob Duff  <duff@adacore.com>
+
+       * gnat_ugn.texi: Implement --insert-blank-lines and
+       --preserve-blank-lines switches.
+
 2014-02-06  Sergey Rybin  <rybin@adacore.com frybin>
 
        * gnat_ugn.texi, vms_data.ads: Add documentation of -j option for
index 251da34e6aff6de6d7d1f33e84376a3c728c060a..11237e23dc9e5148b81cd016bd36bb36575f91b6 100644 (file)
@@ -111,7 +111,7 @@ package body Debug is
    --  d.r  Enable OK_To_Reorder_Components in non-variant records
    --  d.s  Disable expansion of slice move, use memmove
    --  d.t  Disable static allocation of library level dispatch tables
-   --  d.u
+   --  d.u  Enable Modify_Tree_For_C (update tree for c)
    --  d.v  Enable OK_To_Reorder_Components in variant records
    --  d.w  Do not check for infinite loops
    --  d.x  No exception handlers
@@ -575,6 +575,9 @@ package body Debug is
    --       previous dynamic construction of tables. It is there as a possible
    --       work around if we run into trouble with the new implementation.
 
+   --  d.u  Sets Modify_Tree_For_C mode in which tree is modified to make it
+   --       easier to generate code using a C compiler.
+
    --  d.v  Forces the flag OK_To_Reorder_Components to be set in all record
    --       base types that have at least one discriminant (v = variant).
 
index d0ee791d513683cdc671573ccd57b9aff3ba7b24..d45d5098b4599dcc0f0f606f3849caf2769a0140 100644 (file)
@@ -8756,6 +8756,49 @@ package body Exp_Ch4 is
    procedure Expand_N_Op_Rotate_Left (N : Node_Id) is
    begin
       Binary_Op_Validity_Checks (N);
+
+      --  If we are in Modify_Tree_For_C mode, there is no rotate left in C,
+      --  so we rewrite in terms of logical shifts
+
+      --    Shift_Left (Num, Bits) or Shift_Right (num, Esize - Bits)
+
+      --  where Bits is the shift count mod Esize (the mod operation here
+      --  deals with ludicrous large shift counts, which are apparently OK).
+
+      --  What about non-binary modulus ???
+
+      declare
+         Loc : constant Source_Ptr := Sloc (N);
+         Rtp : constant Entity_Id  := Etype (Right_Opnd (N));
+         Typ : constant Entity_Id  := Etype (N);
+
+      begin
+         if Modify_Tree_For_C then
+            Rewrite (Right_Opnd (N),
+              Make_Op_Rem (Loc,
+                Left_Opnd  => Relocate_Node (Right_Opnd (N)),
+                Right_Opnd => Make_Integer_Literal (Loc, Esize (Typ))));
+
+            Analyze_And_Resolve (Right_Opnd (N), Rtp);
+
+            Rewrite (N,
+              Make_Op_Or (Loc,
+                Left_Opnd =>
+                  Make_Op_Shift_Left (Loc,
+                    Left_Opnd  => Left_Opnd (N),
+                    Right_Opnd => Right_Opnd (N)),
+                Right_Opnd =>
+                  Make_Op_Shift_Right (Loc,
+                    Left_Opnd  => Duplicate_Subexpr_No_Checks (Left_Opnd (N)),
+                    Right_Opnd =>
+                      Make_Op_Subtract (Loc,
+                        Left_Opnd  => Make_Integer_Literal (Loc, Esize (Typ)),
+                        Right_Opnd =>
+                          Duplicate_Subexpr_No_Checks (Right_Opnd (N))))));
+
+            Analyze_And_Resolve (N, Typ);
+         end if;
+      end;
    end Expand_N_Op_Rotate_Left;
 
    ------------------------------
@@ -8765,6 +8808,49 @@ package body Exp_Ch4 is
    procedure Expand_N_Op_Rotate_Right (N : Node_Id) is
    begin
       Binary_Op_Validity_Checks (N);
+
+      --  If we are in Modify_Tree_For_C mode, there is no rotate right in C,
+      --  so we rewrite in terms of logical shifts
+
+      --    Shift_Right (Num, Bits) or Shift_Left (num, Esize - Bits)
+
+      --  where Bits is the shift count mod Esize (the mod operation here
+      --  deals with ludicrous large shift counts, which are apparently OK).
+
+      --  What about non-binary modulus ???
+
+      declare
+         Loc : constant Source_Ptr := Sloc (N);
+         Rtp : constant Entity_Id  := Etype (Right_Opnd (N));
+         Typ : constant Entity_Id  := Etype (N);
+
+      begin
+         Rewrite (Right_Opnd (N),
+           Make_Op_Rem (Loc,
+             Left_Opnd  => Relocate_Node (Right_Opnd (N)),
+             Right_Opnd => Make_Integer_Literal (Loc, Esize (Typ))));
+
+         Analyze_And_Resolve (Right_Opnd (N), Rtp);
+
+         if Modify_Tree_For_C then
+            Rewrite (N,
+              Make_Op_Or (Loc,
+                Left_Opnd =>
+                  Make_Op_Shift_Right (Loc,
+                    Left_Opnd  => Left_Opnd (N),
+                    Right_Opnd => Right_Opnd (N)),
+                Right_Opnd =>
+                  Make_Op_Shift_Left (Loc,
+                    Left_Opnd  => Duplicate_Subexpr_No_Checks (Left_Opnd (N)),
+                    Right_Opnd =>
+                      Make_Op_Subtract (Loc,
+                        Left_Opnd  => Make_Integer_Literal (Loc, Esize (Typ)),
+                        Right_Opnd =>
+                          Duplicate_Subexpr_No_Checks (Right_Opnd (N))))));
+
+            Analyze_And_Resolve (N, Typ);
+         end if;
+      end;
    end Expand_N_Op_Rotate_Right;
 
    ----------------------------
@@ -8792,6 +8878,80 @@ package body Exp_Ch4 is
    procedure Expand_N_Op_Shift_Right_Arithmetic (N : Node_Id) is
    begin
       Binary_Op_Validity_Checks (N);
+
+      --  If we are in Modify_Tree_For_C mode, there is no shift right
+      --  arithmetic in C, so we rewrite in terms of logical shifts.
+
+      --    Shift_Right (Num, Bits) or
+      --      (if Num >= Sign
+      --       then not (Shift_Right (Mask, bits))
+      --       else 0)
+
+      --  Here Mask is all 1 bits (2**size - 1), and Sign is 2**(size - 1)
+
+      --  Note: in almost all C compilers it would work to just shift a
+      --  signed integer right, but it's undefined and we cannot rely on it.
+
+      --  What about non-binary modulus ???
+
+      declare
+         Loc   : constant Source_Ptr := Sloc (N);
+         Typ   : constant Entity_Id  := Etype (N);
+         Sign  : constant Uint       := 2 ** (Esize (Typ) - 1);
+         Mask  : constant Uint       := (2 ** Esize (Typ)) - 1;
+         Left  : constant Node_Id    := Left_Opnd (N);
+         Right : constant Node_Id    := Right_Opnd (N);
+         Maskx : Node_Id;
+
+      begin
+         if Modify_Tree_For_C then
+
+            --  Here if not (Shift_Right (Mask, bits)) can be computed at
+            --  compile time as a single constant.
+
+            if Compile_Time_Known_Value (Right) then
+               declare
+                  Val : constant Uint := Expr_Value (Right);
+
+               begin
+                  if Val >= Esize (Typ) then
+                     Maskx := Make_Integer_Literal (Loc, Mask);
+
+                  else
+                     Maskx :=
+                       Make_Integer_Literal (Loc,
+                         Intval => Mask - (Mask / (2 ** Expr_Value (Right))));
+                  end if;
+               end;
+
+            else
+               Maskx :=
+                 Make_Op_Not (Loc,
+                   Right_Opnd =>
+                     Make_Op_Shift_Right (Loc,
+                       Left_Opnd  => Make_Integer_Literal (Loc, Mask),
+                       Right_Opnd => Duplicate_Subexpr_No_Checks (Right)));
+            end if;
+
+            --  Now do the rewrite
+
+            Rewrite (N,
+              Make_Op_Or (Loc,
+                Left_Opnd =>
+                  Make_Op_Shift_Right (Loc,
+                    Left_Opnd  => Left,
+                    Right_Opnd => Right),
+                Right_Opnd =>
+                  Make_If_Expression (Loc,
+                    Expressions => New_List (
+                      Make_Op_Ge (Loc,
+                        Left_Opnd  => Duplicate_Subexpr_No_Checks (Left),
+                        Right_Opnd => Make_Integer_Literal (Loc, Sign)),
+                      Maskx,
+                      Make_Integer_Literal (Loc, 0)))));
+            Analyze_And_Resolve (N, Typ);
+         end if;
+      end;
    end Expand_N_Op_Shift_Right_Arithmetic;
 
    --------------------------
index 6f9df3883627a8d5cefe1cabd60c4c4d25c426ad..fa0ced2f08ead9d3392d3a45cb504c6974e13587 100644 (file)
@@ -27,6 +27,7 @@ with Atree;    use Atree;
 with Checks;   use Checks;
 with Einfo;    use Einfo;
 with Elists;   use Elists;
+with Expander; use Expander;
 with Exp_Atag; use Exp_Atag;
 with Exp_Ch4;  use Exp_Ch4;
 with Exp_Ch7;  use Exp_Ch7;
@@ -643,7 +644,7 @@ package body Exp_Intr is
 
    --  As a result, whenever a shift is used in the source program, it will
    --  remain as a call until converted by this routine to the operator node
-   --  form which Gigi is expecting to see.
+   --  form which the back end is expecting to see.
 
    --  Note: it is possible for the expander to generate shift operator nodes
    --  directly, which will be analyzed in the normal manner by calling Analyze
@@ -681,8 +682,15 @@ package body Exp_Intr is
          Rewrite (N, Snode);
          Set_Analyzed (N);
 
-      else
+         --  However, we do call the expander, so that the expansion for
+         --  rotates and shift_right_arithmetic happens if Modify_Tree_For_C
+         --  is set.
+
+         if Expander_Active then
+            Expand (N);
+         end if;
 
+      else
          --  If the context type is not the type of the operator, it is an
          --  inherited operator for a derived type. Wrap the node in a
          --  conversion so that it is type-consistent for possible further
index cfa89b1d23c20a413c56815c8e1254585eac3934..d6df2a0eeb3797e867ff2201e104aba281e962a6 100644 (file)
@@ -117,9 +117,9 @@ procedure Gnat1drv is
          Relaxed_RM_Semantics := True;
       end if;
 
-      --  -gnatd.V enables special C expansion mode
+      --  -gnatd.V or -gnatd.u enables special C expansion mode
 
-      if Debug_Flag_Dot_VV then
+      if Debug_Flag_Dot_VV or Debug_Flag_Dot_U then
          Modify_Tree_For_C := True;
       end if;
 
index cc68e26c930a405ab508bb53ec5ca675425d7835..b7c97ac7c413a31e1d15d6e505c15293416235d4 100644 (file)
@@ -4849,7 +4849,7 @@ whose length depends on a discriminant), has a pragma Pack, then it is not
 in general possible to set the alignment of such a record to one, so the
 pragma is ignored in this case (with a warning).
 
-Specifying SPACE also disables individual alignment promotions for objects,
+Specifying SPACE also disables alignment promotions for standalone objects,
 which occur when the compiler increases the alignment of a specific object
 without changing the alignment of its type.
 
index 762528cc82b6b59bb2bff763f29726ec02ff5bd3..bbe9900c5d2bf8206424151dbdf90e1d55b2cc10 100644 (file)
@@ -14351,6 +14351,16 @@ Start each USE clause in a context clause from a separate line.
 Use a separate line for a loop or block statement name, but do not use an extra
 indentation level for the statement itself.
 
+@cindex @option{^--insert-blank-lines^/INSERT_BLANK_LINES^} (@command{gnatpp})
+@item ^--insert-blank-lines^/INSERT_BLANK_LINES^
+Insert blank lines where appropriate (between bodies and other large
+constructs).
+
+@cindex @option{^--preserve-blank-lines^/PRESERVE_BLANK_LINES^} (@command{gnatpp})
+@item ^--preserve-blank-lines^/PRESERVE_BLANK_LINES^
+Preserve blank lines in the input. By default, gnatpp will squeeze
+multiple blank lines down to one.
+
 @end table
 
 @ifclear vms
index 6550436f44c2200129d85820c3ac8cf80660c4da..b46f9e7b58e3972ff6ed3fe6be70cad7226bfc0b 100644 (file)
@@ -370,6 +370,8 @@ package body Prj.Attr is
    "Premote#" &
    "SVroot_dir#" &
    "LVexcluded_patterns#" &
+   "LVincluded_patterns#" &
+   "LVincluded_artifact_patterns#" &
 
    --  package Stack
 
index dc569627b887aeaf3ded5756809849eb30df6ebc..300c33c942edc89e1454fc843fec415e041d5527 100644 (file)
@@ -1463,7 +1463,8 @@ package body Prj.Conf is
             From_Project_Node      => Config_Project_Node,
             From_Project_Node_Tree => Project_Node_Tree,
             Env                    => Env,
-            Reset_Tree             => False);
+            Reset_Tree             => False,
+            On_New_Tree_Loaded     => null);
       end if;
 
       if Config_Project_Node = Empty_Node
@@ -1575,7 +1576,8 @@ package body Prj.Conf is
       Target_Name                : String := "";
       Normalized_Hostname        : String;
       On_Load_Config             : Config_File_Hook := null;
-      Implicit_Project           : Boolean := False)
+      Implicit_Project           : Boolean := False;
+      On_New_Tree_Loaded         : Prj.Proc.Tree_Loaded_Callback := null)
    is
    begin
       pragma Assert (Prj.Env.Is_Initialized (Env.Project_Path));
@@ -1617,7 +1619,8 @@ package body Prj.Conf is
          Config_File_Path           => Config_File_Path,
          Target_Name                => Target_Name,
          Normalized_Hostname        => Normalized_Hostname,
-         On_Load_Config             => On_Load_Config);
+         On_Load_Config             => On_Load_Config,
+         On_New_Tree_Loaded         => On_New_Tree_Loaded);
    end Parse_Project_And_Apply_Config;
 
    --------------------------------------
@@ -1639,7 +1642,8 @@ package body Prj.Conf is
       Target_Name                : String := "";
       Normalized_Hostname        : String;
       On_Load_Config             : Config_File_Hook := null;
-      Reset_Tree                 : Boolean := True)
+      Reset_Tree                 : Boolean := True;
+      On_New_Tree_Loaded         : Prj.Proc.Tree_Loaded_Callback := null)
    is
       Shared              : constant Shared_Project_Tree_Data_Access :=
                               Project_Tree.Shared;
@@ -1695,7 +1699,8 @@ package body Prj.Conf is
          From_Project_Node      => User_Project_Node,
          From_Project_Node_Tree => Project_Node_Tree,
          Env                    => Env,
-         Reset_Tree             => Reset_Tree);
+         Reset_Tree             => Reset_Tree,
+         On_New_Tree_Loaded     => On_New_Tree_Loaded);
 
       if not Success then
          Main_Project := No_Project;
index 467d9741e03c47c2338273d0d391eec24b5f9e3a..70382c3da839ffd782ca6cab3254722e7006032d 100644 (file)
@@ -26,6 +26,7 @@
 --  The following package manipulates the configuration files
 
 with Prj.Tree;
+with Prj.Proc;
 
 package Prj.Conf is
 
@@ -49,20 +50,21 @@ package Prj.Conf is
    procedure Parse_Project_And_Apply_Config
      (Main_Project               : out Prj.Project_Id;
       User_Project_Node          : out Prj.Tree.Project_Node_Id;
-      Config_File_Name           : String := "";
+      Config_File_Name           : String                        := "";
       Autoconf_Specified         : Boolean;
       Project_File_Name          : String;
       Project_Tree               : Prj.Project_Tree_Ref;
       Project_Node_Tree          : Prj.Tree.Project_Node_Tree_Ref;
       Env                        : in out Prj.Tree.Environment;
       Packages_To_Check          : String_List_Access;
-      Allow_Automatic_Generation : Boolean := True;
+      Allow_Automatic_Generation : Boolean                       := True;
       Automatically_Generated    : out Boolean;
       Config_File_Path           : out String_Access;
-      Target_Name                : String := "";
+      Target_Name                : String                        := "";
       Normalized_Hostname        : String;
-      On_Load_Config             : Config_File_Hook := null;
-      Implicit_Project           : Boolean := False);
+      On_Load_Config             : Config_File_Hook              := null;
+      Implicit_Project           : Boolean                       := False;
+      On_New_Tree_Loaded         : Prj.Proc.Tree_Loaded_Callback := null);
    --  Find the main configuration project and parse the project tree rooted at
    --  this configuration project.
    --
@@ -103,23 +105,27 @@ package Prj.Conf is
    --  invoked without a project file and is using an implicit project file
    --  that is virtually in the current working directory, but is physically
    --  in another directory.
+   --
+   --  If specified, On_New_Tree_Loaded is called after each aggregated project
+   --  has been processed succesfully.
 
    procedure Process_Project_And_Apply_Config
      (Main_Project               : out Prj.Project_Id;
       User_Project_Node          : Prj.Tree.Project_Node_Id;
-      Config_File_Name           : String := "";
+      Config_File_Name           : String                       := "";
       Autoconf_Specified         : Boolean;
       Project_Tree               : Prj.Project_Tree_Ref;
       Project_Node_Tree          : Prj.Tree.Project_Node_Tree_Ref;
       Env                        : in out Prj.Tree.Environment;
       Packages_To_Check          : String_List_Access;
-      Allow_Automatic_Generation : Boolean := True;
+      Allow_Automatic_Generation : Boolean                      := True;
       Automatically_Generated    : out Boolean;
       Config_File_Path           : out String_Access;
-      Target_Name                : String := "";
+      Target_Name                : String                       := "";
       Normalized_Hostname        : String;
-      On_Load_Config             : Config_File_Hook := null;
-      Reset_Tree                 : Boolean := True);
+      On_Load_Config             : Config_File_Hook             := null;
+      Reset_Tree                 : Boolean                      := True;
+      On_New_Tree_Loaded         : Prj.Proc.Tree_Loaded_Callback := null);
    --  Same as above, except the project must already have been parsed through
    --  Prj.Part.Parse, and only the processing of the project and the
    --  configuration is done at this level.
@@ -142,15 +148,15 @@ package Prj.Conf is
       Project_Node_Tree          : Prj.Tree.Project_Node_Tree_Ref;
       Env                        : in out Prj.Tree.Environment;
       Allow_Automatic_Generation : Boolean;
-      Config_File_Name           : String := "";
+      Config_File_Name           : String             := "";
       Autoconf_Specified         : Boolean;
-      Target_Name                : String := "";
+      Target_Name                : String             := "";
       Normalized_Hostname        : String;
       Packages_To_Check          : String_List_Access := null;
       Config                     : out Prj.Project_Id;
       Config_File_Path           : out String_Access;
       Automatically_Generated    : out Boolean;
-      On_Load_Config             : Config_File_Hook := null);
+      On_Load_Config             : Config_File_Hook   := null);
    --  Compute the name of the configuration file that should be used. If no
    --  default configuration file is found, a new one will be automatically
    --  generated if Allow_Automatic_Generation is true. This configuration
index 43a0f87571b8ca67d8880cb434c66cb72b9632b9..b7a34b39598e953f537541329be56b0cf98825a6 100644 (file)
@@ -153,7 +153,8 @@ package body Prj.Proc is
       From_Project_Node_Tree : Project_Node_Tree_Ref;
       Env                    : in out Prj.Tree.Environment;
       Extended_By            : Project_Id;
-      From_Encapsulated_Lib  : Boolean);
+      From_Encapsulated_Lib  : Boolean;
+      On_New_Tree_Loaded     : Tree_Loaded_Callback := null);
    --  Process project with node From_Project_Node in the tree. Do nothing if
    --  From_Project_Node is Empty_Node. If project has already been processed,
    --  simply return its project id. Otherwise create a new project id, mark it
@@ -168,6 +169,9 @@ package body Prj.Proc is
    --
    --  From_Encapsulated_Lib is true if we are parsing a project from
    --  encapsulated library dependencies.
+   --
+   --  If specified, On_New_Tree_Loaded is called after each aggregated project
+   --  has been processed succesfully.
 
    function Get_Attribute_Index
      (Tree  : Project_Node_Tree_Ref;
@@ -1360,7 +1364,8 @@ package body Prj.Proc is
       From_Project_Node      : Project_Node_Id;
       From_Project_Node_Tree : Project_Node_Tree_Ref;
       Env                    : in out Prj.Tree.Environment;
-      Reset_Tree             : Boolean := True)
+      Reset_Tree             : Boolean              := True;
+      On_New_Tree_Loaded     : Tree_Loaded_Callback := null)
    is
    begin
       Process_Project_Tree_Phase_1
@@ -1371,7 +1376,8 @@ package body Prj.Proc is
          From_Project_Node_Tree => From_Project_Node_Tree,
          Env                    => Env,
          Packages_To_Check      => Packages_To_Check,
-         Reset_Tree             => Reset_Tree);
+         Reset_Tree             => Reset_Tree,
+         On_New_Tree_Loaded     => On_New_Tree_Loaded);
 
       if Project_Qualifier_Of
            (From_Project_Node, From_Project_Node_Tree) /= Configuration
@@ -2357,7 +2363,8 @@ package body Prj.Proc is
       From_Project_Node      : Project_Node_Id;
       From_Project_Node_Tree : Project_Node_Tree_Ref;
       Env                    : in out Prj.Tree.Environment;
-      Reset_Tree             : Boolean := True)
+      Reset_Tree             : Boolean              := True;
+      On_New_Tree_Loaded     : Tree_Loaded_Callback := null)
    is
    begin
       if Reset_Tree then
@@ -2382,7 +2389,8 @@ package body Prj.Proc is
          From_Project_Node_Tree => From_Project_Node_Tree,
          Env                    => Env,
          Extended_By            => No_Project,
-         From_Encapsulated_Lib  => False);
+         From_Encapsulated_Lib  => False,
+         On_New_Tree_Loaded     => On_New_Tree_Loaded);
 
       Success :=
         Total_Errors_Detected = 0
@@ -2517,7 +2525,8 @@ package body Prj.Proc is
       From_Project_Node_Tree : Project_Node_Tree_Ref;
       Env                    : in out Prj.Tree.Environment;
       Extended_By            : Project_Id;
-      From_Encapsulated_Lib  : Boolean)
+      From_Encapsulated_Lib  : Boolean;
+      On_New_Tree_Loaded     : Tree_Loaded_Callback := null)
    is
       Shared : constant Shared_Project_Tree_Data_Access := In_Tree.Shared;
 
@@ -2577,7 +2586,8 @@ package body Prj.Proc is
                   From_Project_Node_Tree => From_Project_Node_Tree,
                   Env                    => Env,
                   Extended_By            => No_Project,
-                  From_Encapsulated_Lib  => From_Encapsulated_Lib);
+                  From_Encapsulated_Lib  => From_Encapsulated_Lib,
+                  On_New_Tree_Loaded     => On_New_Tree_Loaded);
 
                if Imported = null then
                   Project.Imported_Projects := new Project_List_Element'
@@ -2668,7 +2678,8 @@ package body Prj.Proc is
                      From_Project_Node      => Loaded_Project,
                      From_Project_Node_Tree => Node_Tree,
                      Env                    => Child_Env,
-                     Reset_Tree             => False);
+                     Reset_Tree             => False,
+                     On_New_Tree_Loaded     => On_New_Tree_Loaded);
                else
                   --  use the same environment as the rest of the aggregated
                   --  projects, ie the one that was setup by the root aggregate
@@ -2680,7 +2691,13 @@ package body Prj.Proc is
                      From_Project_Node      => Loaded_Project,
                      From_Project_Node_Tree => Node_Tree,
                      Env                    => Env,
-                     Reset_Tree             => False);
+                     Reset_Tree             => False,
+                     On_New_Tree_Loaded     => On_New_Tree_Loaded);
+               end if;
+
+               if On_New_Tree_Loaded /= null then
+                  On_New_Tree_Loaded
+                    (Node_Tree, Tree, Loaded_Project, List.Project);
                end if;
 
             else
@@ -2912,7 +2929,8 @@ package body Prj.Proc is
                From_Project_Node_Tree => From_Project_Node_Tree,
                Env                    => Env,
                Extended_By            => Project,
-               From_Encapsulated_Lib  => From_Encapsulated_Lib);
+               From_Encapsulated_Lib  => From_Encapsulated_Lib,
+               On_New_Tree_Loaded     => On_New_Tree_Loaded);
 
             Process_Declarative_Items
               (Project                => Project,
index 72ab7eb919d695970ab7ac1d01091d415c28ce97..97d7310dda7984646676218a04b19750ed671dac 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2001-2011, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-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- --
@@ -31,6 +31,14 @@ with Prj.Tree;  use Prj.Tree;
 
 package Prj.Proc is
 
+   type Tree_Loaded_Callback is access procedure
+     (Node_Tree    : Project_Node_Tree_Ref;
+      Tree         : Project_Tree_Ref;
+      Project_Node : Project_Node_Id;
+      Project      : Project_Id);
+   --  Callback used after the phase 1 of the processing of each aggregated
+   --  project to get access to project trees of aggregated projects.
+
    procedure Process_Project_Tree_Phase_1
      (In_Tree                : Project_Tree_Ref;
       Project                : out Project_Id;
@@ -39,7 +47,8 @@ package Prj.Proc is
       From_Project_Node      : Project_Node_Id;
       From_Project_Node_Tree : Project_Node_Tree_Ref;
       Env                    : in out Prj.Tree.Environment;
-      Reset_Tree             : Boolean := True);
+      Reset_Tree             : Boolean              := True;
+      On_New_Tree_Loaded     : Tree_Loaded_Callback := null);
    --  Process a project tree (ie the direct resulting of parsing a .gpr file)
    --  based on the current external references.
    --
@@ -51,6 +60,9 @@ package Prj.Proc is
    --
    --  When Reset_Tree is True, all the project data are removed from the
    --  project table before processing.
+   --
+   --  If specified, On_New_Tree_Loaded is called after each aggregated project
+   --  has been processed succesfully.
 
    procedure Process_Project_Tree_Phase_2
      (In_Tree                : Project_Tree_Ref;
@@ -74,7 +86,8 @@ package Prj.Proc is
       From_Project_Node      : Project_Node_Id;
       From_Project_Node_Tree : Project_Node_Tree_Ref;
       Env                    : in out Prj.Tree.Environment;
-      Reset_Tree             : Boolean := True);
+      Reset_Tree             : Boolean              := True;
+      On_New_Tree_Loaded     : Tree_Loaded_Callback := null);
    --  Performs the two phases of the processing
 
 end Prj.Proc;
index dcc108de9898f62ffa0f84023a37b8168915544f..9f9151d53bcf5eb62446a0dab0261675163d64b5 100644 (file)
@@ -4990,6 +4990,19 @@ invoking @code{gnatpp} for the source.
 
 @itemize @bullet
 
+@item @b{Included_Patterns}: list
+
+If this attribute is defined it sets the patterns to
+synchronized from the master to the slaves. It is exclusive
+with Excluded_Patterns, that is it is an error to define
+both.
+
+@item @b{Included_Artifact_Patterns}: list
+
+If this attribute is defined it sets the patterns of compilation
+artifacts to synchronized from the slaves to the build master.
+This attribute replace the default hard-coded patterns.
+
 @item @b{Excluded_Patterns}: list
 
 Set of patterns to ignore when synchronizing sources from the build
index eac99c3ac8da44646207345ad542dec1129c06b2..b72fdd33a4e07758d308224ce626b6514bd45f4b 100644 (file)
@@ -1513,8 +1513,9 @@ package body Sem_Ch10 is
    -------------------------------
 
    procedure Analyze_Package_Body_Stub (N : Node_Id) is
-      Id  : constant Entity_Id := Defining_Identifier (N);
-      Nam : Entity_Id;
+      Id   : constant Entity_Id := Defining_Identifier (N);
+      Nam  : Entity_Id;
+      Opts : Config_Switches_Type;
 
    begin
       --  The package declaration must be in the current declarative part
@@ -1531,6 +1532,11 @@ package body Sem_Ch10 is
          Error_Msg_N ("duplicate or redundant stub for package", N);
 
       else
+         --  Retain and restore the configuration options of the enclosing
+         --  context as the proper body may introduce a set of its own.
+
+         Save_Opt_Config_Switches (Opts);
+
          --  Indicate that the body of the package exists. If we are doing
          --  only semantic analysis, the stub stands for the body. If we are
          --  generating code, the existence of the body will be confirmed
@@ -1541,6 +1547,8 @@ package body Sem_Ch10 is
          Set_Corresponding_Spec_Of_Stub (N, Nam);
          Generate_Reference (Nam, Id, 'b');
          Analyze_Proper_Body (N, Nam);
+
+         Restore_Opt_Config_Switches (Opts);
       end if;
    end Analyze_Package_Body_Stub;
 
@@ -1913,6 +1921,7 @@ package body Sem_Ch10 is
 
    procedure Analyze_Subprogram_Body_Stub (N : Node_Id) is
       Decl : Node_Id;
+      Opts : Config_Switches_Type;
 
    begin
       Check_Stub_Level (N);
@@ -1937,11 +1946,18 @@ package body Sem_Ch10 is
          end loop;
       end if;
 
+      --  Retain and restore the configuration options of the enclosing context
+      --  as the proper body may introduce a set of its own.
+
+      Save_Opt_Config_Switches (Opts);
+
       --  Treat stub as a body, which checks conformance if there is a previous
       --  declaration, or else introduces entity and its signature.
 
       Analyze_Subprogram_Body (N);
       Analyze_Proper_Body (N, Empty);
+
+      Restore_Opt_Config_Switches (Opts);
    end Analyze_Subprogram_Body_Stub;
 
    ---------------------
index 07117d6dd34084f2044badd8ba3d338451e37d7b..853dfc6654d364fe4fcd344b8967ec8a135aa260 100644 (file)
@@ -3000,11 +3000,6 @@ package body Sem_Ch6 is
 
             Push_Scope (Spec_Id);
 
-            --  Set SPARK_Mode from context
-
-            Set_SPARK_Pragma (Body_Id, SPARK_Mode_Pragma);
-            Set_SPARK_Pragma_Inherited (Body_Id, True);
-
             --  Make sure that the subprogram is immediately visible. For
             --  child units that have no separate spec this is indispensable.
             --  Otherwise it is safe albeit redundant.
@@ -3052,11 +3047,6 @@ package body Sem_Ch6 is
             Install_Formals (Body_Id);
 
             Push_Scope (Body_Id);
-
-            --  Set SPARK_Mode from context
-
-            Set_SPARK_Pragma (Body_Id, SPARK_Mode_Pragma);
-            Set_SPARK_Pragma_Inherited (Body_Id, True);
          end if;
 
          --  For stubs and bodies with no previous spec, generate references to
@@ -3065,6 +3055,11 @@ package body Sem_Ch6 is
          Generate_Reference_To_Formals (Body_Id);
       end if;
 
+      --  Set SPARK_Mode from context
+
+      Set_SPARK_Pragma (Body_Id, SPARK_Mode_Pragma);
+      Set_SPARK_Pragma_Inherited (Body_Id, True);
+
       --  If the return type is an anonymous access type whose designated type
       --  is the limited view of a class-wide type and the non-limited view is
       --  available, update the return type accordingly.
index ecbf42cb0995855fc1cc4d0943d1d85fe0084e99..69f66472d4d7e7e355010c1d9ee689c7313d3755 100644 (file)
@@ -1278,6 +1278,8 @@ package Snames is
    Name_Implementation                     : constant Name_Id := N + $;
    Name_Implementation_Exceptions          : constant Name_Id := N + $;
    Name_Implementation_Suffix              : constant Name_Id := N + $;
+   Name_Included_Artifact_Patterns         : constant Name_Id := N + $;
+   Name_Included_Patterns                  : constant Name_Id := N + $;
    Name_Include_Switches                   : constant Name_Id := N + $;
    Name_Include_Path                       : constant Name_Id := N + $;
    Name_Include_Path_File                  : constant Name_Id := N + $;