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.
* sinfo.ads (Library_Unit): Update comment.
* lib.ads (Notes): Simplify. The Unit component in Notes_Entry
Prefix => New_Copy_Tree (Lhs),
Selector_Name => Make_Identifier (Loc, Chars (Expr))));
end if;
+
return OK;
end Rewrite_Discriminant;
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 :=
"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.
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
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
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
-- 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.
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.
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;
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
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);
-- --
-- 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- --
-- 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)
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);