aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/osint.adb
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2017-09-29 15:33:23 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2017-09-29 15:33:23 +0000
commitcd644ae2bc0ce62b88f786ce5a68ad0ba2509ec6 (patch)
tree5b626698ecdaf41e2a8f95028be8c76b863eaed6 /gcc/ada/osint.adb
parente75210d645630f12bf149043cf6ae51829f5ed78 (diff)
downloadgcc-cd644ae2bc0ce62b88f786ce5a68ad0ba2509ec6.zip
gcc-cd644ae2bc0ce62b88f786ce5a68ad0ba2509ec6.tar.gz
gcc-cd644ae2bc0ce62b88f786ce5a68ad0ba2509ec6.tar.bz2
[multiple changes]
2017-09-29 Bob Duff <duff@adacore.com> * exp_ch6.adb (Expand_Call_Helper): Replace with code more similar to what we had before. (Make_Build_In_Place_Call_In_Object_Declaration): Back out previous change. Set the Etype in the class-wide case. This fixes a regression in the libadalang test suite. 2017-09-29 Joel Brobecker <brobecker@adacore.com> * doc/gnat_ugn/building_executable_programs_with_gnat.rst, doc/gnat_ugn/the_gnat_compilation_model.rst: Avoid use of single colon in comment markup. * gnat_ugn.texi: Regenerate. 2017-09-29 Justin Squirek <squirek@adacore.com> * ali-util.adb, comperr.adb, cprint.adb, errout.adb, fmap.adb, fname-sf.adb, frontend.adb, lib-xref-spark_specific.adb, gnat1drv.adb, gnatls.adb, lib.adb, lib-load.adb, lib-writ.adb, prepcomp.adb, sinput-d.adb, sinput-l.adb, sprint.adb, targparm.adb: Update comparison for checking source file status and error message and/or call to Read_Source_File. * libgnat/s-os_lib.ads: Add new potential value constant for uninitialized file descriptors. * osint.adb, osint.ads (Read_Source_File): Add extra parameter to return result of IO to encompass a read access failure in addition to a file-not-found error. From-SVN: r253294
Diffstat (limited to 'gcc/ada/osint.adb')
-rw-r--r--gcc/ada/osint.adb14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index 105e866..781db47 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -2565,9 +2565,10 @@ package body Osint is
Lo : Source_Ptr;
Hi : out Source_Ptr;
Src : out Source_Buffer_Ptr;
+ FD : out File_Descriptor;
T : File_Type := Source)
is
- Source_File_FD : File_Descriptor;
+ -- Source_File_FD : File_Descriptor;
-- The file descriptor for the current source file. A negative value
-- indicates failure to open the specified source file.
@@ -2594,6 +2595,7 @@ package body Osint is
Fail ("Cannot find: " & Name_Buffer (1 .. Name_Len));
end if;
+ FD := Null_FD;
Src := null;
Hi := No_Location;
return;
@@ -2607,9 +2609,9 @@ package body Osint is
-- DOS or Unix mode files, and there is no point in wasting time on
-- text translation when it is not required.
- Source_File_FD := Open_Read (Name_Buffer'Address, Binary);
+ FD := Open_Read (Name_Buffer'Address, Binary);
- if Source_File_FD = Invalid_FD then
+ if FD = Invalid_FD then
Src := null;
Hi := No_Location;
return;
@@ -2645,7 +2647,7 @@ package body Osint is
-- Prepare to read data from the file
- Len := Integer (File_Length (Source_File_FD));
+ Len := Integer (File_Length (FD));
-- Set Hi so that length is one more than the physical length,
-- allowing for the extra EOF character at the end of the buffer
@@ -2665,7 +2667,7 @@ package body Osint is
Hi := Lo;
loop
- Actual_Len := Read (Source_File_FD, Var_Ptr (Hi)'Address, Len);
+ Actual_Len := Read (FD, Var_Ptr (Hi)'Address, Len);
Hi := Hi + Source_Ptr (Actual_Len);
exit when Actual_Len = Len or else Actual_Len <= 0;
end loop;
@@ -2676,7 +2678,7 @@ package body Osint is
-- Read is complete, get time stamp and close file and we are done
- Close (Source_File_FD, Status);
+ Close (FD, Status);
-- The status should never be False. But, if it is, what can we do?
-- So, we don't test it.