[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 30 Jul 2014 15:09:05 +0000 (17:09 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 30 Jul 2014 15:09:05 +0000 (17:09 +0200)
2014-07-30  Thomas Quinot  <quinot@adacore.com>

* lib-writ.ads: document format change.

2014-07-30  Pascal Obry  <obry@adacore.com>

* prj-util.adb (For_Interface_Sources): Do not
include sources from withed externally built projects.

2014-07-30  Robert Dewar  <dewar@adacore.com>

* lib.adb: Minor reformatting.
* prj-util.adb: Minor reformatting.

2014-07-30  Ed Schonberg  <schonberg@adacore.com>

* exp_aggr.adb (Build_Record_Aggr_Code): For an array component
that depends on discriminants, and which is given by an others
clause, create an explicit subtype with the discriminant values
of the enclosing aggregate, because the backend cannot otherwise
retrieve the actual bounds of the array.

2014-07-30  Fedor Rybin  <frybin@adacore.com>

* gnat_ugn.texi: Improve gnattest documentation.

2014-07-30  Pascal Obry  <obry@adacore.com>

* makeutl.adb (Insert_Project_Sources): Properly handle sources
that are aggregated. We want to include sources not only part
of libraries but also if part of an aggregated project from an
aggregate library.
* prj.adb (For_Project_And_Aggregated_Context): Properly check
state of root project.

From-SVN: r213296

gcc/ada/ChangeLog
gcc/ada/exp_aggr.adb
gcc/ada/gnat_ugn.texi
gcc/ada/lib-writ.ads
gcc/ada/lib.adb
gcc/ada/makeutl.adb
gcc/ada/prj-util.adb
gcc/ada/prj.adb

index febc9a8283bb03e8a149fecabb5e97d5243dfe87..e884ff2a8be9b5ba5ebf7a1a2599b512c7f78ca7 100644 (file)
@@ -1,3 +1,38 @@
+2014-07-30  Thomas Quinot  <quinot@adacore.com>
+
+       * lib-writ.ads: document format change.
+
+2014-07-30  Pascal Obry  <obry@adacore.com>
+
+       * prj-util.adb (For_Interface_Sources): Do not
+       include sources from withed externally built projects.
+
+2014-07-30  Robert Dewar  <dewar@adacore.com>
+
+       * lib.adb: Minor reformatting.
+       * prj-util.adb: Minor reformatting.
+
+2014-07-30  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_aggr.adb (Build_Record_Aggr_Code): For an array component
+       that depends on discriminants, and which is given by an others
+       clause, create an explicit subtype with the discriminant values
+       of the enclosing aggregate, because the backend cannot otherwise
+       retrieve the actual bounds of the array.
+
+2014-07-30  Fedor Rybin  <frybin@adacore.com>
+
+       * gnat_ugn.texi: Improve gnattest documentation.
+
+2014-07-30  Pascal Obry  <obry@adacore.com>
+
+       * makeutl.adb (Insert_Project_Sources): Properly handle sources
+       that are aggregated. We want to include sources not only part
+       of libraries but also if part of an aggregated project from an
+       aggregate library.
+       * prj.adb (For_Project_And_Aggregated_Context): Properly check
+       state of root project.
+
 2014-07-30  Thomas Quinot  <quinot@adacore.com>
 
        * lib-load.ads: Minor reformatting.
index 5ff1421db1614d4255086a607d1974d34cc4a9bd..a43be855183036b19e96c1844fbcb5cf28c1f7c7 100644 (file)
@@ -2220,6 +2220,7 @@ package body Exp_Aggr is
                 Prefix        => New_Copy_Tree (Lhs),
                 Selector_Name => Make_Identifier (Loc, Chars (Expr))));
          end if;
+
          return OK;
       end Rewrite_Discriminant;
 
@@ -2834,6 +2835,39 @@ package body Exp_Aggr is
             else
                if Has_Discriminants (Typ) then
                   Replace_Discriminants (Expr_Q);
+
+                  --  If the component is an array type that depends on
+                  --  discriminants, and the expression is a single Others
+                  --  clause, create an explicit subtype for it because the
+                  --  backend has troubles recovering the actual bounds.
+
+                  if Nkind (Expr_Q) = N_Aggregate
+                    and then Is_Array_Type (Comp_Type)
+                    and then Present (Component_Associations (Expr_Q))
+                  then
+                     declare
+                        Assoc : constant Node_Id :=
+                           First (Component_Associations (Expr_Q));
+                        Decl  : Node_Id;
+
+                     begin
+                        if
+                          Nkind (First (Choices (Assoc))) = N_Others_Choice
+                        then
+                           Decl :=
+                             Build_Actual_Subtype_Of_Component
+                               (Comp_Type, Comp_Expr);
+
+                           --  If the component type does not in fact depend on
+                           --  discriminants, the subtype declaration is empty.
+
+                           if Present (Decl) then
+                              Append_To (L, Decl);
+                              Set_Etype (Comp_Expr, Defining_Entity (Decl));
+                           end if;
+                        end if;
+                     end;
+                  end if;
                end if;
 
                Instr :=
