[clang] [clang][Headers] add endian.h (PR #186032)
David Tenty via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 19 08:31:03 PDT 2026
daltenty wrote:
>> I'm not sure exactly which provider's <endian.h> this expects, but if it can be reasonable that this header provides these defines with leading underscores too, would it be reasonable to make it do that?
Yeah, there appear to be similar usages in LLVM itself: https://github.com/llvm/llvm-project/blob/989ea0e2d7263dc462f600a2c65be95a60007cde/compiler-rt/test/ubsan/TestCases/Float/cast-overflow.cpp#L45
The shape of existing usages makes me suspect a GNU extension
> That does seem to be allowed by the POSIX spec too (https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/endian.h.html). Implementations may define other macros with the _ENDIAN suffix.
I think this sounds reasonable, I'll put up a follow on change
https://github.com/llvm/llvm-project/pull/186032
More information about the cfe-commits
mailing list