Conversation
Prefer compiler built-ins, then __has_include headers, with a Windows LE fallback. Alias underscored forms (__BYTE_ORDER, _BYTE_ORDER, __DARWIN_*) when present. Fixes dead macOS branch, glibc-only <endian.h> include (missed musl/bionic), over-restrictive __BYTE_ORDER under __linux__. Clarifies machine/endian.h caveats and keeps it last-resort.
|
Uh, this is essentially a from-scratch rewrite with very little documentation WRT motivation. On the other hand, this is quite a central check used by many foundational libraries which makes this a risky proposition. I think we need to break it down into a number of smaller changes that address specific issues one at a time with clear motivation and with clear understanding that there are no regressions. To this end, as a first step, can you file an issue that describes each of the problem separately. From your TLDR description I can sort of see two problems:
The rest I am not clear about. |
TLDR; - Fixes recent versions of MacOS/Apple Silicon.
__has_includeheaders, with a Windows LE fallback.__BYTE_ORDER,_BYTE_ORDER,__DARWIN_*) when present.<endian.h>include (missed musl/bionic), over-restrictive__BYTE_ORDERunder__linux__.machine/endian.hcaveats and keeps it last-resort.