summaryrefslogtreecommitdiff
path: root/gcc/ada/mdll-utl.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/mdll-utl.adb')
-rw-r--r--gcc/ada/mdll-utl.adb62
1 files changed, 44 insertions, 18 deletions
diff --git a/gcc/ada/mdll-utl.adb b/gcc/ada/mdll-utl.adb
index c7fb1554866..82c33b0d6c1 100644
--- a/gcc/ada/mdll-utl.adb
+++ b/gcc/ada/mdll-utl.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2003 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- --
@@ -20,7 +20,7 @@
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
--- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
@@ -29,6 +29,7 @@
with Ada.Text_IO;
with Ada.Exceptions;
+with GNAT.Directory_Operations;
with Sdefault;
package body MDLL.Utl is
@@ -137,8 +138,8 @@ package body MDLL.Utl is
OS_Lib.Spawn (Dlltool_Exec.all, Arguments (1 .. A), Success);
if not Success then
- Exceptions.Raise_Exception (Tools_Error'Identity,
- Dlltool_Name & " execution error.");
+ Exceptions.Raise_Exception
+ (Tools_Error'Identity, Dlltool_Name & " execution error.");
end if;
end Dlltool;
@@ -217,8 +218,8 @@ package body MDLL.Utl is
OS_Lib.Spawn (Gcc_Exec.all, Arguments (1 .. A), Success);
if not Success then
- Exceptions.Raise_Exception (Tools_Error'Identity,
- Gcc_Name & " execution error.");
+ Exceptions.Raise_Exception
+ (Tools_Error'Identity, Gcc_Name & " execution error.");
end if;
end Gcc;
@@ -244,9 +245,19 @@ package body MDLL.Utl is
OS_Lib.Spawn (Gnatbind_Exec.all, Arguments, Success);
+ -- Delete binder files on failure
+
if not Success then
- Exceptions.Raise_Exception (Tools_Error'Identity,
- Gnatbind_Name & " execution error.");
+ declare
+ Base_Name : constant String :=
+ Directory_Operations.Base_Name (Alis (1).all, ".ali");
+ begin
+ OS_Lib.Delete_File ("b~" & Base_Name & ".ads", Success);
+ OS_Lib.Delete_File ("b~" & Base_Name & ".adb", Success);
+ end;
+
+ Exceptions.Raise_Exception
+ (Tools_Error'Identity, Gnatbind_Name & " execution error.");
end if;
end Gnatbind;
@@ -272,8 +283,19 @@ package body MDLL.Utl is
OS_Lib.Spawn (Gnatlink_Exec.all, Arguments, Success);
if not Success then
- Exceptions.Raise_Exception (Tools_Error'Identity,
- Gnatlink_Name & " execution error.");
+ -- Delete binder files
+ declare
+ Base_Name : constant String :=
+ Directory_Operations.Base_Name (Ali, ".ali");
+ begin
+ OS_Lib.Delete_File ("b~" & Base_Name & ".ads", Success);
+ OS_Lib.Delete_File ("b~" & Base_Name & ".adb", Success);
+ OS_Lib.Delete_File ("b~" & Base_Name & ".ali", Success);
+ OS_Lib.Delete_File ("b~" & Base_Name & ".o", Success);
+ end;
+
+ Exceptions.Raise_Exception
+ (Tools_Error'Identity, Gnatlink_Name & " execution error.");
end if;
end Gnatlink;
@@ -289,8 +311,9 @@ package body MDLL.Utl is
Dlltool_Exec := OS_Lib.Locate_Exec_On_Path (Dlltool_Name);
if Dlltool_Exec = null then
- Exceptions.Raise_Exception (Tools_Error'Identity,
- Dlltool_Name & " not found in path");
+ Exceptions.Raise_Exception
+ (Tools_Error'Identity, Dlltool_Name & " not found in path");
+
elsif Verbose then
Text_IO.Put_Line ("using " & Dlltool_Exec.all);
end if;
@@ -300,8 +323,9 @@ package body MDLL.Utl is
Gcc_Exec := OS_Lib.Locate_Exec_On_Path (Gcc_Name);
if Gcc_Exec = null then
- Exceptions.Raise_Exception (Tools_Error'Identity,
- Gcc_Name & " not found in path");
+ Exceptions.Raise_Exception
+ (Tools_Error'Identity, Gcc_Name & " not found in path");
+
elsif Verbose then
Text_IO.Put_Line ("using " & Gcc_Exec.all);
end if;
@@ -311,8 +335,9 @@ package body MDLL.Utl is
Gnatbind_Exec := OS_Lib.Locate_Exec_On_Path (Gnatbind_Name);
if Gnatbind_Exec = null then
- Exceptions.Raise_Exception (Tools_Error'Identity,
- Gnatbind_Name & " not found in path");
+ Exceptions.Raise_Exception
+ (Tools_Error'Identity, Gnatbind_Name & " not found in path");
+
elsif Verbose then
Text_IO.Put_Line ("using " & Gnatbind_Exec.all);
end if;
@@ -322,8 +347,9 @@ package body MDLL.Utl is
Gnatlink_Exec := OS_Lib.Locate_Exec_On_Path (Gnatlink_Name);
if Gnatlink_Exec = null then
- Exceptions.Raise_Exception (Tools_Error'Identity,
- Gnatlink_Name & " not found in path");
+ Exceptions.Raise_Exception
+ (Tools_Error'Identity, Gnatlink_Name & " not found in path");
+
elsif Verbose then
Text_IO.Put_Line ("using " & Gnatlink_Exec.all);
Text_IO.New_Line;