From patchwork Mon Jun 14 09:17:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Ada] GNAT driver, ASIS tools and switch -files= Date: Sun, 13 Jun 2010 23:17:41 -0000 From: Arnaud Charlet X-Patchwork-Id: 55497 Message-Id: <20100614091741.GA18447@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Vincent Celier When the gnat driver is invoked for gnatpp, gnatmetric or gnatstack with a project file, if switch -files is used, then the ASIS tool is invoked without the list of all sources of the project, even if no source is specified in the gnat driver invocation. The test for this is to invoke the gnat driver with a project file and -files= and to check that the ASIS tool is called with only one switch -files. Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-14 Vincent Celier * gnatcmd.adb (Check_Files): Do not invoke the tool with all the sources of the project if a switch -files= is used. Index: gnatcmd.adb =================================================================== --- gnatcmd.adb (revision 160705) +++ gnatcmd.adb (working copy) @@ -209,9 +209,9 @@ procedure GNATCmd is procedure Check_Files; -- For GNAT LIST, GNAT PRETTY, GNAT METRIC, and GNAT STACK, check if a - -- project file is specified, without any file arguments. If it is the - -- case, invoke the GNAT tool with the proper list of files, derived from - -- the sources of the project. + -- project file is specified, without any file arguments and without a + -- switch -files=. If it is the case, invoke the GNAT tool with the proper + -- list of files, derived from the sources of the project. function Check_Project (Project : Project_Id; @@ -314,10 +314,17 @@ procedure GNATCmd is Success : Boolean; begin - -- Check if there is at least one argument that is not a switch + -- Check if there is at least one argument that is not a switch or if + -- there is a -files= switch. for Index in 1 .. Last_Switches.Last loop - if Last_Switches.Table (Index) (1) /= '-' then + if Last_Switches.Table (Index).all'Length > 7 and then + Last_Switches.Table (Index) (1 .. 7) = "-files=" + then + Add_Sources := False; + exit; + + elsif Last_Switches.Table (Index) (1) /= '-' then if Index = 1 or else (The_Command = Check @@ -346,8 +353,8 @@ procedure GNATCmd is end if; end loop; - -- If all arguments were switches, add the path names of all the sources - -- of the main project. + -- If all arguments are switchesand there is no switch -files=, add the + -- path names of all the sources of the main project. if Add_Sources then