summaryrefslogtreecommitdiff
path: root/gcc/ada/gnatcmd.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gnatcmd.adb')
-rw-r--r--gcc/ada/gnatcmd.adb14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb
index 1919f9a0035..2fa479cc980 100644
--- a/gcc/ada/gnatcmd.adb
+++ b/gcc/ada/gnatcmd.adb
@@ -1999,7 +1999,19 @@ begin
In_Arrays => Element.Decl.Arrays,
Shared => Project_Tree.Shared);
Name_Len := 0;
- Add_Str_To_Name_Buffer (Main.all);
+
+ -- If the single main has been specified as an absolute
+ -- path, use only the simple file name. If the absolute
+ -- path is incorrect, an error will be reported by the
+ -- underlying tool and it does not make a difference
+ -- what switches are used.
+
+ if Is_Absolute_Path (Main.all) then
+ Add_Str_To_Name_Buffer (File_Name (Main.all));
+ else
+ Add_Str_To_Name_Buffer (Main.all);
+ end if;
+
The_Switches := Prj.Util.Value_Of
(Index => Name_Find,
Src_Index => 0,