OSDN Git Service

2009-07-09 Emmanuel Briot <briot@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Jul 2009 10:22:49 +0000 (10:22 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Jul 2009 10:22:49 +0000 (10:22 +0000)
* prj-nmsc.adb (Find_Sources): Avoid error messages from gprbuild from
multi-unit files.

2009-07-09  Thomas Quinot  <quinot@adacore.com>

* freeze.adb: Minor reformatting

* exp_ch3.adb: Minor comment fix.

* sinfo.ads: Minor comment fix

2009-07-09  Ed Schonberg  <schonberg@adacore.com>

* exp_ch4.adb (Expand_N_Conditional_Expression): Set Related_Expression.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149411 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/exp_ch3.adb
gcc/ada/exp_ch4.adb
gcc/ada/freeze.adb
gcc/ada/prj-nmsc.adb
gcc/ada/sinfo.ads

index 296c04d..98c4161 100644 (file)
@@ -1,3 +1,20 @@
+2009-07-09  Emmanuel Briot  <briot@adacore.com>
+
+       * prj-nmsc.adb (Find_Sources): Avoid error messages from gprbuild from
+       multi-unit files.
+
+2009-07-09  Thomas Quinot  <quinot@adacore.com>
+
+       * freeze.adb: Minor reformatting
+
+       * exp_ch3.adb: Minor comment fix.
+
+       * sinfo.ads: Minor comment fix
+
+2009-07-09  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_ch4.adb (Expand_N_Conditional_Expression): Set Related_Expression.
+
 2009-07-09  Ed Schonberg  <schonberg@adacore.com>
 
        * freeze.adb (Freeze_Expression): If the expression is the name of a
index bb5d1f1..8cacbeb 100644 (file)
@@ -6014,7 +6014,7 @@ package body Exp_Ch3 is
             Append_Freeze_Actions (Def_Id, Wrapper_Body_List);
          end if;
 
-         --  Create extra actuals for the primitive operations of the type.
+         --  Create extra formals for the primitive operations of the type.
          --  This must be done before analyzing the body of the initialization
          --  procedure, because a self-referential type might call one of these
          --  primitives in the body of the init_proc itself.
index b235db0..d25ff36 100644 (file)
@@ -4046,8 +4046,8 @@ package body Exp_Ch4 is
                  Name => New_Occurrence_Of (Cnn, Sloc (Elsex)),
                  Expression => Relocate_Node (Elsex))));
 
-         --  Move the SLOC of the parent If statement to the newly created
-         --  one and change it to the SLOC of the expression which, after
+         --  Move the SLOC of the parent If statement to the newly created one
+         --  and change it to the SLOC of the expression which, after
          --  expansion, will correspond to what is being evaluated.
 
          if Present (Parent (N))
@@ -4079,6 +4079,10 @@ package body Exp_Ch4 is
 
          Insert_Action (N, New_If);
          Analyze_And_Resolve (N, Typ);
+
+         --  Link temporary to original expression, for Codepeer
+
+         Set_Related_Expression (Cnn, Original_Node (N));
       end if;
    end Expand_N_Conditional_Expression;
 
index fffb33f..e66dc14 100644 (file)
@@ -4014,7 +4014,7 @@ package body Freeze is
 
       --  For a function, we freeze the entity when the subprogram declaration
       --  is frozen, but a function call may appear in an initialization proc.
-      --  before the  declaration  is frozen. We need to generate  the extra
+      --  before the declaration is frozen. We need to generate the extra
       --  formals, if any, to ensure that the expansion of the call includes
       --  the proper actuals.
 
@@ -4067,12 +4067,12 @@ package body Freeze is
          return;
       end if;
 
-      --  Loop for looking at the right place to insert the freeze nodes
+      --  Loop for looking at the right place to insert the freeze nodes,
       --  exiting from the loop when it is appropriate to insert the freeze
       --  node before the current node P.
 
-      --  Also checks some special exceptions to the freezing rules. These
-      --  cases result in a direct return, bypassing the freeze action.
+      --  Also checks som special exceptions to the freezing rules. These cases
+      --  result in a direct return, bypassing the freeze action.
 
       P := N;
       loop
index 5977a8a..2ff40e4 100644 (file)
@@ -130,9 +130,8 @@ package body Prj.Nmsc is
       Key        => Name_Id,
       Hash       => Hash,
       Equal      => "=");
-   --  Hash table to store recursive source directories, to avoid looking
-   --  several times, and to avoid cycles that may be introduced by symbolic
-   --  links.
+   --  Hash table stores recursive source directories, to avoid looking several
+   --  times, and to avoid cycles that may be introduced by symbolic links.
 
    type Ada_Naming_Exception_Id is new Nat;
    No_Ada_Naming_Exception : constant Ada_Naming_Exception_Id := 0;
@@ -428,14 +427,11 @@ package body Prj.Nmsc is
       Unit                  : out Name_Id;
       Lang_Kind             : out Language_Kind;
       Kind                  : out Source_Kind);
-   --  Check if the file name File_Name conforms to one of the naming
-   --  schemes of the project.
-   --
-   --  If the file does not match one of the naming schemes, set Language
-   --  to No_Language_Index.
-   --
-   --  Filename is the name of the file being investigated. It has been
-   --  normalized (case-folded). File_Name is the same value.
+   --  Check if the file name File_Name conforms to one of the naming schemes
+   --  of the project. If the file does not match one of the naming schemes,
+   --  set Language to No_Language_Index. Filename is the name of the file
+   --  being investigated. It has been normalized (case-folded). File_Name is
+   --  the same value.
 
    procedure Free_Ada_Naming_Exceptions;
    --  Free the internal hash tables used for checking naming exceptions
@@ -445,10 +441,8 @@ package body Prj.Nmsc is
       In_Tree     : Project_Tree_Ref;
       Current_Dir : String);
    --  Get the object directory, the exec directory and the source directories
-   --  of a project.
-   --
-   --  Current_Dir should represent the current directory, and is passed for
-   --  efficiency to avoid system calls to recompute it.
+   --  of a project. Current_Dir should represent the current directory, and is
+   --  passed for efficiency to avoid system calls to recompute it.
 
    procedure Get_Mains
      (Project : Project_Id;
@@ -469,13 +463,12 @@ package body Prj.Nmsc is
       In_Tree   : Project_Tree_Ref;
       Proc_Data : in out Processing_Data;
       Allow_Duplicate_Basenames : Boolean);
-   --  Process the Source_Files and Source_List_File attributes, and store
-   --  the list of source files into the Source_Names htable.
-   --  When these attributes are not defined, find all files matching the
-   --  naming schemes in the source directories.
-   --  If Allow_Duplicate_Basenames, then files with the same base names are
-   --  authorized within a project for source-based languages (never for unit
-   --  based languages)
+   --  Process the Source_Files and Source_List_File attributes, and store the
+   --  list of source files into the Source_Names htable. When these attributes
+   --  are not defined, find all files matching the naming schemes in the
+   --  source directories. If Allow_Duplicate_Basenames, then files with the
+   --  same base names are authorized within a project for source-based
+   --  languages (never for unit based languages)
 
    procedure Compute_Unit_Name
      (File_Name : File_Name_Type;
@@ -516,18 +509,15 @@ package body Prj.Nmsc is
       Location         : Source_Ptr := No_Location;
       Must_Exist       : Boolean := True;
       Externally_Built : Boolean := False);
-   --  Locate a directory. Name is the directory name.
-   --  Relative paths are resolved relative to the project's directory.
-   --  If the directory does not exist and Setup_Projects
-   --  is True and Create is a non null string, an attempt is made to create
-   --  the directory.
-   --  If the directory does not exist, it is either created if Setup_Projects
-   --  is False (and then returned), or simply returned without checking for
-   --  its existence (if Must_Exist is False) or No_Path_Information is
-   --  returned. In all cases, Dir_Exists indicates whether the directory now
-   --  exists.
-   --
-   --  Create is also used for debugging traces to show which path we are
+   --  Locate a directory. Name is the directory name. Relative paths are
+   --  resolved relative to the project's directory. If the directory does not
+   --  exist and Setup_Projects is True and Create is a non null string, an
+   --  attempt is made to create the directory. If the directory does not
+   --  exist, it is either created if Setup_Projects is False (and then
+   --  returned), or simply returned without checking for its existence (if
+   --  Must_Exist is False) or No_Path_Information is returned. In all cases,
+   --  Dir_Exists indicates whether the directory now exists. Create is also
+   --  used for debugging traces to show which path we are
    --  computing
 
    procedure Look_For_Sources
@@ -643,6 +633,7 @@ package body Prj.Nmsc is
       Suffix   : File_Name_Type) return Boolean
    is
       Min_Prefix_Length : Natural := 0;
+
    begin
       if Suffix = No_File or else Suffix = Empty_File then
          return False;
@@ -650,8 +641,8 @@ package body Prj.Nmsc is
 
       declare
          Suf : constant String := Get_Name_String (Suffix);
-      begin
 
+      begin
          --  The file name must end with the suffix (which is not an extension)
          --  For instance a suffix "configure.in" must match a file with the
          --  same name. To avoid dummy cases, though, a suffix starting with
@@ -701,8 +692,8 @@ package body Prj.Nmsc is
       Index               : Int       := 0;
       Source_To_Replace   : Source_Id := No_Source)
    is
-      Config   : constant Language_Config := Lang_Id.Config;
-      UData    : Unit_Index;
+      Config : constant Language_Config := Lang_Id.Config;
+      UData  : Unit_Index;
 
    begin
       Id := new Source_Data;
@@ -713,11 +704,14 @@ package body Prj.Nmsc is
 
          if Lang_Id.Config.Kind = Unit_Based then
             Write_Str (" Unit: ");
+
             --  ??? in gprclean, it seems we sometimes pass an empty Unit name
-            --  (see test extended_projects)
+            --  (see test extended_projects).
+
             if Unit /= No_Name then
                Write_Str (Get_Name_String (Unit));
             end if;
+
             Write_Str (" Kind: ");
             Write_Str (Source_Kind'Image (Kind));
          end if;
@@ -743,7 +737,7 @@ package body Prj.Nmsc is
          UData := Units_Htable.Get (In_Tree.Units_HT, Unit);
 
          if UData = No_Unit_Index then
-            UData      := new Unit_Data;
+            UData := new Unit_Data;
             UData.Name := Unit;
             Units_Htable.Set (In_Tree.Units_HT, Unit, UData);
          end if;
@@ -831,8 +825,8 @@ package body Prj.Nmsc is
       Compiler_Driver_Mandatory : Boolean;
       Allow_Duplicate_Basenames : Boolean)
    is
-      Specs : Array_Element_Id;
-      Bodies : Array_Element_Id;
+      Specs     : Array_Element_Id;
+      Bodies    : Array_Element_Id;
       Extending : Boolean := False;
 
    begin
@@ -883,8 +877,8 @@ package body Prj.Nmsc is
             else
                Error_Msg
                  (Project, In_Tree,
-                  "at least one of Source_Files, Source_Dirs or Languages " &
-                  "must be declared empty for an abstract project",
+                  "at least one of Source_Files, Source_Dirs or Languages "
+                    & "must be declared empty for an abstract project",
                   Project.Location);
             end if;
          end;
@@ -940,19 +934,18 @@ package body Prj.Nmsc is
                (not Extending)
          then
             declare
-               Language      : Language_Ptr;
-               Source        : Source_Id;
-               Alt_Lang      : Language_List;
-               Continuation  : Boolean := False;
-               Iter          : Source_Iterator;
+               Language     : Language_Ptr;
+               Source       : Source_Id;
+               Alt_Lang     : Language_List;
+               Continuation : Boolean := False;
+               Iter         : Source_Iterator;
 
             begin
                Language := Project.Languages;
                while Language /= No_Language_Index loop
 
-                  --  If there are no sources for this language, check whether
-                  --  there are sources for which this is an alternate
-                  --  language.
+                  --  If there are no sources for this language, check if there
+                  --  are sources for which this is an alternate language.
 
                   if Language.First_Source = No_Source then
                      Iter := For_Each_Source (In_Tree => In_Tree,
@@ -1141,6 +1134,7 @@ package body Prj.Nmsc is
          elsif The_Name (Index) = '.' then
 
             --  First, check if the name before the dot is not a reserved word
+
             if Is_Reserved (The_Name (First .. Index - 1)) then
                return;
             end if;
@@ -1716,6 +1710,7 @@ package body Prj.Nmsc is
             Current_Array    : Array_Data;
             Element_Id       : Array_Element_Id;
             Element          : Array_Element;
+
          begin
             --  Process the associative array attribute of package Naming
 
@@ -2368,6 +2363,8 @@ package body Prj.Nmsc is
          end loop;
       end Process_Project_Level_Array_Attributes;
 
+   --  Start of processing for Check_Configuration
+
    begin
       Process_Project_Level_Simple_Attributes;
       Process_Project_Level_Array_Attributes;
@@ -2410,6 +2407,7 @@ package body Prj.Nmsc is
 
       Lang_Index := Project.Languages;
       while Lang_Index /= No_Language_Index loop
+
          --  For all languages, Compiler_Driver needs to be specified. This is
          --  only needed if we do intend to compile (not in GPS for instance).
 
@@ -2559,7 +2557,6 @@ package body Prj.Nmsc is
          Project_2 := Project;
          while Project_2 /= No_Project loop
             Iter := For_Each_Source (In_Tree, Project_2);
-
             loop
                Source := Prj.Element (Iter);
                exit when Source = No_Source;
@@ -2835,6 +2832,7 @@ package body Prj.Nmsc is
             declare
                Casing_Image : constant String :=
                                 Get_Name_String (Casing_String.Value);
+
             begin
                if Casing_Image'Length = 0 then
                   Error_Msg
@@ -3130,7 +3128,7 @@ package body Prj.Nmsc is
 
       procedure Check_Naming_Ada_Only is
          Ada : constant Language_Ptr :=
-           Get_Language_From_Name (Project, "ada");
+                 Get_Language_From_Name (Project, "ada");
 
          Casing_Defined : Boolean;
          Sep_Suffix_Loc : Source_Ptr;
@@ -3250,7 +3248,7 @@ package body Prj.Nmsc is
          --  For all unit based languages, if any, set the specified value
          --  of Dot_Replacement, Casing and/or Separate_Suffix. Do not
          --  systematically overwrite, since the defaults come from the
-         --  configuration file
+         --  configuration file.
 
          if Dot_Replacement /= No_File
            or else Casing_Defined
@@ -3407,8 +3405,7 @@ package body Prj.Nmsc is
                end if;
             end if;
 
-            --  If the language was not found in project or the projects it
-            --  extends
+            --  If language was not found in project or the projects it extends
 
             if Lang = null then
                if Current_Verbosity = High then
@@ -3714,6 +3711,7 @@ package body Prj.Nmsc is
             end if;
 
             if not Dir_Exists then
+
                --  Get the absolute name of the library directory that
                --  does not exist, to report an error.
 
@@ -3897,6 +3895,7 @@ package body Prj.Nmsc is
                   Externally_Built => Project.Externally_Built);
 
                if not Dir_Exists then
+
                   --  Get the absolute name of the library ALI directory that
                   --  does not exist, to report an error.
 
@@ -3998,8 +3997,7 @@ package body Prj.Nmsc is
 
                         elsif Current_Verbosity = High then
 
