Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/sys



In article <20260112145150.B1258F983%cvs.NetBSD.org@localhost>,
Nia Alarie <source-changes-d%NetBSD.org@localhost> wrote:
>-=-=-=-=-=-
>
>Module Name:	src
>Committed By:	nia
>Date:		Mon Jan 12 14:51:50 UTC 2026
>
>Modified Files:
>	src/sys/sys: types.h
>
>Log Message:
>Revert the change to stop including #include <sys/endian.h> from
><sys/types.h>.
>
>This change was too risky in ways I didn't forsee, mostly that this code
>compiles fine without the header included:
>
>#if BYTE_ORDER == LITTLE_ENDIAN
>/* do little endian stuff */
>#else
>/* do big endian stuff */
>#endif
>
>... then uses the big endian path on little endian machines.
>
>If strict POSIX mode is requested, we can avoid including it. The problem
>of relying on endian header transclusion is rare in non-BSD codebases.

Perhaps change the macro to be BYTE_ORDER() instead so it fails if undefined.
This is intrusive but much less work than adding if defined(BYTE_ORDER)k
everywhere. Perhap use a new macro HOST_BYTE_ORDER() or GET_BYTE_ORDER()
instead to avoid confusion.

christos



Home | Main Index | Thread Index | Old Index