aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/libgfortran.h
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/libgfortran.h
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/libgfortran.h')
-rw-r--r--libgfortran/libgfortran.h6
1 files changed, 1 insertions, 5 deletions
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index 52f4764..21ad5fc 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -266,12 +266,8 @@ typedef GFC_UINTEGER_4 gfc_char4_t;
simply equal to the kind parameter itself. */
#define GFC_SIZE_OF_CHAR_KIND(kind) (kind)
-/* This will be 0 on little-endian machines and one on big-endian machines. */
-extern int big_endian;
-internal_proto(big_endian);
-
#define GFOR_POINTER_TO_L1(p, kind) \
- (big_endian * (kind - 1) + (GFC_LOGICAL_1 *)(p))
+ ((__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ? 1: 0) * (kind - 1) + (GFC_LOGICAL_1 *)(p))
#define GFC_INTEGER_1_HUGE \
(GFC_INTEGER_1)((((GFC_UINTEGER_1)1) << 7) - 1)