index 9a17ec14a1174dfeb714f04badd370f309bf41ee..dbdfb5059a9f904e7d0b128ea48f378fd556d8ce 100644 (file)
@@ -19856,9 +19856,9 @@ doesn't exist already. By default, those separate test files are located in a
 "gnattest/tests" directory that is created in the object directory of
 corresponding project file. For example, if a source file my_unit.ads in
 directory src contains a visible subprogram Proc, then the corresponding unit
-test will be found in file src/tests/my_unit-test_data-tests-proc_<code>.adb.
-<code> is a signature encoding used to differentiate test names in case of
-overloading.
+test will be found in file src/tests/my_unit-test_data-tests.adb and will be
+called Test_Proc_<code>. <code> is a signature encoding used to differentiate
+test names in case of overloading.
 
 Note that if the project already has both my_unit.ads and my_unit-test_data.ads,
 this will cause a name conflict with the generated test package.
@@ -19969,6 +19969,11 @@ separates. Note that if separate test routines had any manually added with
 clauses they will be moved to the test package body as is and have to be moved
 by hand.
 
+@item --omit-sloc
+@cindex @option{--omit-sloc} (@command{gnattest})
+Supresses comment line containing file name and line number of corresponding
+subprograms in test skeletons.
+
 @end table
 
 @option{--tests_root}, @option{--subdir} and @option{--tests-dir} switches are
@@ -20339,6 +20344,20 @@ gnatmake -Pmixing/test_driver.gpr
 mixing/test_runner
 @end smallexample
 
+@node Putting tests under veesion control
+@section Putting tests under veesion control
+
+@noindent
+As has been stated earlier, @command{gnattest} generates two different types
+of code, test skeletons and harness. The harness is generated completely
+automatically each time, does not require manual changes and therefore should
+not be put under version control.
+It makes sense to put under version control files containing test data packages,
+both specs and bodies, and files containing bodies of test packages. Note that
+test package specs are also generated automatically each time and should not be
+put under version control.
+Option @option{--omit-sloc} may be usefull when putting test packages under VCS.
+
 @ifclear vms
 @node Support for other platforms/run-times
 @section Support for other platforms/run-times
@@ -20370,7 +20389,7 @@ powerpc-elf-gnattest -Psimple.gpr -XPLATFORM=powerpc-elf -XRUNTIME=zfp
 The tool currently does not support following features:
 
 @itemize @bullet
-@item generic tests for generic packages and package instantiations
+@item generic tests for nested generic packages and their instantiations
 @item tests for protected subprograms and entries
 
 @end itemize
index 66f08dc987d9137d1f1af5fef4613032623c6f38..f0e8d9c86b005a6a6b942046b1c9f50dc09316c3 100644 (file)
@@ -724,7 +724,10 @@ package Lib.Writ is
    --        T  pragma Title
    --        S  pragma Subtitle
 
-   --      <sloc> is the source location of the pragma in line:col format
+   --      <sloc> is the source location of the pragma in line:col[:filename]
+   --      format. The file name is omitted if it is the same as the current
+   --      unit (it therefore appears explicitly in the case of pragmas
+   --      occurring in subunits, which do not have U sections of their own).
 
    --      Successive entries record the pragma_argument_associations.
 
index 04a0d397bdf9da5818521ab8a062216a99b0f1ce..53b611d983ad213c3e08d2f565cada325c766b5b 100644 (file)
@@ -1047,6 +1047,7 @@ package body Lib is
 
    procedure Store_Note (N : Node_Id) is
       Sfile : constant Source_File_Index := Get_Source_File_Index (Sloc (N));
+
    begin
       --  Notes for a generic are emitted when processing the template, never
       --  in instances.
index a53ab590b5bd995f7d9e96ab4dcfebfbad46f2cc..76111062b5f89e5dac81043ce82340783ef2c48d 100644 (file)
@@ -2910,13 +2910,21 @@ package body Makeutl is
          All_Projects   : Boolean;
          Unique_Compile : Boolean)
       is
-         procedure Do_Insert (Project : Project_Id; Tree : Project_Tree_Ref);
+
+         procedure Do_Insert
+           (Project    : Project_Id;
+            Tree       : Project_Tree_Ref;
+            Context    : Project_Context);
 
          ---------------
          -- Do_Insert --
          ---------------
 
