prj-pp.adb (Print): Do not output the with statement if the associated name is empty...
2005-11-14 Emmanuel Briot <briot@adacore.com> * prj-pp.adb (Print): Do not output the with statement if the associated name is empty, which happens for virtual extending projects. (Print): Preserve the "extends all" attribute when printing the project. * prj-tree.ads (String_Value_Of): Add comment about returned value for a virtual extending project. From-SVN: r106996
This commit is contained in:
parent
9cd6ae612e
commit
a05076ba9d
@ -6,7 +6,7 @@
|
||||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 2001-2005, 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- --
|
||||
@ -38,7 +38,7 @@ package body Prj.PP is
|
||||
Not_Tested : array (Project_Node_Kind) of Boolean := (others => True);
|
||||
|
||||
Max_Line_Length : constant := Hostparm.Max_Line_Length - 5;
|
||||
-- Maximum length of a line.
|
||||
-- Maximum length of a line
|
||||
|
||||
Column : Natural := 0;
|
||||
-- Column number of the last character in the line. Used to avoid
|
||||
@ -91,7 +91,7 @@ package body Prj.PP is
|
||||
-- Outputs a name
|
||||
|
||||
procedure Start_Line (Indent : Natural);
|
||||
-- Outputs the indentation at the beginning of the line.
|
||||
-- Outputs the indentation at the beginning of the line
|
||||
|
||||
procedure Output_String (S : Name_Id);
|
||||
-- Outputs a string using the default output procedures
|
||||
@ -114,10 +114,10 @@ package body Prj.PP is
|
||||
Write_Char : Write_Char_Ap := Output.Write_Char'Access;
|
||||
Write_Eol : Write_Eol_Ap := Output.Write_Eol'Access;
|
||||
Write_Str : Write_Str_Ap := Output.Write_Str'Access;
|
||||
-- These three access to procedure values are used for the output.
|
||||
-- These three access to procedure values are used for the output
|
||||
|
||||
Last_Line_Is_Empty : Boolean := False;
|
||||
-- Used to avoid two consecutive empty lines.
|
||||
-- Used to avoid two consecutive empty lines
|
||||
|
||||
---------------------------
|
||||
-- Output_Attribute_Name --
|
||||
@ -337,6 +337,11 @@ package body Prj.PP is
|
||||
|
||||
if Extended_Project_Path_Of (Node, In_Tree) /= No_Name then
|
||||
Write_String (" extends ");
|
||||
|
||||
if Is_Extending_All (Node, In_Tree) then
|
||||
Write_String ("all ");
|
||||
end if;
|
||||
|
||||
Output_String (Extended_Project_Path_Of (Node, In_Tree));
|
||||
end if;
|
||||
|
||||
@ -361,7 +366,14 @@ package body Prj.PP is
|
||||
when N_With_Clause =>
|
||||
pragma Debug (Indicate_Tested (N_With_Clause));
|
||||
|
||||
if Name_Of (Node, In_Tree) /= No_Name then
|
||||
-- The with clause will sometimes contain an invalid name
|
||||
-- when we are importing a virtual project from an
|
||||
-- extending all project. Do not output anything in this
|
||||
-- case
|
||||
|
||||
if Name_Of (Node, In_Tree) /= No_Name
|
||||
and then String_Value_Of (Node, In_Tree) /= No_Name
|
||||
then
|
||||
if First_With_In_List then
|
||||
Print (First_Comment_Before (Node, In_Tree), Indent);
|
||||
Start_Line (Indent);
|
||||
|
@ -6,7 +6,7 @@
|
||||
-- --
|
||||
-- S p e c --
|
||||
-- --
|
||||
-- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 2001-2005, 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- --
|
||||
@ -85,9 +85,9 @@ package Prj.Tree is
|
||||
N_Case_Item,
|
||||
N_Comment_Zones,
|
||||
N_Comment);
|
||||
-- Each node in the tree is of a Project_Node_Kind
|
||||
-- For the signification of the fields in each node of a
|
||||
-- Project_Node_Kind, look at package Tree_Private_Part.
|
||||
-- Each node in the tree is of a Project_Node_Kind. For the signification
|
||||
-- of the fields in each node of Project_Node_Kind, look at package
|
||||
-- Tree_Private_Part.
|
||||
|
||||
procedure Initialize (Tree : Project_Node_Tree_Ref);
|
||||
-- Initialize the Project File tree: empty the Project_Nodes table
|
||||
@ -97,8 +97,8 @@ package Prj.Tree is
|
||||
(In_Tree : Project_Node_Tree_Ref;
|
||||
Of_Kind : Project_Node_Kind;
|
||||
And_Expr_Kind : Variable_Kind := Undefined) return Project_Node_Id;
|
||||
-- Returns a Project_Node_Record with the specified Kind and
|
||||
-- Expr_Kind; all the other components have default nil values.
|
||||
-- Returns a Project_Node_Record with the specified Kind and Expr_Kind. All
|
||||
-- the other components have default nil values.
|
||||
|
||||
function Hash (N : Project_Node_Id) return Header_Num;
|
||||
-- Used for hash tables where the key is a Project_Node_Id
|
||||
@ -149,10 +149,9 @@ package Prj.Tree is
|
||||
-- comment, then it should be associated with this node.
|
||||
|
||||
procedure Set_Next_End_Node (To : Project_Node_Id);
|
||||
-- Put node To on the top of the end node stack. When an "end" line
|
||||
-- is found with this node on the top of the end node stack, the comments,
|
||||
-- if any, immediately preceding this "end" line will be associated with
|
||||
-- this node.
|
||||
-- Put node To on the top of the end node stack. When an END line is found
|
||||
-- with this node on the top of the end node stack, the comments, if any,
|
||||
-- immediately preceding this "end" line will be associated with this node.
|
||||
|
||||
procedure Remove_Next_End_Node;
|
||||
-- Remove the top of the end node stack
|
||||
@ -166,6 +165,7 @@ package Prj.Tree is
|
||||
Follows_Empty_Line : Boolean := False;
|
||||
Is_Followed_By_Empty_Line : Boolean := False;
|
||||
end record;
|
||||
-- Component type for Comments Table below
|
||||
|
||||
package Comments is new Table.Table
|
||||
(Table_Component_Type => Comment_Data,
|
||||
@ -181,6 +181,7 @@ package Prj.Tree is
|
||||
|
||||
type Comment_Location is
|
||||
(Before, After, Before_End, After_End, End_Of_Line);
|
||||
-- Used in call to Add_Comments below
|
||||
|
||||
procedure Add_Comments
|
||||
(To : Project_Node_Id;
|
||||
@ -193,7 +194,10 @@ package Prj.Tree is
|
||||
----------------------
|
||||
|
||||
-- The following query functions are part of the abstract interface
|
||||
-- of the Project File tree
|
||||
-- of the Project File tree. They provide access to fields of a project.
|
||||
|
||||
-- In the following, there are "valid if" comments, but no indication
|
||||
-- of what happens if they are called with invalid arguments ???
|
||||
|
||||
function Name_Of
|
||||
(Node : Project_Node_Id;
|
||||
@ -314,7 +318,9 @@ package Prj.Tree is
|
||||
(Node : Project_Node_Id;
|
||||
In_Tree : Project_Node_Tree_Ref) return Name_Id;
|
||||
pragma Inline (String_Value_Of);
|
||||
-- Only valid for N_With_Clause, N_Literal_String nodes or N_Comment
|
||||
-- Only valid for N_With_Clause, N_Literal_String nodes or N_Comment.
|
||||
-- For a N_With_Clause created automatically for a virtual extending
|
||||
-- project, No_Name is returned.
|
||||
|
||||
function Source_Index_Of
|
||||
(Node : Project_Node_Id;
|
||||
|
Loading…
Reference in New Issue
Block a user