Patchwork [Ada] No crash if a variable Project_Path was defined in a project

login
register
mail settings
Submitter Arnaud Charlet
Date Oct. 24, 2011, 9:32 a.m.
Message ID <20111024093223.GA21482@adacore.com>
Download mbox | patch
Permalink /patch/121309/
State New
Headers show

Comments

Arnaud Charlet - Oct. 24, 2011, 9:32 a.m.
This patches fixes a regression introduced when adding support for
aggregate projects. The latter now accept a new list attribute called
Project_Path. But if the user already has a string variable by this name,
the project can no longer be loaded by GNAT. The following project should
be loaded with success:

project Default is
   Project_Path := "value";
end Default;

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

2011-10-24  Emmanuel Briot  <briot@adacore.com>

	* prj-proc.adb (Process_Expression_Variable_Decl): No special
	handling for Project_Path unless it is an attribute.

Patch

Index: prj-proc.adb
===================================================================
--- prj-proc.adb	(revision 180365)
+++ prj-proc.adb	(working copy)
@@ -2053,7 +2053,7 @@ 
             Shared.Variable_Elements.Table (Var).Value := New_Value;
          end if;
 
-         if Name = Snames.Name_Project_Path then
+         if Is_Attribute and then Name = Snames.Name_Project_Path then
             if In_Tree.Is_Root_Tree then
                declare
                   Val : String_List_Id := New_Value.Values;