-         procedure Do_Insert (Project : Project_Id; Tree : Project_Tree_Ref) is
+         procedure Do_Insert
+           (Project    : Project_Id;
+            Tree       : Project_Tree_Ref;
+            Context    : Project_Context)
+         is
             Unit_Based : constant Boolean :=
                            Unique_Compile
                              or else not Builder_Data (Tree).Closure_Needed;
@@ -2970,60 +2978,45 @@ package body Makeutl is
                      if (Unit_Based
                           or else Source.Unit = No_Unit_Index
                           or else Source.Project.Library
+                          or else Context.In_Aggregate_Lib
                           or else Project.Qualifier = Aggregate_Library)
                        and then not Is_Subunit (Source)
                      then
                         OK := True;
                         Closure := False;
 
-                        declare
-                           SAL_Project : Project_Id := No_Project;
-
-                        begin
-                           if Project.Qualifier = Aggregate_Library
-                             and then Project.Standalone_Library /= No
-                           then
-                              if Source.Unit /= No_Unit_Index then
-                                 SAL_Project := Project;
-                              end if;
-
-                           elsif Source.Unit /= No_Unit_Index
-                             and then Source.Project.Library
-                             and then Source.Project.Standalone_Library /= No
-                           then
-                              SAL_Project := Source.Project;
-                           end if;
-
-                           if SAL_Project /= No_Project then
+                        if Source.Unit /= No_Unit_Index
+                          and then
+                            (Source.Project.Library
+                             or else Project.Qualifier = Aggregate_Library
+                             or else Context.In_Aggregate_Lib)
+                          and then Source.Project.Standalone_Library /= No
+                        then
+                           --  Check if the unit is in the interface
+                           OK := False;
 
-                              --  Check if the unit is in the interface
+                           declare
+                              List : String_List_Id :=
+                                Source.Project.Lib_Interface_ALIs;
+                              Element : String_Element;
 
-                              OK := False;
+                           begin
+                              while List /= Nil_String loop
+                                 Element :=
+                                   Project_Tree.Shared.String_Elements.Table
+                                     (List);
 
-                              declare
-                                 List    : String_List_Id :=
-                                             SAL_Project.Lib_Interface_ALIs;
-                                 Element : String_Element;
+                                 if Element.Value = Name_Id (Source.Dep_Name)
+                                 then
+                                    OK := True;
+                                    Closure := True;
+                                    exit;
+                                 end if;
 
-                              begin
-                                 while List /= Nil_String loop
-                                    Element :=
-                                      Project_Tree.Shared.String_Elements.Table
-                                        (List);
-
-                                    if Element.Value =
-                                         Name_Id (Source.Dep_Name)
-                                    then
-                                       OK := True;
-                                       Closure := True;
-                                       exit;
-                                    end if;
-
-                                    List := Element.Next;
-                                 end loop;
-                              end;
-                           end if;
-                        end;
+                                 List := Element.Next;
+                              end loop;
+                           end;
+                        end if;
 
                         if OK then
                            Queue.Insert
@@ -3040,7 +3033,8 @@ package body Makeutl is
             end loop;
          end Do_Insert;
 
-         procedure Insert_All is new For_Project_And_Aggregated (Do_Insert);
+         procedure Insert_All is
+           new For_Project_And_Aggregated_Context (Do_Insert);
 
       begin
          Insert_All (Project, Project_Tree);
index d369ae2494e588dee9499b04a9fb61e13cbc4ec3..447818daf349b4221f88c3f8337fa7d457bd0ca1 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2014, 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- --
@@ -467,7 +467,8 @@ package body Prj.Util is
          --  the interface for standalone libraries.
 
          if Sid.Kind = Spec
-           and then not Sid.Project.Externally_Built
+           and then (not Sid.Project.Externally_Built
+                      or else Sid.Project = Project)
            and then not Sid.Locally_Removed
            and then (Project.Standalone_Library = No
                       or else Sid.Declared_In_Interfaces)
index 0562587c60480a29e499fbc7467b544fe56db1f5..73b77099baa9c1a9cb7a34712272123082ff44bf 100644 (file)
@@ -2101,7 +2101,7 @@ package body Prj is
 
          if Project.Qualifier in Aggregate_Project then
             Ctx :=
-              (In_Aggregate_Lib      => True,
+              (In_Aggregate_Lib      => Project.Qualifier = Aggregate_Library,
                From_Encapsulated_Lib =>
                  Context.From_Encapsulated_Lib
                    or else Project.Standalone_Library = Encapsulated);