util: unbreak endian detection on OpenBSD
authorJonathan Gray <jsg@jsg.id.au>
Wed, 28 Mar 2018 03:06:14 +0000 (14:06 +1100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 31 Aug 2020 09:14:57 +0000 (09:14 +0000)
commit7eab6845e9dd49f0ef0bf9a7d986aaf685e77981
tree1647e3ee2924d548e8803d725d1e8c40a5d97696
parent8301a43f272df7aa8c28e4143be1549bbef74e42
util: unbreak endian detection on OpenBSD

Since cbee1bfb34274668a05995b9d4c78ddec9e5ea4c endian.h is unconditionally
used if available.

glibc has byte order defines with two leading underscores.  OpenBSD
has private defines with a single leading underscore in machine/endian.h
and public defines in endian.h with no underscore.

The code under the endian.h block did not check if symbols were
defined before equating them so '#if __BYTE_ORDER == __LITTLE_ENDIAN'
would turn into '#if 0 == 0' which is always true.

Fixes: cbee1bfb342 ("meson/configure: detect endian.h instead of trying to guess when it's available")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5630>
src/util/u_endian.h