aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/open.c
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2017-11-22 21:19:13 +0200
committerJanne Blomqvist <jb@gcc.gnu.org>2017-11-22 21:19:13 +0200
commit5675291ddbc7c7bee1b4722f1358a276365c0ee5 (patch)
treed591cf873aa6b611276b396c56845bbd1e9af949 /libgfortran/io/open.c
parent90b415f686b16f9492cd9b11c4f5c3f3c937d5d9 (diff)
downloadgcc-5675291ddbc7c7bee1b4722f1358a276365c0ee5.zip
gcc-5675291ddbc7c7bee1b4722f1358a276365c0ee5.tar.gz
gcc-5675291ddbc7c7bee1b4722f1358a276365c0ee5.tar.bz2
PR 83097 Use __BYTE_ORDER__ predefined macro instead of runtime check
By using the __BYTE_ORDER__ predefined macro we don't need the determine_endianness function anymore. Regtested on x86_64-pc-linux-gnu. libgfortran/ChangeLog: 2017-11-22 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/83097 * io/inquire.c (inquire_via_unit): Use __BYTE_ORDER__ predefined macro. * io/open.c (st_open): Likewise. * io/transfer.c (data_transfer_init): Likewise. * io/write.c (btoa_big): Likewise. (otoa_big): Likewise. (ztoa_big): Likewise. * libgfortran.h (big_endian): Remove variable. (GFOR_POINTER_TO_L1): Use __BYTE_ORDER__ macro. * runtime/main.c (determine_endianness): Remove function. (init): Remove call to determine_endianness. * runtime/minimal.c: Remove setting big_endian variable. From-SVN: r255072
Diffstat (limited to 'libgfortran/io/open.c')
-rw-r--r--libgfortran/io/open.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index 9d3988a..fab2065 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -805,8 +805,6 @@ st_open (st_parameter_open *opp)
conv = compile_options.convert;
}
- /* We use big_endian, which is 0 on little-endian machines
- and 1 on big-endian machines. */
switch (conv)
{
case GFC_CONVERT_NATIVE:
@@ -814,11 +812,11 @@ st_open (st_parameter_open *opp)
break;
case GFC_CONVERT_BIG:
- conv = big_endian ? GFC_CONVERT_NATIVE : GFC_CONVERT_SWAP;
+ conv = __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ? GFC_CONVERT_NATIVE : GFC_CONVERT_SWAP;
break;
case GFC_CONVERT_LITTLE:
- conv = big_endian ? GFC_CONVERT_SWAP : GFC_CONVERT_NATIVE;
+ conv = __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ? GFC_CONVERT_SWAP : GFC_CONVERT_NATIVE;
break;
default: