aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/a-sequio.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-10-10 14:17:35 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-10-10 14:17:35 +0200
commit15918371923d3e31a9f74c46fbe94e7e1e6d76e6 (patch)
treecd80a5317c5228f3994e9670042a976f5b3fa86b /gcc/ada/a-sequio.adb
parentb184c8f13820b011a119ce9c900b73986f3c5351 (diff)
downloadgcc-15918371923d3e31a9f74c46fbe94e7e1e6d76e6.zip
gcc-15918371923d3e31a9f74c46fbe94e7e1e6d76e6.tar.gz
gcc-15918371923d3e31a9f74c46fbe94e7e1e6d76e6.tar.bz2
[multiple changes]
2013-10-10 Robert Dewar <dewar@adacore.com> * lib-xref-spark_specific.adb, par-ch13.adb, sem_prag.adb, sem_prag.ads, sem_ch12.adb, sem_attr.adb, sem_ch6.adb, sem_ch13.adb, a-sequio.adb, s-atocou-builtin.adb: Minor reformatting. 2013-10-10 Thomas Quinot <quinot@adacore.com> * s-oscons-tmplt.c (NEED_PTHREAD_CONDATTR_SETCLOCK): This constant needs to be output to s-oscons.h, as it is tested by init.c. 2013-10-10 Robert Dewar <dewar@adacore.com> * exp_ch3.adb (Expand_N_Variant_Part): Don't expand choices, too early * exp_ch5.adb (Expand_N_Case_Statement): Use new Has_SP_Choice flag to avoid expanding choices when not necessary. * exp_util.adb: Minor reformatting * freeze.adb (Freeze_Record_Type): Redo expansion of variants * sem_aggr.adb: Minor reformatting * sem_case.ads, sem_case.adb: Major rewrite, separating Analysis and Checking of choices. * sem_ch3.adb (Analyze_Variant_Part): Rewrite to call new Analyze_Choices. * sem_ch4.adb (Analyze_Case_Expression): Call Analyze_Choices and Check_Choices * sem_ch5.adb (Analyze_Case_Statement): Call Analyze_Choices and Check_Choices * sem_util.adb: Minor reformatting * sinfo.ads, sinfo.adb (Has_SP_Choice): New flag. 2013-10-10 Vincent Celier <celier@adacore.com> * mlib-prj.adb (Build_Library): Do not issue link dynamic libraries with an Rpath, if switch -R was used. 2013-10-10 Tristan Gingold <gingold@adacore.com> * s-stalib.ads (Image_Index_Table_8, Image_Index_Table_16, Image_Index_Table_32): Remove as not used. * s-imgint.adb (Image_Integer): Call Set_Image_Integer and remove duplicated code. From-SVN: r203358
Diffstat (limited to 'gcc/ada/a-sequio.adb')
-rw-r--r--gcc/ada/a-sequio.adb16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/ada/a-sequio.adb b/gcc/ada/a-sequio.adb
index b9442e9..b842528 100644
--- a/gcc/ada/a-sequio.adb
+++ b/gcc/ada/a-sequio.adb
@@ -35,13 +35,15 @@
-- (for specialized Sequential_IO functions)
with Ada.Unchecked_Conversion;
+
with System;
+with System.Byte_Swapping;
with System.CRTL;
with System.File_Control_Block;
with System.File_IO;
with System.Storage_Elements;
+
with Interfaces.C_Streams; use Interfaces.C_Streams;
-with GNAT.Byte_Swapping;
package body Ada.Sequential_IO is
@@ -69,11 +71,11 @@ package body Ada.Sequential_IO is
---------------
procedure Byte_Swap (Siz : in out size_t) is
- use GNAT.Byte_Swapping;
+ use System.Byte_Swapping;
begin
case Siz'Size is
- when 32 => Swap4 (Siz'Address);
- when 64 => Swap8 (Siz'Address);
+ when 32 => Siz := size_t (Bswap_32 (U32 (Siz)));
+ when 64 => Siz := size_t (Bswap_64 (U64 (Siz)));
when others => raise Program_Error;
end case;
end Byte_Swap;
@@ -189,6 +191,9 @@ package body Ada.Sequential_IO is
FIO.Read_Buf
(AP (File), Rsiz'Address, size_t'Size / System.Storage_Unit);
+ -- If item read has non-default scalar storage order, then the size
+ -- will have been written with that same order, so byte swap it.
+
if Element_Type'Scalar_Storage_Order /= System.Default_Bit_Order then
Byte_Swap (Rsiz);
end if;
@@ -288,6 +293,9 @@ package body Ada.Sequential_IO is
if not Element_Type'Definite
or else Element_Type'Has_Discriminants
then
+ -- If item written has non-default scalar storage order, then the
+ -- size is written with that same order, so byte swap it.
+
if Element_Type'Scalar_Storage_Order /= System.Default_Bit_Order then
Byte_Swap (Swapped_Siz);
end if;