Commit 3c2815d8 by Robert Dewar Committed by Arnaud Charlet

opt.ads, [...]: Minor reformatting

2009-07-13  Robert Dewar  <dewar@adacore.com>

	* opt.ads, prj-conf.adb, prj-env.adb, prj-ext.adb, prj-nmsc.adb,
	prj-proc.adb, prj-tree.adb, prj-tree.ads: Minor reformatting

From-SVN: r149570
parent 197e4514
2009-07-13 Robert Dewar <dewar@adacore.com>
* opt.ads, prj-conf.adb, prj-env.adb, prj-ext.adb, prj-nmsc.adb,
prj-proc.adb, prj-tree.adb, prj-tree.ads: Minor reformatting
2009-07-13 Emmanuel Briot <briot@adacore.com>
* prj.adb, prj.ads, prj-env.adb, prj-conf.adb, prj-tree.adb,
......
......@@ -1176,6 +1176,8 @@ package body Prj.Conf is
Name : Name_Id;
Naming : Project_Node_Id;
-- Start of processing for Add_Default_GNAT_Naming_Scheme
begin
if Config_File = Empty_Node then
......@@ -1186,6 +1188,7 @@ package body Prj.Conf is
Name := Name_Find;
-- An invalid project name to avoid conflicts with user-created ones
Name_Len := 5;
Name_Buffer (1 .. Name_Len) := "_auto";
......@@ -1215,8 +1218,8 @@ package body Prj.Conf is
Create_Attribute (Name_Library_Auto_Init_Supported, "false");
end if;
-- Setup Ada support (Ada is the default language here, since this is
-- only called when no config file existed initially, ie for
-- Setup Ada support (Ada is the default language here, since this
-- is only called when no config file existed initially, ie for
-- gnatmake).
Create_Attribute (Name_Default_Language, "ada");
......@@ -1234,7 +1237,6 @@ package body Prj.Conf is
(Project => Config_File,
In_Tree => Project_Tree,
Backward_Compatibility => False);
end if;
end if;
end Add_Default_GNAT_Naming_Scheme;
......
......@@ -126,8 +126,11 @@ package body Prj.Env is
Dummy : Boolean := False;
-- Start of processing for Ada_Include_Path
begin
if Recursive then
-- If it is the first time we call this function for
-- this project, compute the source path
......@@ -161,7 +164,7 @@ package body Prj.Env is
(Project : Project_Id;
Including_Libraries : Boolean := True) return String_Access
is
Buffer : String_Access;
Buffer : String_Access;
Buffer_Last : Natural := 0;
procedure Add (Project : Project_Id; Dummy : in out Boolean);
......@@ -186,6 +189,7 @@ package body Prj.Env is
procedure For_All_Projects is
new For_Every_Project_Imported (Boolean, Add);
Dummy : Boolean := False;
-- Start of processing for Ada_Objects_Path
......@@ -899,7 +903,8 @@ package body Prj.Env is
procedure Create_New_Path_File
(In_Tree : Project_Tree_Ref;
Path_FD : out File_Descriptor;
Path_Name : out Path_Name_Type) is
Path_Name : out Path_Name_Type)
is
begin
Create_Temp_File (In_Tree, Path_FD, Path_Name, "path file");
end Create_New_Path_File;
......
......@@ -244,6 +244,7 @@ package body Prj.Ext is
if Add_Default_Dir then
declare
Prefix : String_Ptr := Sdefault.Search_Dir_Prefix;
begin
if Prefix = null then
Prefix := new String'(Executable_Prefix_Path);
......
......@@ -287,10 +287,9 @@ package body Prj.Nmsc is
Data : Tree_Processing_Data);
-- Output an error message. If Data.Error_Report is null, simply call
-- Prj.Err.Error_Msg. Otherwise, disregard Flag_Location and use
-- Error_Report.
-- If Msg starts with "?", this is a warning, and Warning: is adding at the
-- beginning. If Msg starts with "<", see comment
-- for Err_Vars.Error_Msg_Warn
-- Error_Report. If Msg starts with "?", this is a warning, and the
-- string "Warning :" is adding at the beginning. If Msg starts with "<",
-- see comment for Err_Vars.Error_Msg_Warn
procedure Search_Directories
(Project : in out Project_Processing_Data;
......@@ -4155,7 +4154,7 @@ package body Prj.Nmsc is
while Prj.Element (Iter) /= No_Source
and then
(Prj.Element (Iter).Unit = null
or else Prj.Element (Iter).Unit.Name /= Unit)
or else Prj.Element (Iter).Unit.Name /= Unit)
loop
Next (Iter);
end loop;
......
......@@ -453,13 +453,14 @@ package body Prj.Proc is
Index : Name_Id) return Name_Id
is
Lower : Boolean;
begin
Get_Name_String (Index);
Lower := Case_Insensitive (Attr, Tree);
-- The index is always case insensitive if it does not include any dot.
-- ??? Why not use the properties from prj-attr, simply, maybe because
-- we don't know whether we have a file as an index ?
-- we don't know whether we have a file as an index?
if not Lower then
Lower := True;
......
......@@ -2877,6 +2877,7 @@ package body Prj.Tree is
Real_Parent : Project_Node_Id;
New_Decl, Decl, Next : Project_Node_Id;
Last, L : Project_Node_Id;
begin
if Kind_Of (Expr, Tree) /= N_Declarative_Item then
New_Decl := Default_Project_Node (Tree, N_Declarative_Item);
......@@ -2900,17 +2901,18 @@ package body Prj.Tree is
Next := Next_Declarative_Item (Decl, Tree);
exit when Next = Empty_Node
or else
(Add_Before_First_Pkg
and then Kind_Of (Current_Item_Node (Next, Tree), Tree)
= N_Package_Declaration)
(Add_Before_First_Pkg
and then Kind_Of (Current_Item_Node (Next, Tree), Tree) =
N_Package_Declaration)
or else
(Add_Before_First_Case
and then Kind_Of (Current_Item_Node (Next, Tree), Tree)
= N_Case_Construction);
(Add_Before_First_Case
and then Kind_Of (Current_Item_Node (Next, Tree), Tree) =
N_Case_Construction);
Decl := Next;
end loop;
-- In case Expr is in fact a range of declarative items
Last := New_Decl;
loop
L := Next_Declarative_Item (Last, Tree);
......@@ -2919,6 +2921,7 @@ package body Prj.Tree is
end loop;
-- In case Expr is in fact a range of declarative items
Last := New_Decl;
loop
L := Next_Declarative_Item (Last, Tree);
......@@ -2937,8 +2940,7 @@ package body Prj.Tree is
function Create_Literal_String
(Str : Namet.Name_Id;
Tree : Project_Node_Tree_Ref)
return Project_Node_Id
Tree : Project_Node_Tree_Ref) return Project_Node_Id
is
Node : Project_Node_Id;
begin
......@@ -2957,7 +2959,7 @@ package body Prj.Tree is
Tree : Project_Node_Tree_Ref) return Project_Node_Id
is
Expr : constant Project_Node_Id :=
Default_Project_Node (Tree, N_Expression, Single);
Default_Project_Node (Tree, N_Expression, Single);
begin
Set_First_Term (Expr, Tree, Default_Project_Node (Tree, N_Term, Single));
Set_Current_Term (First_Term (Expr, Tree), Tree, Node);
......@@ -2975,6 +2977,7 @@ package body Prj.Tree is
is
Pack : Project_Node_Id;
N : Name_Id;
begin
Name_Len := Pkg'Length;
Name_Buffer (1 .. Name_Len) := Pkg;
......@@ -2983,7 +2986,6 @@ package body Prj.Tree is
-- Check if the package already exists
Pack := First_Package_Of (Project, Tree);
while Pack /= Empty_Node loop
if Prj.Tree.Name_Of (Pack, Tree) = N then
return Pack;
......@@ -3002,6 +3004,7 @@ package body Prj.Tree is
Set_Package_Id_Of (Pack, Tree, Package_Node_Id_Of (N));
-- Add it to the list of packages
Set_Next_Package_In_Project
(Pack, Tree, First_Package_Of (Project, Tree));
Set_First_Package_Of (Project, Tree, Pack);
......@@ -3019,16 +3022,18 @@ package body Prj.Tree is
(Tree : Project_Node_Tree_Ref;
Prj_Or_Pkg : Project_Node_Id;
Name : Name_Id;
Index_Name : Name_Id := No_Name;
Index_Name : Name_Id := No_Name;
Kind : Variable_Kind := List;
At_Index : Integer := 0) return Project_Node_Id
At_Index : Integer := 0) return Project_Node_Id
is
Node : constant Project_Node_Id :=
Default_Project_Node (Tree, N_Attribute_Declaration, Kind);
Default_Project_Node (Tree, N_Attribute_Declaration, Kind);
Case_Insensitive : Boolean;
Pkg : Package_Node_Id;
Start_At : Attribute_Node_Id;
begin
Set_Name_Of (Node, Tree, Name);
......
......@@ -599,38 +599,34 @@ package Prj.Tree is
Full_Path : Path_Name_Type;
Is_Config_File : Boolean := False) return Project_Node_Id;
-- Create a new node for a project and register it in the tree so that it
-- can be retrieved later on
-- can be retrieved later on.
function Create_Package
(Tree : Project_Node_Tree_Ref;
Project : Project_Node_Id;
Pkg : String) return Project_Node_Id;
-- Create a new package in Project. If the package already exists, it is
-- returned.
-- The name of the package *must* be lower-cases, or none of its attributes
-- will be recognized.
-- returned. The name of the package *must* be lower-cases, or none of its
-- attributes will be recognized.
function Create_Attribute
(Tree : Project_Node_Tree_Ref;
Prj_Or_Pkg : Project_Node_Id;
Name : Name_Id;
Index_Name : Name_Id := No_Name;
Index_Name : Name_Id := No_Name;
Kind : Variable_Kind := List;
At_Index : Integer := 0) return Project_Node_Id;
-- Create a new attribute.
-- The new declaration is added at the end of the declarative item list for
-- Prj_Or_Pkg (a project or a package), but before any package
-- declaration). No addition is done if Prj_Or_Pkg is Empty_Node.
-- If Index_Name is not "", then if creates an attribute value for a
-- specific index.
-- At_Index is used for the " at <idx>" in the naming exceptions.
-- Use Set_Expression_Of to set the value of the attribute (in which case
-- Enclose_In_Expression might be useful)
At_Index : Integer := 0) return Project_Node_Id;
-- Create a new attribute. The new declaration is added at the end of the
-- declarative item list for Prj_Or_Pkg (a project or a package), but
-- before any package declaration). No addition is done if Prj_Or_Pkg is
-- Empty_Node. If Index_Name is not "", then if creates an attribute value
-- for a specific index. At_Index is used for the " at <idx>" in the naming
-- exceptions. Use Set_Expression_Of to set the value of the attribute (in
-- which case Enclose_In_Expression might be useful)
function Create_Literal_String
(Str : Namet.Name_Id;
Tree : Project_Node_Tree_Ref)
return Project_Node_Id;
Tree : Project_Node_Tree_Ref) return Project_Node_Id;
-- Create a literal string whose value is Str
procedure Add_At_End
......@@ -639,15 +635,14 @@ package Prj.Tree is
Expr : Project_Node_Id;
Add_Before_First_Pkg : Boolean := False;
Add_Before_First_Case : Boolean := False);
-- Add a new declarative item in the list in Parent.
-- This new declarative item will contain Expr (unless Expr is already a
-- declarative item, in which case it is added directly to the list). The
-- new item is inserted at the end of the list, unless Add_Before_First_Pkg
-- is True. In the latter case, it is added just before the first case
-- construction is seen, or before the first package (this assumes that all
-- packages are found at the end of the project, which isn't true in the
-- general case unless you have normalized the project to match this
-- description).
-- Add a new declarative item in the list in Parent. This new declarative
-- item will contain Expr (unless Expr is already a declarative item, in
-- which case it is added directly to the list). The new item is inserted
-- at the end of the list, unless Add_Before_First_Pkg is True. In the
-- latter case, it is added just before the first case construction is
-- seen, or before the first package (this assumes that all packages are
-- found at the end of the project, which isn't true in the general case
-- unless you have normalized the project to match this description).
function Enclose_In_Expression
(Node : Project_Node_Id;
......@@ -660,6 +655,7 @@ package Prj.Tree is
-- The following procedures are part of the abstract interface of the
-- Project File tree.
-- Each Set_* procedure is valid only for the same Project_Node_Kind
-- nodes as the corresponding query function above.
-- These are very low-level, and manipulate the tree itself directly. You
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment