[Ada] Register source directories even if they do not exist

Submitted by Arnaud Charlet on Sept. 10, 2010, 2:48 p.m.

Details

Message ID 20100910144857.GA31750@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Sept. 10, 2010, 2:48 p.m.
The project manager is used in different contexts, and IDEs, in
particular, should display as much information as possible to the user,
even if the project is incorrect in the context of tools like gnatmake.

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-09-10  Emmanuel Briot  <briot@adacore.com>

	* prj-nmsc.adb (Find_Source_Dirs): When a source directory is not
	present, and the user requested to either ignore this or display a
	warning (as opposed to an error), we still need to register the
	directory.

Patch hide | download patch | download mbox

Index: prj-nmsc.adb
===================================================================
--- prj-nmsc.adb	(revision 164170)
+++ prj-nmsc.adb	(working copy)
@@ -5208,6 +5208,7 @@  package body Prj.Nmsc is
                                Resolve_Links  =>
                                  Opt.Follow_Links_For_Dirs,
                                Case_Sensitive => True);
+               Has_Error : Boolean := False;
 
             begin
                if Root_Dir'Length = 0 then
@@ -5215,8 +5216,10 @@  package body Prj.Nmsc is
                   Error_Or_Warning
                     (Data.Flags, Data.Flags.Missing_Source_Files,
                      "{ is not a valid directory.", Location, Project);
+                  Has_Error := Data.Flags.Missing_Source_Files = Error;
+               end if;
 
-               else
+               if not Has_Error then
                   --  We have an existing directory, we register it and all of
                   --  its subdirectories.
 
@@ -5240,6 +5243,7 @@  package body Prj.Nmsc is
             declare
                Path_Name  : Path_Information;
                Dir_Exists : Boolean;
+               Has_Error  : Boolean := False;
 
             begin
                Locate_Directory
@@ -5255,8 +5259,10 @@  package body Prj.Nmsc is
                   Error_Or_Warning
                     (Data.Flags, Data.Flags.Missing_Source_Files,
                      "{ is not a valid directory", Location, Project);
+                  Has_Error := Data.Flags.Missing_Source_Files = Error;
+               end if;
 
-               else
+               if not Has_Error then
                   --  links have been resolved if necessary, and Path_Name
                   --  always ends with a directory separator
                   Add_To_Or_Remove_From_Source_Dirs