OSDN Git Service

2006-10-31 Robert Dewar <dewar@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / prj-dect.adb
index 0b64d9b..3c70614 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---           Copyright (C) 2001-2005 Free Software Foundation, Inc          --
+--          Copyright (C) 2001-2006, 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- --
@@ -16,8 +16,8 @@
 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 -- for  more details.  You should have  received  a copy of the GNU General --
 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, USA.                                                      --
+-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
+-- Boston, MA 02110-1301, USA.                                              --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
@@ -30,9 +30,7 @@ with Opt;         use Opt;
 with Prj.Err;     use Prj.Err;
 with Prj.Strt;    use Prj.Strt;
 with Prj.Tree;    use Prj.Tree;
-with Scans;       use Scans;
 with Snames;
-with Types;       use Types;
 with Prj.Attr;    use Prj.Attr;
 with Prj.Attr.PM; use Prj.Attr.PM;
 with Uintp;       use Uintp;
@@ -51,7 +49,7 @@ package body Prj.Dect is
       Current_Project   : Project_Node_Id;
       Current_Package   : Project_Node_Id;
       Packages_To_Check : String_List_Access);
-   --  Parse an attribute declaration.
+   --  Parse an attribute declaration
 
    procedure Parse_Case_Construction
      (In_Tree           : Project_Node_Tree_Ref;
@@ -144,7 +142,7 @@ package body Prj.Dect is
       Attribute_Name         : Name_Id           := No_Name;
       Optional_Index         : Boolean           := False;
       Pkg_Id                 : Package_Node_Id   := Empty_Package;
-      Warning                : Boolean           := False;
+      Ignore                 : Boolean           := False;
 
    begin
       Attribute :=
@@ -185,17 +183,15 @@ package body Prj.Dect is
             then
                Pkg_Id := Package_Id_Of (Current_Package, In_Tree);
                Add_Attribute (Pkg_Id, Token_Name, Current_Attribute);
-               Error_Msg_Name_1 := Token_Name;
-               Error_Msg ("?unknown attribute {", Token_Ptr);
 
             else
-               --  If not a valid attribute name, issue an error, or a warning
-               --  if inside a package that does not need to be checked.
+               --  If not a valid attribute name, issue an error if inside
+               --  a package that need to be checked.
 
-               Warning := Current_Package /= Empty_Node and then
+               Ignore := Current_Package /= Empty_Node and then
                           Packages_To_Check /= All_Packages;
 
-               if Warning then
+               if Ignore then
 
                   --  Check that we are not in a package to check
 
@@ -205,18 +201,14 @@ package body Prj.Dect is
                      if Name_Buffer (1 .. Name_Len) =
                        Packages_To_Check (Index).all
                      then
-                        Warning := False;
+                        Ignore := False;
                         exit;
                      end if;
                   end loop;
                end if;
 
-               Error_Msg_Name_1 := Token_Name;
-
-               if Warning then
-                  Error_Msg ("?undefined attribute {", Token_Ptr);
-
-               else
+               if not Ignore then
+                  Error_Msg_Name_1 := Token_Name;
                   Error_Msg ("undefined attribute {", Token_Ptr);
                end if;
             end if;
@@ -927,11 +919,13 @@ package body Prj.Dect is
       Current_Package        : Package_Node_Id   := Empty_Package;
       First_Declarative_Item : Project_Node_Id   := Empty_Node;
 
+      Package_Location       : constant Source_Ptr := Token_Ptr;
+
    begin
       Package_Declaration :=
         Default_Project_Node
           (Of_Kind => N_Package_Declaration, In_Tree => In_Tree);
-      Set_Location_Of (Package_Declaration, In_Tree, To => Token_Ptr);
+      Set_Location_Of (Package_Declaration, In_Tree, To => Package_Location);
 
       --  Scan past "package"
 
@@ -947,11 +941,13 @@ package body Prj.Dect is
             First_Attribute := First_Attribute_Of (Current_Package);
 
          else
-            Error_Msg ("?""" &
-                       Get_Name_String
-                         (Name_Of (Package_Declaration, In_Tree)) &
-                       """ is not a known package name",
-                       Token_Ptr);
+            if not Quiet_Output then
+               Error_Msg ("?""" &
+                          Get_Name_String
+                            (Name_Of (Package_Declaration, In_Tree)) &
+                          """ is not a known package name",
+                          Token_Ptr);
+            end if;
 
             --  Set the package declaration to "ignored" so that it is not
             --  processed by Prj.Proc.Process.
@@ -1011,6 +1007,7 @@ package body Prj.Dect is
          if Token = Tok_Identifier then
             declare
                Project_Name : constant Name_Id := Token_Name;
+
                Clause       : Project_Node_Id :=
                               First_With_Clause_Of (Current_Project, In_Tree);
                The_Project  : Project_Node_Id := Empty_Node;