Re: 673015 (gprbuild: [hurd-i386] could not create $DIRECTORY/auto.cgpr)
On Tue, 2012-06-26 at 21:44 +0200, Svante Signell wrote:
> Sorry, did'nt realize the questions were addressed to me. Answers below.
> Adding a Cc: to 673015.
>
> On Sun, 2012-06-17 at 13:34 +0200, Nicolas Boulenguez wrote:
> > Hello.
...
>
> > The trace mentioned in
> > http://lists.debian.org/debian-ada/2012/05/msg00031.html refers to
> > -- src/gprconfig-knowledge.adb:682
> > begin
> > 682 Compiler.Prefix_Index := Integer'Value (Prefix);
> > exception
> > when Constraint_Error =>
> > Compiler.Prefix_Index := -1;
> > end;
> > --
> > I fail to understand how Constraint_Error can exit from such a snippet
> > which explicitely catches it. Compiler.Prefix_Index is an Integer
> > without range restriction.
> >
> > What is the result of adding this line, or the equivalent information
> > given by the debugger?
> > --
> > 681.5 Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error, "Prefix: """ & Prefix & """.");
> > --
Isn't something wrong with the following code: from
src/gprconfig-knowledge.adb
declare
Prefix : constant String :=
Get_Attribute (N, "prefix", "@@");
Val : constant String := Node_Value_As_String (N);
begin
if Val = "" then
-- A special language that requires no executable. We do
-- not store it in the list of compilers, since these
-- should not be detected on the PATH anyway.
Compiler.Executable := No_Name;
else
Compiler.Executable := Get_String (Val);
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, "Prefix: """ & Prefix & """.");
Compiler.Prefix_Index := Integer'Value (Prefix);
exception
when Constraint_Error =>
Compiler.Prefix_Index := -1;
end;
...
Get_Attribute is declared as retuning a string:
function Get_Attribute
(N : Node; Attribute : String; Default : String) return String;
-- Return the value of an attribute, or Default if the attribute
does not
-- exist
Yet, the code above tries to get the Integer'Value of Prefix, while the
Default value is set to the string "@@"?
Reply to: