From patchwork Tue Jan 29 14:18:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Ada] gnat stub -P crashes when Ada is not a language of the project Date: Tue, 29 Jan 2013 04:18:05 -0000 From: Arnaud Charlet X-Patchwork-Id: 216549 Message-Id: <20130129141805.GA26078@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Vincent Celier This patch prevents the GNAT driver from crashing when it is called as "gnat stub -P ..." and Ada is not one of the languages of the project, for example if the project is an aggregate project. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-29 Vincent Celier * gnatcmd.adb: For "gnat stub -P ...", do not check the naming scheme for Ada, when Ada is not a language for the project. Index: gnatcmd.adb =================================================================== --- gnatcmd.adb (revision 195535) +++ gnatcmd.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2013, 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- -- @@ -2477,7 +2477,9 @@ -- the file name ends with the spec suffix, then indicate to -- gnatstub the name of the body file with a -o switch. - if not Is_Standard_GNAT_Naming (Lang.Config.Naming_Data) then + if Lang /= No_Language_Index + and then not Is_Standard_GNAT_Naming (Lang.Config.Naming_Data) + then if File_Index /= 0 then declare Spec : constant String :=