From b3f5eef0edceeba38905f9802ad8710751180516 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 30 Jul 2014 17:09:05 +0200 Subject: [PATCH] [multiple changes] 2014-07-30 Thomas Quinot * lib-writ.ads: document format change. 2014-07-30 Pascal Obry * prj-util.adb (For_Interface_Sources): Do not include sources from withed externally built projects. 2014-07-30 Robert Dewar * lib.adb: Minor reformatting. * prj-util.adb: Minor reformatting. 2014-07-30 Ed Schonberg * 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 * gnat_ugn.texi: Improve gnattest documentation. 2014-07-30 Pascal Obry * 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 | 35 +++++++++++++++++ gcc/ada/exp_aggr.adb | 34 +++++++++++++++++ gcc/ada/gnat_ugn.texi | 27 +++++++++++-- gcc/ada/lib-writ.ads | 5 ++- gcc/ada/lib.adb | 1 + gcc/ada/makeutl.adb | 88 ++++++++++++++++++++----------------------- gcc/ada/prj-util.adb | 5 ++- gcc/ada/prj.adb | 2 +- 8 files changed, 142 insertions(+), 55 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index febc9a8283b..e884ff2a8be 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,38 @@ +2014-07-30 Thomas Quinot + + * lib-writ.ads: document format change. + +2014-07-30 Pascal Obry + + * prj-util.adb (For_Interface_Sources): Do not + include sources from withed externally built projects. + +2014-07-30 Robert Dewar + + * lib.adb: Minor reformatting. + * prj-util.adb: Minor reformatting. + +2014-07-30 Ed Schonberg + + * 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 + + * gnat_ugn.texi: Improve gnattest documentation. + +2014-07-30 Pascal Obry + + * 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 * lib-load.ads: Minor reformatting. diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 5ff1421db16..a43be855183 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -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 := diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 9a17ec14a11..dbdfb5059a9 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -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_.adb. - 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_. 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 diff --git a/gcc/ada/lib-writ.ads b/gcc/ada/lib-writ.ads index 66f08dc987d..f0e8d9c86b0 100644 --- a/gcc/ada/lib-writ.ads +++ b/gcc/ada/lib-writ.ads @@ -724,7 +724,10 @@ package Lib.Writ is -- T pragma Title -- S pragma Subtitle - -- is the source location of the pragma in line:col format + -- 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. diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb index 04a0d397bdf..53b611d983a 100644 --- a/gcc/ada/lib.adb +++ b/gcc/ada/lib.adb @@ -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. diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb index a53ab590b5b..76111062b5f 100644 --- a/gcc/ada/makeutl.adb +++ b/gcc/ada/makeutl.adb @@ -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); diff --git a/gcc/ada/prj-util.adb b/gcc/ada/prj-util.adb index d369ae2494e..447818daf34 100644 --- a/gcc/ada/prj-util.adb +++ b/gcc/ada/prj-util.adb @@ -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) diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb index 0562587c604..73b77099baa 100644 --- a/gcc/ada/prj.adb +++ b/gcc/ada/prj.adb @@ -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); -- 2.30.2