At Thu, 13 Feb 2025 12:04:16 +0700, Robert Elz <[email protected]> wrote: Subject: Re: xsrc expat build as-a-tool fails on macos! (was: freetype build failing with "error: unknown type name 'Byte'") > > Date: Wed, 12 Feb 2025 08:42:51 -0800 > From: "Greg A. Woods" <[email protected]> > Message-ID: <[email protected]> > > > | > /Volumes/work/woods/g-NetBSD-src/external/mit/expat/dist/../lib/libexpat/expat_config.h:8:10: > fatal error: 'endian.h' file not found > | 8 | #include <endian.h> > | | ^~~~~~~~~~ > > <endian.h> is a new header that's been added to POSIX in Issue 8 (ie: > the 2024 edition). Of course, it has been in NetBSD (and most other > systems, but apparently not macOS for a long time).
Figures -- not the best idea in the world -- it's really a compiler
issue -- it should have been driven by the C committee, not POSIX.
I see POSIX specifies some function declarations in there as well, which
is OK as far as they are needed, and I guess there's some argument to be
made for reserving namespace for a non-underbar macro name, but most
existing code won't be using Issue 8 yet, so it could instead just rely
on the compiler macro!
> I guess the #include should be made to depend upon which version of
> the standard is available, and for older systems, just define the
> relevant symbols in-line (macos is, probably, always little endian?
> If not, there must be some system dependent file that could be
> included instead that will provide that info, somehow, which could
> be used.)
No!
There's no header needed.
The compiler already provides the necessary macros. See my diff.
This is true for Clang (which includes a number of other named
compilers, such as IBM Open XL/C), GCC, PCC, TCC, Intel (icc and icx),
and even CompCert. (Only MS VisualC, and maybe Oracle Sun Studio don't
offer __BYTE_ORDER__!)
I seen NetBSD's headers aren't using the compiler's __BYTE_ORDER__, and
I guess that could be claimed to be a historical artifact, but the fact
is that any possible NetBSD native compiler has offered __BYTE_ORDER__
et al since a very long time now.
--
Greg A. Woods <[email protected]>
Kelowna, BC +1 250 762-7675 RoboHack <[email protected]>
Planix, Inc. <[email protected]> Avoncote Farms <[email protected]>
pgpJCCyeOejTG.pgp
Description: OpenPGP Digital Signature
