Mercurial > pub > dyncall > dyncall
changeset 588:dfc2e6ee8782 r1.4-RC3
- more robust endian detection, on some platforms inclusion of endian.h led to assuming wrong endianness (subtle if inclusion was in
- syscall test: added newline to output
author | Tassilo Philipp |
---|---|
date | Mon, 19 Sep 2022 09:54:21 +0200 |
parents | fbd5e5416a4b |
children | 9d5945683e30 |
files | ChangeLog dyncall/dyncall_macros.h test/syscall/syscall.c |
diffstat | 3 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Sep 15 18:11:48 2022 +0200 +++ b/ChangeLog Mon Sep 19 09:54:21 2022 +0200 @@ -22,6 +22,9 @@ o x64/windows masm directives for frame unwinding information (as dbg help; thanks Raphael Luba!) dynload: o build fix for ReactOS with RosBE/cmake/mingw-make environment +general: + o more robust detection of platform endianness (on some platforms inclusion + of endian.h led to wrong assumptions) tests: o call_suite: simplified and extended to test also unsigned types, and _Bool o callback_suite: refactored to be much more like call_suite test
--- a/dyncall/dyncall_macros.h Thu Sep 15 18:11:48 2022 +0200 +++ b/dyncall/dyncall_macros.h Mon Sep 19 09:54:21 2022 +0200 @@ -280,18 +280,22 @@ DC__Arch_PPC64 DC__Arch_SuperH */ -# if (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 1)) || defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(MIPSEB) || defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) || defined(__ARMEB__) || defined(__AARCH64EB__) +# if (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 1)) || defined(MIPSEB) || defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) || defined(__ARMEB__) || defined(__AARCH64EB__) # define DC__Endian_BIG -# elif (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 2)) || defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || defined(MIPSEL) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(__ARMEL__) || defined(__AARCH64EL__) +# elif (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 2)) || defined(MIPSEL) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(__ARMEL__) || defined(__AARCH64EL__) # define DC__Endian_LITTLE # elif defined(DC__Arch_Sparc64) && !defined(__BYTE_ORDER__) /* Sparc64 default is big-endian, except if explicitly defined */ # define DC__Endian_BIG -# elif defined(__BYTE_ORDER__) /* explicitly set */ -# if defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +# elif defined(BYTE_ORDER) || defined(_BYTE_ORDER) || defined(__BYTE_ORDER__) /* explicitly set byte order, either through compiler or platform specific endian.h */ +# if (defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)) || (defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN)) || (defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) # define DC__Endian_BIG -# elif defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +# elif (defined(LITTLE_ENDIAN) && (BYTE_ORDER == LITTLE_ENDIAN)) || (defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN)) || (defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) # define DC__Endian_LITTLE # endif +# elif (defined(_BIG_ENDIAN) && (_BIG_ENDIAN == 1)) || (defined(__BIG_ENDIAN__) && (__BIG_ENDIAN__ == 1)) /* explicitly set as on/off */ +# define DC__Endian_BIG +# elif (defined(_LITTLE_ENDIAN) && (_LITTLE_ENDIAN == 1)) || (defined(__LITTLE_ENDIAN__) && (__LITTLE_ENDIAN__ == 1)) /* explicitly set as on/off */ +# define DC__Endian_LITTLE # endif /* no else, leave unset if not sure */ #endif
--- a/test/syscall/syscall.c Thu Sep 15 18:11:48 2022 +0200 +++ b/test/syscall/syscall.c Mon Sep 19 09:54:21 2022 +0200 @@ -47,6 +47,7 @@ { r = syscall_write(1/*stdout*/, "result: syscall: ", 17); r += syscall_write(1/*stdout*/, r==17?"1":"0", 2); + r += syscall_write(1/*stdout*/, "\n", 2); } return !(r == 19); }