improve OS detection, don't enforce inclusion of machine/endian.h
commit882e3515647809d84a2bda905e957560d036bc4a
authorrofl0r <rofl0r@users.noreply.github.com>
Wed, 15 Sep 2021 20:20:08 +0000 (15 20:20 +0000)
committerrofl0r <rofl0r@users.noreply.github.com>
Wed, 15 Sep 2021 22:05:43 +0000 (15 22:05 +0000)
tree3119702c8a297356e9e875d068a9a3f45f5fc849
parente97c6ec415df73ab623fe7ec5ae1e349881ce5e2
improve OS detection, don't enforce inclusion of machine/endian.h

we mistakenly *always* included machine/endian.h when everything
else failed - rendering the portable fallback strategy useless,
as we'd run into a compile error before getting there when
machine/endian.h doesn't exist.

not all the BSDs actually provide machine/endian.h, most notably
NetBSD doesn't - and the others prefer usage of sys/endian.h as
it provides other necessary ingredients, such as cdefs.h.
the only BSD-derived platform not providing sys/endian.h is MacOS
/iOS, so we use machine/endian.h only there.

Not that it would matter a lot, since all of these systems use
GCC/clang based toolchains recent enough to catch already the
first detection mechanism. Only really old versions of these OSes
would fall through until the OS-detection logic.
endianness.h