Move the int typedefs to the top so they can be used in defining other types.
Ensure every platform has __offsetof. Make multiple inclusion detection consistent with other <platform>/include/*.h files.
This commit is contained in:
parent
1317e200a8
commit
1123bf8862
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=76700
@ -35,8 +35,29 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _ANSI_H_
|
||||
#define _ANSI_H_
|
||||
#ifndef _MACHINE_ANSI_H_
|
||||
#define _MACHINE_ANSI_H_
|
||||
|
||||
/*
|
||||
* Internal names for basic integral types. Omit the typedef if
|
||||
* not possible for a machine/compiler combination.
|
||||
*/
|
||||
typedef __signed char __int8_t;
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
typedef long __int64_t;
|
||||
typedef unsigned long __uint64_t;
|
||||
|
||||
typedef long __intptr_t;
|
||||
typedef unsigned long __uintptr_t;
|
||||
|
||||
/*
|
||||
* We define this here since both <stddef.h> and <sys/types.h> needs it.
|
||||
*/
|
||||
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
|
||||
|
||||
/*
|
||||
* Types which are fundamental to the implementation and may appear in
|
||||
@ -108,25 +129,4 @@ typedef struct {
|
||||
#define _BSD_CLK_TCK_ 100
|
||||
#define _BSD_CLOCKS_PER_SEC_ 100
|
||||
|
||||
/*
|
||||
* We define this here since both <stddef.h> and <sys/types.h> needs it.
|
||||
*/
|
||||
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
|
||||
|
||||
/*
|
||||
* Internal names for basic integral types. Omit the typedef if
|
||||
* not possible for a machine/compiler combination.
|
||||
*/
|
||||
typedef __signed char __int8_t;
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
typedef long __int64_t;
|
||||
typedef unsigned long __uint64_t;
|
||||
|
||||
typedef long __intptr_t;
|
||||
typedef unsigned long __uintptr_t;
|
||||
|
||||
#endif /* _ANSI_H_ */
|
||||
#endif /* _MACHINE_ANSI_H_ */
|
||||
|
@ -34,8 +34,29 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _ANSI_H_
|
||||
#define _ANSI_H_
|
||||
#ifndef _MACHINE_ANSI_H_
|
||||
#define _MACHINE_ANSI_H_
|
||||
|
||||
/*
|
||||
* Internal names for basic integral types. Omit the typedef if
|
||||
* not possible for a machine/compiler combination.
|
||||
*/
|
||||
typedef __signed char __int8_t;
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
typedef long long __int64_t;
|
||||
typedef unsigned long long __uint64_t;
|
||||
|
||||
typedef int __intptr_t;
|
||||
typedef unsigned int __uintptr_t;
|
||||
|
||||
/*
|
||||
* We define this here since both <stddef.h> and <sys/types.h> needs it.
|
||||
*/
|
||||
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
|
||||
|
||||
/*
|
||||
* Types which are fundamental to the implementation and may appear in
|
||||
@ -102,20 +123,4 @@
|
||||
#define _BSD_CLK_TCK_ 100
|
||||
#define _BSD_CLOCKS_PER_SEC_ 100
|
||||
|
||||
/*
|
||||
* Internal names for basic integral types. Omit the typedef if
|
||||
* not possible for a machine/compiler combination.
|
||||
*/
|
||||
typedef __signed char __int8_t;
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
typedef long long __int64_t;
|
||||
typedef unsigned long long __uint64_t;
|
||||
|
||||
typedef int __intptr_t;
|
||||
typedef unsigned int __uintptr_t;
|
||||
|
||||
#endif /* _ANSI_H_ */
|
||||
#endif /* _MACHINE_ANSI_H_ */
|
||||
|
@ -37,6 +37,36 @@
|
||||
#ifndef _MACHINE_ANSI_H_
|
||||
#define _MACHINE_ANSI_H_
|
||||
|
||||
/*
|
||||
* Typedefs for especially magic types. #define's wouldn't work in the
|
||||
* __GNUC__ case, since __attribute__(()) only works in certain contexts.
|
||||
* This is not in <machine/types.h>, since that has too much namespace
|
||||
* pollution for inclusion in ANSI headers, yet we need __int64_t in at
|
||||
* least <stdio.h>.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
typedef int __attribute__((__mode__(__DI__))) __int64_t;
|
||||
typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t;
|
||||
#else
|
||||
/* LONGLONG */
|
||||
typedef long long __int64_t;
|
||||
/* LONGLONG */
|
||||
typedef unsigned long long __uint64_t;
|
||||
#endif
|
||||
/*
|
||||
* Internal names for basic integral types. Omit the typedef if
|
||||
* not possible for a machine/compiler combination.
|
||||
*/
|
||||
typedef __signed char __int8_t;
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
|
||||
typedef int __intptr_t;
|
||||
typedef unsigned int __uintptr_t;
|
||||
|
||||
/*
|
||||
* Types which are fundamental to the implementation and must be declared
|
||||
* in more than one standard header are defined here. Standard headers
|
||||
@ -98,34 +128,4 @@
|
||||
*/
|
||||
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
|
||||
|
||||
/*
|
||||
* Typedefs for especially magic types. #define's wouldn't work in the
|
||||
* __GNUC__ case, since __attribute__(()) only works in certain contexts.
|
||||
* This is not in <machine/types.h>, since that has too much namespace
|
||||
* pollution for inclusion in ANSI headers, yet we need __int64_t in at
|
||||
* least <stdio.h>.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
typedef int __attribute__((__mode__(__DI__))) __int64_t;
|
||||
typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t;
|
||||
#else
|
||||
/* LONGLONG */
|
||||
typedef long long __int64_t;
|
||||
/* LONGLONG */
|
||||
typedef unsigned long long __uint64_t;
|
||||
#endif
|
||||
/*
|
||||
* Internal names for basic integral types. Omit the typedef if
|
||||
* not possible for a machine/compiler combination.
|
||||
*/
|
||||
typedef __signed char __int8_t;
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
|
||||
typedef int __intptr_t;
|
||||
typedef unsigned int __uintptr_t;
|
||||
|
||||
#endif /* !_MACHINE_ANSI_H_ */
|
||||
|
@ -35,8 +35,29 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _ANSI_H_
|
||||
#define _ANSI_H_
|
||||
#ifndef _MACHINE_ANSI_H_
|
||||
#define _MACHINE_ANSI_H_
|
||||
|
||||
/*
|
||||
* Internal names for basic integral types. Omit the typedef if
|
||||
* not possible for a machine/compiler combination.
|
||||
*/
|
||||
typedef __signed char __int8_t;
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
typedef long __int64_t;
|
||||
typedef unsigned long __uint64_t;
|
||||
|
||||
typedef long __intptr_t;
|
||||
typedef unsigned long __uintptr_t;
|
||||
|
||||
/*
|
||||
* We define this here since both <stddef.h> and <sys/types.h> needs it.
|
||||
*/
|
||||
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
|
||||
|
||||
/*
|
||||
* Types which are fundamental to the implementation and may appear in
|
||||
@ -98,25 +119,4 @@
|
||||
#define _BSD_CLK_TCK_ 100
|
||||
#define _BSD_CLOCKS_PER_SEC_ 100
|
||||
|
||||
/*
|
||||
* We define this here since both <stddef.h> and <sys/types.h> needs it.
|
||||
*/
|
||||
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
|
||||
|
||||
/*
|
||||
* Internal names for basic integral types. Omit the typedef if
|
||||
* not possible for a machine/compiler combination.
|
||||
*/
|
||||
typedef __signed char __int8_t;
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
typedef long __int64_t;
|
||||
typedef unsigned long __uint64_t;
|
||||
|
||||
typedef long __intptr_t;
|
||||
typedef unsigned long __uintptr_t;
|
||||
|
||||
#endif /* _ANSI_H_ */
|
||||
#endif /* _MACHINE_ANSI_H_ */
|
||||
|
@ -34,8 +34,29 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _ANSI_H_
|
||||
#define _ANSI_H_
|
||||
#ifndef _MACHINE_ANSI_H_
|
||||
#define _MACHINE_ANSI_H_
|
||||
|
||||
/*
|
||||
* Internal names for basic integral types. Omit the typedef if
|
||||
* not possible for a machine/compiler combination.
|
||||
*/
|
||||
typedef __signed char __int8_t;
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
typedef long long __int64_t;
|
||||
typedef unsigned long long __uint64_t;
|
||||
|
||||
typedef int __intptr_t;
|
||||
typedef unsigned int __uintptr_t;
|
||||
|
||||
/*
|
||||
* We define this here since both <stddef.h> and <sys/types.h> needs it.
|
||||
*/
|
||||
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
|
||||
|
||||
/*
|
||||
* Types which are fundamental to the implementation and may appear in
|
||||
@ -109,20 +130,4 @@ typedef struct {
|
||||
#define _BSD_CLK_TCK_ 100
|
||||
#define _BSD_CLOCKS_PER_SEC_ 100
|
||||
|
||||
/*
|
||||
* Internal names for basic integral types. Omit the typedef if
|
||||
* not possible for a machine/compiler combination.
|
||||
*/
|
||||
typedef __signed char __int8_t;
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
typedef long long __int64_t;
|
||||
typedef unsigned long long __uint64_t;
|
||||
|
||||
typedef int __intptr_t;
|
||||
typedef unsigned int __uintptr_t;
|
||||
|
||||
#endif /* _ANSI_H_ */
|
||||
#endif /* _MACHINE_ANSI_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user