diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-11-22 19:19:13 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-11-22 19:19:13 +0000 |
commit | 43938465c326dffb8bb77079f65afccc6f4df80d (patch) | |
tree | d591cf873aa6b611276b396c56845bbd1e9af949 /libgfortran/runtime | |
parent | ffb2e0d06e5e3672826752b911f86e8402c9e1bb (diff) |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255072 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/runtime')
-rw-r--r-- | libgfortran/runtime/main.c | 28 | ||||
-rw-r--r-- | libgfortran/runtime/minimal.c | 7 |
2 files changed, 0 insertions, 35 deletions
diff --git a/libgfortran/runtime/main.c b/libgfortran/runtime/main.c index 8d466d1bba8..209627151a3 100644 --- a/libgfortran/runtime/main.c +++ b/libgfortran/runtime/main.c @@ -33,31 +33,6 @@ stupid_function_name_for_static_linking (void) return; } -/* This will be 0 for little-endian - machines and 1 for big-endian machines. */ -int big_endian = 0; - - -/* Figure out endianness for this machine. */ - -static void -determine_endianness (void) -{ - union - { - GFC_LOGICAL_8 l8; - GFC_LOGICAL_4 l4[2]; - } u; - - u.l8 = 1; - if (u.l4[0]) - big_endian = 0; - else if (u.l4[1]) - big_endian = 1; - else - runtime_error ("Unable to determine machine endianness"); -} - static int argc_save; static char **argv_save; @@ -89,9 +64,6 @@ get_args (int *argc, char ***argv) static void __attribute__((constructor)) init (void) { - /* Figure out the machine endianness. */ - determine_endianness (); - /* Must be first */ init_variables (); diff --git a/libgfortran/runtime/minimal.c b/libgfortran/runtime/minimal.c index 2ef4f159250..3c7eca1ba8e 100644 --- a/libgfortran/runtime/minimal.c +++ b/libgfortran/runtime/minimal.c @@ -40,13 +40,6 @@ stupid_function_name_for_static_linking (void) options_t options; -/* This will be 0 for little-endian - machines and 1 for big-endian machines. - - Currently minimal libgfortran only runs on little-endian devices - which don't support constructors so this is just a constant. */ -int big_endian = 0; - static int argc_save; static char **argv_save; |