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  <cel...@adacore.com>

        * 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 :=

Reply via email to