This patch adds a new routine to query the first file argument of the
commandline without moving to the next file. This is needed in SPARK.
There is no impact on compilation.
Tested on x86_64-pc-linux-gnu, committed on trunk
2019-07-03 Johannes Kanig <ka...@adacore.com>
gcc/ada/
* osint.ads, osint.adb (Get_First_Main_File_Name): New routine
to access the first file provided on the command line.
--- gcc/ada/osint.adb
+++ gcc/ada/osint.adb
@@ -1422,6 +1422,15 @@ package body Osint is
return Name_Find;
end Get_Directory;
+ ------------------------------
+ -- Get_First_Main_File_Name --
+ ------------------------------
+
+ function Get_First_Main_File_Name return String is
+ begin
+ return File_Names (1).all;
+ end Get_First_Main_File_Name;
+
--------------------------
-- Get_Next_Dir_In_Path --
--------------------------
--- gcc/ada/osint.ads
+++ gcc/ada/osint.ads
@@ -511,6 +511,9 @@ package Osint is
procedure Dump_Command_Line_Source_File_Names;
-- Prints out the names of all source files on the command-line
+ function Get_First_Main_File_Name return String;
+ -- Return the file name of the first main file
+
-------------------------------------------
-- Representation of Library Information --
-------------------------------------------