-                           --  Display the Library ALI directory in high
-                           --  verbosity.
+                           --  Display Library ALI directory in high verbosity
 
                            Write_Attr
                              ("Library ALI dir",
@@ -4197,9 +4195,15 @@ package body Prj.Nmsc is
       --  Add a new language to the list of languages for the project.
       --  Nothing is done if the language has already been defined
 
+      ------------------
+      -- Add_Language --
+      ------------------
+
       procedure Add_Language (Name, Display_Name : Name_Id) is
-         Lang : Language_Ptr := Project.Languages;
+         Lang : Language_Ptr;
+
       begin
+         Lang := Project.Languages;
          while Lang /= No_Language_Index loop
             if Name = Lang.Name then
                return;
@@ -4219,10 +4223,11 @@ package body Prj.Nmsc is
             Lang.Config.Dependency_Kind := ALI_File;
 
             if Get_Mode = Ada_Only then
+
                --  Create a default config for Ada (since there is no
-               --  configuration file to create it for us)
-               --  ??? We should do as GPS does and create a dummy config
-               --  file
+               --  configuration file to create it for us).
+
+               --  ??? We should do as GPS does and create a dummy config file
 
                Lang.Config.Naming_Data :=
                  (Dot_Replacement => File_Name_Type
@@ -4615,6 +4620,7 @@ package body Prj.Nmsc is
                      if Source /= No_Source then
                         if Source.Kind = Sep then
                            Source := No_Source;
+
                         elsif Source.Kind = Spec
                           and then Other_Part (Source) /= No_Source
                         then
@@ -4724,8 +4730,8 @@ package body Prj.Nmsc is
 
          if Lib_Src_Dir.Value /= Empty_String then
             declare
-               Dir_Id : constant File_Name_Type :=
-                          File_Name_Type (Lib_Src_Dir.Value);
+               Dir_Id     : constant File_Name_Type :=
+                              File_Name_Type (Lib_Src_Dir.Value);
                Dir_Exists : Boolean;
 
             begin
@@ -4743,6 +4749,7 @@ package body Prj.Nmsc is
                --  If directory does not exist, report an error
 
                if not Dir_Exists then
+
                   --  Get the absolute name of the library directory that does
                   --  not exist, to report an error.
 
@@ -5055,7 +5062,7 @@ package body Prj.Nmsc is
    begin
       if Dir'Length > 1
         and then (Dir (Dir'Last - 1) = Directory_Separator
-                  or else Dir (Dir'Last - 1) = '/')
+                   or else Dir (Dir'Last - 1) = '/')
       then
          return Dir'Last - 1;
       else
@@ -5361,8 +5368,7 @@ package body Prj.Nmsc is
                   Write_Line (The_Path (The_Path'First .. The_Path_Last));
                end if;
 
-               String_Element_Table.Increment_Last
-                 (In_Tree.String_Elements);
+               String_Element_Table.Increment_Last (In_Tree.String_Elements);
                Element :=
                  (Value         => Canonical_Path,
                   Display_Value => Non_Canonical_Path,
@@ -5374,8 +5380,8 @@ package body Prj.Nmsc is
                --  Case of first source directory
 
                if Last_Source_Dir = Nil_String then
-                  Project.Source_Dirs := String_Element_Table.Last
-                                        (In_Tree.String_Elements);
+                  Project.Source_Dirs :=
+                    String_Element_Table.Last (In_Tree.String_Elements);
 
                   --  Here we already have source directories
 
@@ -5384,16 +5390,14 @@ package body Prj.Nmsc is
 
                   In_Tree.String_Elements.Table
                     (Last_Source_Dir).Next :=
-                      String_Element_Table.Last
-                        (In_Tree.String_Elements);
+                      String_Element_Table.Last (In_Tree.String_Elements);
                end if;
 
                --  And register this source directory as the new last
 
-               Last_Source_Dir  := String_Element_Table.Last
-                 (In_Tree.String_Elements);
-               In_Tree.String_Elements.Table (Last_Source_Dir) :=
-                 Element;
+               Last_Source_Dir :=
+                 String_Element_Table.Last (In_Tree.String_Elements);
+               In_Tree.String_Elements.Table (Last_Source_Dir) := Element;
 
             elsif Removed and Found then
                if Prev = Nil_String then
@@ -5544,10 +5548,10 @@ package body Prj.Nmsc is
 
          else
             declare
-               Path_Name         : Path_Information;
-               List              : String_List_Id;
-               Prev              : String_List_Id;
-               Dir_Exists        : Boolean;
+               Path_Name  : Path_Information;
+               List       : String_List_Id;
+               Prev       : String_List_Id;
+               Dir_Exists : Boolean;
 
             begin
                Locate_Directory
@@ -5714,8 +5718,7 @@ package body Prj.Nmsc is
             --  However, even when it doesn't exist, we set it to a default
             --  value. This is for the benefit of tools that recover from
             --  errors; for example, these tools could create the non existent
-            --  directory.
-            --  We always return an absolute directory name though
+            --  directory. We always return an absolute directory name though.
 
             Locate_Directory
               (Project,
@@ -5825,8 +5828,8 @@ package body Prj.Nmsc is
 
       pragma Assert (Source_Dirs.Kind = List, "Source_Dirs is not a list");
 
-      if (not Source_Files.Default) and then
-        Source_Files.Values = Nil_String
+      if (not Source_Files.Default)
+        and then Source_Files.Values = Nil_String
       then
          Project.Source_Dirs := Nil_String;
 
@@ -5841,7 +5844,7 @@ package body Prj.Nmsc is
       elsif Source_Dirs.Default then
 
          --  No Source_Dirs specified: the single source directory is the one
-         --  containing the project file
+         --  containing the project file.
 
          String_Element_Table.Append (In_Tree.String_Elements,
            (Value         => Name_Id (Project.Directory.Name),
@@ -5850,8 +5853,8 @@ package body Prj.Nmsc is
             Flag          => False,
             Next          => Nil_String,
             Index         => 0));
-         Project.Source_Dirs := String_Element_Table.Last
-                                  (In_Tree.String_Elements);
+         Project.Source_Dirs :=
+           String_Element_Table.Last (In_Tree.String_Elements);
 
          if Current_Verbosity = High then
             Write_Attr
@@ -6077,8 +6080,8 @@ package body Prj.Nmsc is
       Unit      : out Name_Id;
       In_Tree   : Project_Tree_Ref)
    is
-      Filename : constant String := Get_Name_String (File_Name);
-      Last     : Integer := Filename'Last;
+      Filename : constant String  := Get_Name_String (File_Name);
+      Last     : Integer          := Filename'Last;
       Sep_Len  : constant Integer :=
                    Integer (Length_Of_Name (Naming.Separate_Suffix));
       Body_Len : constant Integer :=
@@ -6346,11 +6349,11 @@ package body Prj.Nmsc is
             Unit_Kind := Spec;
          else
             Compute_Unit_Name
-              (File_Name       => Canonical_File_Name,
-               Naming          => Lang.Config.Naming_Data,
-               Kind            => Kind,
-               Unit            => Unit_Name,
-               In_Tree         => In_Tree);
+              (File_Name => Canonical_File_Name,
+               Naming    => Lang.Config.Naming_Data,
+               Kind      => Kind,
+               Unit      => Unit_Name,
+               In_Tree   => In_Tree);
 
             case Kind is
                when Spec       => Unit_Kind := Spec;
@@ -6594,8 +6597,7 @@ package body Prj.Nmsc is
       Locally_Removed : Boolean := False;
 
    begin
-      --  If Excluded_Source_Files is not declared, check
-      --  Locally_Removed_Files.
+      --  If Excluded_Source_Files is not declared, check Locally_Removed_Files
 
       if Excluded_Sources.Default then
          Locally_Removed := True;
@@ -6683,8 +6685,7 @@ package body Prj.Nmsc is
                      then
                         Name_Len := Last;
                         Name_Buffer (1 .. Name_Len) := Line (1 .. Last);
-                        Canonical_Case_File_Name
-                          (Name_Buffer (1 .. Name_Len));
+                        Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
                         Name := Name_Find;
 
                         --  Check that there is no directory information
@@ -6726,18 +6727,19 @@ package body Prj.Nmsc is
       Proc_Data                 : in out Processing_Data;
       Allow_Duplicate_Basenames : Boolean)
    is
-      Sources          : constant Variable_Value :=
-                           Util.Value_Of
-                             (Name_Source_Files,
-                              Project.Decl.Attributes,
-                              In_Tree);
+      Sources : constant Variable_Value :=
+                  Util.Value_Of
+                    (Name_Source_Files,
+                    Project.Decl.Attributes,
+                    In_Tree);
+
       Source_List_File : constant Variable_Value :=
                            Util.Value_Of
                              (Name_Source_List_File,
                               Project.Decl.Attributes,
                               In_Tree);
-      Name_Loc         : Name_Location;
 
+      Name_Loc             : Name_Location;
       Has_Explicit_Sources : Boolean;
 
    begin
@@ -6913,12 +6915,21 @@ package body Prj.Nmsc is
               and then Source.Path = No_Path_Information
             then
                if Source.Unit /= No_Unit_Index then
-                  Error_Msg_Name_1 := Name_Id (Source.Display_File);
-                  Error_Msg_Name_2 := Name_Id (Source.Unit.Name);
-                  Error_Msg
-                    (Project, In_Tree,
-                     "source file %% for unit %% not found",
-                     No_Location);
+
+                  --  ??? Current limitation of gprbuild will display this
+                  --  error message for multi-unit source files, because not
+                  --  all instances of the file have had their path fully set.
+
+                  if Source.Index = 0
+                    or else Source.Index = 1
+                  then
+                     Error_Msg_Name_1 := Name_Id (Source.Display_File);
+                     Error_Msg_Name_2 := Name_Id (Source.Unit.Name);
+                     Error_Msg
+                       (Project, In_Tree,
+                        "source file %% for unit %% not found",
+                        No_Location);
+                  end if;
                end if;
 
                Remove_Source (Source, No_Source);
@@ -7060,10 +7071,9 @@ package body Prj.Nmsc is
                   --  ??? We could probably optimize the following call: we
                   --  need to resolve links only once for the directory itself,
                   --  and then do a single call to readlink() for each file.
-                  --  Unfortunately that would require a change in
-                  --  Normalize_Pathname so that it has the option of not
-                  --  resolving links for its Directory parameter, only for
-                  --  Name.
+                  --  Unfortunately that would require Normalize_Pathname to
+                  --  be changed so that it has the option of not resolving
+                  --  links for its Directory parameter, only for Name.
 
                   Path : constant String :=
                     Normalize_Pathname
@@ -7447,8 +7457,8 @@ package body Prj.Nmsc is
                  or else
                    (Unit = No_Name and then Source.File = File_Name)
                then
-                  --  Duplication of file/unit in same project is only
-                  --  allowed if order of source directories is known.
+                  --  Duplication of file/unit in same project is only allowed
+                  --  if order of source directories is known.
 
                   if Project = Source.Project then
                      if Unit = No_Name then
@@ -7585,12 +7595,12 @@ package body Prj.Nmsc is
 
                      exit when Last = 0;
 
-                     --  ??? Duplicate system call here, we just did a
-                     --  similar one. Maybe Ada.Directories would be more
-                     --  appropriate here
+                     --  ??? Duplicate system call here, we just did a a
+                     --  similar one. Maybe Ada.Directories would be more
+                     --  appropriate here.
 
                      if Is_Regular_File
-                       (Source_Directory & Name (1 .. Last))
+                          (Source_Directory & Name (1 .. Last))
                      then
                         if Current_Verbosity = High then
                            Write_Str  ("   Checking ");
@@ -8126,8 +8136,7 @@ package body Prj.Nmsc is
                Err_Vars.Error_Msg_File_1 :=
                  File_Name_Type (UData.File_Names (Unit_Kind).Path.Name);
                Error_Msg
-                 (Project, In_Tree,
-                  "\   project file %%, {", The_Location);
+                 (Project, In_Tree, "\   project file %%, {", The_Location);
 
                Err_Vars.Error_Msg_Name_1 := Project.Name;
                Err_Vars.Error_Msg_File_1 := File_Name_Type (Canonical_Path);
@@ -8164,17 +8173,17 @@ package body Prj.Nmsc is
          if To_Record then
             Files_Htable.Set (Proc_Data.Units, Canonical_File, Project);
             Add_Source
-              (Id                  => Source,
-               In_Tree             => In_Tree,
-               Project             => Project,
-               Lang_Id             => Ada_Language,
-               File_Name           => Canonical_File,
-               Display_File        => File_Name,
-               Unit                => Unit_Name,
-               Path                => (Canonical_Path, Path_Name),
-               Naming_Exception    => Needs_Pragma,
-               Kind                => Unit_Kind,
-               Index               => Unit_Ind);
+              (Id               => Source,
+               In_Tree          => In_Tree,
+               Project          => Project,
+               Lang_Id          => Ada_Language,
+               File_Name        => Canonical_File,
+               Display_File     => File_Name,
+               Unit             => Unit_Name,
+               Path             => (Canonical_Path, Path_Name),
+               Naming_Exception => Needs_Pragma,
+               Kind             => Unit_Kind,
+               Index            => Unit_Ind);
             Source_Recorded := True;
          end if;
       end Record_Unit;
index 7f04e88..ad96467 100644 (file)
@@ -6460,7 +6460,7 @@ package Sinfo is
       --  The Ada language does not permit conditional expressions, however
       --  this is under discussion as a possible extension by the ARG, and we
       --  have implemented a form of this capability in GNAT under control of
-      --  the -X switch. The syntax is:
+      --  the -gnatX switch. The syntax is:
 
       --  CONDITIONAL_EXPRESSION ::=
       --    if EXPRESSION then EXPRESSION