diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-04-25 17:54:39 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-04-25 17:54:39 +0200 |
commit | 211e7410b32e6cb4b45d414883c5d6d5f37faa31 (patch) | |
tree | 55dae71c0ef21060e28548eed6b71f8e8f1b0965 /gcc/ada/osint.adb | |
parent | f66c70dc0392cfa06f6414a8b9fa65adb9051b58 (diff) | |
download | gcc-211e7410b32e6cb4b45d414883c5d6d5f37faa31.tar.gz |
[multiple changes]
2017-04-25 Arnaud Charlet <charlet@adacore.com>
* exp_ch4.adb (Expand_N_Case_Expression): Emit error message when
generating C code on complex case expressions.
2017-04-25 Arnaud Charlet <charlet@adacore.com>
* sem_prag.adb (Analyze_Pragma): Generate a warning instead
of silently ignoring pragma Ada_xxx in Latest_Ada_Only mode.
* directio.ads, ioexcept.ads, sequenio.ads, text_io.ads: Use
Ada_2012 instead of Ada_2005 to be compatible with the above
change.
* bindgen.adb: Silence new warning on pragma Ada_95.
2017-04-25 Hristian Kirtchev <kirtchev@adacore.com>
* checks.adb (Generate_Range_Check): Revert part of previous change.
2017-04-25 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Try_Container_Indexing): Handle properly a
container indexing operation that appears as a an actual in a
parameter association in a procedure call.
2017-04-25 Olivier Ramonat <ramonat@adacore.com>
* prj-proc.adb, sem_util.adb, s-stposu.adb, sem_attr.adb, prj-conf.ads:
Fix spelling mistakes.
2017-04-25 Bob Duff <duff@adacore.com>
* types.ads, osint.adb, sinput-c.adb, sinput-d.adb, sinput-l.adb,
* sinput-p.adb: Use regular fat pointers, with bounds checking,
for source buffers. Fix misc obscure bugs.
* sinput.ads, sinput.adb: Use regular fat pointers, with bounds
checking, for source buffers. Modify representation clause for
Source_File_Record as appropriate. Move Source_File_Index_Table
from spec to body, because it is not used outside the body.
Move Set_Source_File_Index_Table into the private part, because
it is used only in the body and in children. Use trickery to
modify the dope in the generic instantiation case. It's ugly,
but not as ugly as the previous method. Fix documentation.
Remove obsolete code.
* fname-sf.adb, targparm.adb: Fix misc out-of-bounds
indexing in source buffers.
* fmap.adb: Avoid conversions from one string type to another.
Remove a use of global name buffer.
* osint.ads, sfn_scan.ads, sfn_scan.adb, sinput-c.ads: Comment
fixes.
From-SVN: r247252
Diffstat (limited to 'gcc/ada/osint.adb')
-rw-r--r-- | gcc/ada/osint.adb | 42 |
1 files changed, 10 insertions, 32 deletions
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb index 7dbb84cfb2d..8e958c5f8a9 100644 --- a/gcc/ada/osint.adb +++ b/gcc/ada/osint.adb @@ -2651,49 +2651,23 @@ package body Osint is -- Do the actual read operation declare - subtype Actual_Source_Buffer is Source_Buffer (Lo .. Hi); - -- Physical buffer allocated - - type Actual_Source_Ptr is access Actual_Source_Buffer; - -- This is the pointer type for the physical buffer allocated - - Actual_Ptr : constant Actual_Source_Ptr := new Actual_Source_Buffer; - -- And this is the actual physical buffer - - begin + Var_Ptr : constant Source_Buffer_Ptr_Var := + new Source_Buffer (Lo .. Hi); -- Allocate source buffer, allowing extra character at end for EOF - + begin -- Some systems have file types that require one read per line, -- so read until we get the Len bytes or until there are no more -- characters. Hi := Lo; loop - Actual_Len := Read (Source_File_FD, Actual_Ptr (Hi)'Address, Len); + Actual_Len := Read (Source_File_FD, Var_Ptr (Hi)'Address, Len); Hi := Hi + Source_Ptr (Actual_Len); exit when Actual_Len = Len or else Actual_Len <= 0; end loop; - Actual_Ptr (Hi) := EOF; - - -- Now we need to work out the proper virtual origin pointer to - -- return. This is exactly Actual_Ptr (0)'Address, but we have to - -- be careful to suppress checks to compute this address. - - declare - pragma Suppress (All_Checks); - - pragma Warnings (Off); - -- This use of unchecked conversion is aliasing safe - - function To_Source_Buffer_Ptr is new - Unchecked_Conversion (Address, Source_Buffer_Ptr); - - pragma Warnings (On); - - begin - Src := To_Source_Buffer_Ptr (Actual_Ptr (0)'Address); - end; + Var_Ptr (Hi) := EOF; + Src := Var_Ptr.all'Access; end; -- Read is complete, get time stamp and close file and we are done @@ -2703,6 +2677,10 @@ package body Osint is -- The status should never be False. But, if it is, what can we do? -- So, we don't test it. + -- ???We don't really need to return Hi anymore; We could get rid of + -- it. We could also make this into a function. + + pragma Assert (Hi = Src'Last); end Read_Source_File; ------------------- |