mirror of
git://git.musl-libc.org/musl
synced 2025-04-11 03:31:50 +00:00
move __BYTE_ORDER definition to alltypes.h
this change is motivated by the intersection of several factors. presently, despite being a nonstandard header, endian.h is exposing the unprefixed byte order macros and functions only if _BSD_SOURCE or _GNU_SOURCE is defined. this is to accommodate use of endian.h from other headers, including bits headers, which need to define structure layout in terms of endianness. with time64 switch-over, even more headers will need to do this. at the same time, the resolution of Austin Group issue 162 makes endian.h a standard header for POSIX-future, requiring that it expose the unprefixed macros and the functions even in standards-conforming profiles. changes to meet this new requirement would break existing internal usage of endian.h by causing it to violate namespace where it's used. instead, have the arch's alltypes.h define __BYTE_ORDER, either as a fixed constant or depending on the right arch-specific predefined macros for determining endianness. explicit literals 1234 and 4321 are used instead of __LITTLE_ENDIAN and __BIG_ENDIAN so that there's no danger of getting the wrong result if a macro is undefined and implicitly evaluates to 0 at the preprocessor level. the powerpc (32-bit) bits/endian.h being removed had logic for varying endianness, but our powerpc arch has never supported that and has always been big-endian-only. this logic is not carried over to the new __BYTE_ORDER definition in alltypes.h.
This commit is contained in:
parent
00ec11d19e
commit
97d35a552e
@ -2,6 +2,12 @@
|
|||||||
#define _Int64 long
|
#define _Int64 long
|
||||||
#define _Reg long
|
#define _Reg long
|
||||||
|
|
||||||
|
#if __AARCH64EB__
|
||||||
|
#define __BYTE_ORDER 4321
|
||||||
|
#else
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF unsigned wchar_t;
|
TYPEDEF unsigned wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#if __AARCH64EB__
|
|
||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
||||||
#endif
|
|
@ -2,6 +2,12 @@
|
|||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg int
|
#define _Reg int
|
||||||
|
|
||||||
|
#if __ARMEB__
|
||||||
|
#define __BYTE_ORDER 4321
|
||||||
|
#else
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF unsigned wchar_t;
|
TYPEDEF unsigned wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#if __ARMEB__
|
|
||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
||||||
#endif
|
|
@ -2,6 +2,8 @@
|
|||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg int
|
#define _Reg int
|
||||||
|
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#ifdef __WCHAR_TYPE__
|
#ifdef __WCHAR_TYPE__
|
||||||
TYPEDEF __WCHAR_TYPE__ wchar_t;
|
TYPEDEF __WCHAR_TYPE__ wchar_t;
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
@ -2,6 +2,8 @@
|
|||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg int
|
#define _Reg int
|
||||||
|
|
||||||
|
#define __BYTE_ORDER 4321
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#ifdef __WCHAR_TYPE__
|
#ifdef __WCHAR_TYPE__
|
||||||
TYPEDEF __WCHAR_TYPE__ wchar_t;
|
TYPEDEF __WCHAR_TYPE__ wchar_t;
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
@ -2,6 +2,12 @@
|
|||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg int
|
#define _Reg int
|
||||||
|
|
||||||
|
#if __MICROBLAZEEL__
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
#else
|
||||||
|
#define __BYTE_ORDER 4321
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF int wchar_t;
|
TYPEDEF int wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#if __MICROBLAZEEL__
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
||||||
#else
|
|
||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
||||||
#endif
|
|
@ -2,6 +2,12 @@
|
|||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg int
|
#define _Reg int
|
||||||
|
|
||||||
|
#if _MIPSEL || __MIPSEL || __MIPSEL__
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
#else
|
||||||
|
#define __BYTE_ORDER 4321
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF int wchar_t;
|
TYPEDEF int wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#if _MIPSEL || __MIPSEL || __MIPSEL__
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
||||||
#else
|
|
||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
||||||
#endif
|
|
@ -2,6 +2,12 @@
|
|||||||
#define _Int64 long
|
#define _Int64 long
|
||||||
#define _Reg long
|
#define _Reg long
|
||||||
|
|
||||||
|
#if _MIPSEL || __MIPSEL || __MIPSEL__
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
#else
|
||||||
|
#define __BYTE_ORDER 4321
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF int wchar_t;
|
TYPEDEF int wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#if _MIPSEL || __MIPSEL || __MIPSEL__
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
||||||
#else
|
|
||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
||||||
#endif
|
|
@ -2,6 +2,12 @@
|
|||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg int
|
#define _Reg int
|
||||||
|
|
||||||
|
#if _MIPSEL || __MIPSEL || __MIPSEL__
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
#else
|
||||||
|
#define __BYTE_ORDER 4321
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF int wchar_t;
|
TYPEDEF int wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#if _MIPSEL || __MIPSEL || __MIPSEL__
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
||||||
#else
|
|
||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
||||||
#endif
|
|
@ -2,6 +2,8 @@
|
|||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg int
|
#define _Reg int
|
||||||
|
|
||||||
|
#define __BYTE_ORDER 4321
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF unsigned wchar_t;
|
TYPEDEF unsigned wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
@ -2,6 +2,8 @@
|
|||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg int
|
#define _Reg int
|
||||||
|
|
||||||
|
#define __BYTE_ORDER 4321
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#ifdef __WCHAR_TYPE__
|
#ifdef __WCHAR_TYPE__
|
||||||
TYPEDEF __WCHAR_TYPE__ wchar_t;
|
TYPEDEF __WCHAR_TYPE__ wchar_t;
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
#ifdef __BIG_ENDIAN__
|
|
||||||
#if __BIG_ENDIAN__
|
|
||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
||||||
#endif
|
|
||||||
#endif /* __BIG_ENDIAN__ */
|
|
||||||
|
|
||||||
#ifdef __LITTLE_ENDIAN__
|
|
||||||
#if __LITTLE_ENDIAN__
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
||||||
#endif
|
|
||||||
#endif /* __LITTLE_ENDIAN__ */
|
|
||||||
|
|
||||||
#ifndef __BYTE_ORDER
|
|
||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
||||||
#endif
|
|
@ -2,6 +2,12 @@
|
|||||||
#define _Int64 long
|
#define _Int64 long
|
||||||
#define _Reg long
|
#define _Reg long
|
||||||
|
|
||||||
|
#if __BIG_ENDIAN__
|
||||||
|
#define __BYTE_ORDER 4321
|
||||||
|
#else
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF int wchar_t;
|
TYPEDEF int wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#if __BIG_ENDIAN__
|
|
||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
||||||
#endif
|
|
@ -2,6 +2,8 @@
|
|||||||
#define _Int64 long
|
#define _Int64 long
|
||||||
#define _Reg long
|
#define _Reg long
|
||||||
|
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF int wchar_t;
|
TYPEDEF int wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
@ -2,6 +2,8 @@
|
|||||||
#define _Int64 long
|
#define _Int64 long
|
||||||
#define _Reg long
|
#define _Reg long
|
||||||
|
|
||||||
|
#define __BYTE_ORDER 4321
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF int wchar_t;
|
TYPEDEF int wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
@ -2,6 +2,12 @@
|
|||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg int
|
#define _Reg int
|
||||||
|
|
||||||
|
#if __BIG_ENDIAN__
|
||||||
|
#define __BYTE_ORDER 4321
|
||||||
|
#else
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#ifdef __WCHAR_TYPE__
|
#ifdef __WCHAR_TYPE__
|
||||||
TYPEDEF __WCHAR_TYPE__ wchar_t;
|
TYPEDEF __WCHAR_TYPE__ wchar_t;
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#if __BIG_ENDIAN__
|
|
||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
||||||
#endif
|
|
@ -2,6 +2,8 @@
|
|||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg long long
|
#define _Reg long long
|
||||||
|
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#ifdef __WCHAR_TYPE__
|
#ifdef __WCHAR_TYPE__
|
||||||
TYPEDEF __WCHAR_TYPE__ wchar_t;
|
TYPEDEF __WCHAR_TYPE__ wchar_t;
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
@ -2,6 +2,8 @@
|
|||||||
#define _Int64 long
|
#define _Int64 long
|
||||||
#define _Reg long
|
#define _Reg long
|
||||||
|
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF int wchar_t;
|
TYPEDEF int wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
@ -1,3 +1,6 @@
|
|||||||
|
#define __LITTLE_ENDIAN 1234
|
||||||
|
#define __BIG_ENDIAN 4321
|
||||||
|
|
||||||
TYPEDEF unsigned _Addr size_t;
|
TYPEDEF unsigned _Addr size_t;
|
||||||
TYPEDEF unsigned _Addr uintptr_t;
|
TYPEDEF unsigned _Addr uintptr_t;
|
||||||
TYPEDEF _Addr ptrdiff_t;
|
TYPEDEF _Addr ptrdiff_t;
|
||||||
|
@ -3,15 +3,9 @@
|
|||||||
|
|
||||||
#include <features.h>
|
#include <features.h>
|
||||||
|
|
||||||
#define __LITTLE_ENDIAN 1234
|
|
||||||
#define __BIG_ENDIAN 4321
|
|
||||||
#define __PDP_ENDIAN 3412
|
#define __PDP_ENDIAN 3412
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__BYTE_ORDER__)
|
#include <bits/alltypes.h>
|
||||||
#define __BYTE_ORDER __BYTE_ORDER__
|
|
||||||
#else
|
|
||||||
#include <bits/endian.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user