mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-19 04:49:25 +08:00
Use __machine_*_t_defined for internal types
Newlib defines defaults for internal types via <sys/_types.h> and uses <machine/_types.h> to let targets define their own type if necessary. Previously for example #ifndef __dev_t_defined typedef short __dev_t; #endif However, the __*_t_defined pattern conflicts with the glibc type guard pattern for user types, e.g. dev_t in this example. Introduce a __machine_*_t_defined pattern for internal types (defined by <machine/_types.h>, used by <sys/_types.h>). For example #ifndef __machine_dev_t_defined typedef short __dev_t; #endif Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
parent
9f90ae0435
commit
8a5af1a184
@ -2,8 +2,18 @@
|
||||
|
||||
/* This file defines various typedefs needed by the system calls that support
|
||||
the C library. Basically, they're just the POSIX versions with an '_'
|
||||
prepended. This file lives in the `sys' directory so targets can provide
|
||||
their own if desired (or they can put target dependant conditionals here).
|
||||
prepended. Targets shall use <machine/_types.h> to define their own
|
||||
internal types if desired.
|
||||
|
||||
There are three define patterns used for type definitions. Lets assume
|
||||
xyz_t is a user type.
|
||||
|
||||
The internal type definition uses __machine_xyz_t_defined. It is defined by
|
||||
<machine/_types.h> to disable a default definition in <sys/_types.h>. It
|
||||
must not be used in other files.
|
||||
|
||||
User type definitions are guarded by __xyz_t_defined in glibc and
|
||||
_XYZ_T_DECLARED in BSD compatible systems.
|
||||
*/
|
||||
|
||||
#ifndef _SYS__TYPES_H
|
||||
@ -12,7 +22,7 @@
|
||||
#include <machine/_types.h>
|
||||
#include <sys/lock.h>
|
||||
|
||||
#ifndef __off_t_defined
|
||||
#ifndef __machine_off_t_defined
|
||||
typedef long _off_t;
|
||||
#endif
|
||||
|
||||
@ -22,18 +32,18 @@ typedef signed char __pid_t;
|
||||
typedef int __pid_t;
|
||||
#endif
|
||||
|
||||
#ifndef __dev_t_defined
|
||||
#ifndef __machine_dev_t_defined
|
||||
typedef short __dev_t;
|
||||
#endif
|
||||
|
||||
#ifndef __uid_t_defined
|
||||
#ifndef __machine_uid_t_defined
|
||||
typedef unsigned short __uid_t;
|
||||
#endif
|
||||
#ifndef __gid_t_defined
|
||||
#ifndef __machine_gid_t_defined
|
||||
typedef unsigned short __gid_t;
|
||||
#endif
|
||||
|
||||
#ifndef __off64_t_defined
|
||||
#ifndef __machine_off64_t_defined
|
||||
__extension__ typedef long long _off64_t;
|
||||
#endif
|
||||
|
||||
@ -45,7 +55,7 @@ typedef _off_t __off_t;
|
||||
|
||||
typedef _off64_t __loff_t;
|
||||
|
||||
#ifndef __key_t_defined
|
||||
#ifndef __machine_key_t_defined
|
||||
typedef long __key_t;
|
||||
#endif
|
||||
|
||||
@ -53,18 +63,18 @@ typedef long __key_t;
|
||||
* We need fpos_t for the following, but it doesn't have a leading "_",
|
||||
* so we use _fpos_t instead.
|
||||
*/
|
||||
#ifndef __fpos_t_defined
|
||||
#ifndef __machine_fpos_t_defined
|
||||
typedef long _fpos_t; /* XXX must match off_t in <sys/types.h> */
|
||||
/* (and must be `long' for now) */
|
||||
#endif
|
||||
|
||||
#ifdef __LARGE64_FILES
|
||||
#ifndef __fpos64_t_defined
|
||||
#ifndef __machine_fpos64_t_defined
|
||||
typedef _off64_t _fpos64_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __ssize_t_defined
|
||||
#ifndef __machine_ssize_t_defined
|
||||
#ifdef __SIZE_TYPE__
|
||||
/* If __SIZE_TYPE__ is defined (gcc) we define ssize_t based on size_t.
|
||||
We simply change "unsigned" to "signed" for this single definition
|
||||
@ -84,7 +94,7 @@ typedef long _ssize_t;
|
||||
#define __need_wint_t
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef __mbstate_t_defined
|
||||
#ifndef __machine_mbstate_t_defined
|
||||
/* Conversion state information. */
|
||||
typedef struct
|
||||
{
|
||||
@ -97,11 +107,11 @@ typedef struct
|
||||
} _mbstate_t;
|
||||
#endif
|
||||
|
||||
#ifndef __flock_t_defined
|
||||
#ifndef __machine_flock_t_defined
|
||||
typedef _LOCK_RECURSIVE_T _flock_t;
|
||||
#endif
|
||||
|
||||
#ifndef __iconv_t_defined
|
||||
#ifndef __machine_iconv_t_defined
|
||||
/* Iconv descriptor type */
|
||||
typedef void *_iconv_t;
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include <machine/_default_types.h>
|
||||
|
||||
#define __ssize_t_defined
|
||||
#define __machine_ssize_t_defined
|
||||
typedef long signed int _ssize_t;
|
||||
|
||||
#endif /* _MACHINE__TYPES_H */
|
||||
|
@ -39,22 +39,22 @@
|
||||
/*
|
||||
* fpos_t large enough for either 32 or 64 bit ppc glibc fpos_t.
|
||||
*/
|
||||
#define __fpos_t_defined
|
||||
#define __machine_fpos_t_defined
|
||||
typedef struct {
|
||||
char __pos[16];
|
||||
} _fpos_t;
|
||||
|
||||
#ifdef __LARGE64_FILES
|
||||
#define __fpos64_t_defined
|
||||
#define __machine_fpos64_t_defined
|
||||
typedef _fpos_t _fpos64_t;
|
||||
#endif
|
||||
|
||||
#define __dev_t_defined
|
||||
#define __machine_dev_t_defined
|
||||
typedef int __dev_t;
|
||||
|
||||
#define __uid_t_defined
|
||||
#define __machine_uid_t_defined
|
||||
typedef unsigned int __uid_t;
|
||||
#define __gid_t_defined
|
||||
#define __machine_gid_t_defined
|
||||
typedef unsigned int __gid_t;
|
||||
|
||||
#endif /* _MACHINE__TYPES_H */
|
||||
|
@ -7,7 +7,7 @@ char * _EXFUN(_gcvt,(struct _reent *, double , int , char *, char, int));
|
||||
|
||||
char *__locale_charset(_NOARGS);
|
||||
|
||||
#ifndef __mbstate_t_defined
|
||||
#ifndef __machine_mbstate_t_defined
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
|
@ -1,35 +1,25 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE__TYPES_H
|
||||
#define _MACHINE__TYPES_H
|
||||
#define _MACHINE__TYPES_H
|
||||
|
||||
#include <machine/_default_types.h>
|
||||
|
||||
typedef __int32_t blksize_t;
|
||||
typedef __int32_t blkcnt_t;
|
||||
typedef __int32_t blksize_t;
|
||||
typedef __int32_t blkcnt_t;
|
||||
|
||||
typedef __uint64_t __dev_t;
|
||||
#define __dev_t_defined 1
|
||||
typedef __uint64_t __dev_t;
|
||||
#define __machine_dev_t_defined
|
||||
|
||||
#if defined(__arm__) || defined(__i386__) || defined(__m68k__) || defined(__mips__) || defined(__PPC__) || defined(__sparc__)
|
||||
/* Use 64bit types */
|
||||
typedef __int64_t _off_t;
|
||||
#define __off_t_defined 1
|
||||
|
||||
typedef __int64_t _fpos_t;
|
||||
#define __fpos_t_defined 1
|
||||
typedef __int64_t _off_t;
|
||||
#else
|
||||
/* Use 32bit types */
|
||||
typedef __int32_t _off_t;
|
||||
#define __off_t_defined 1
|
||||
|
||||
typedef __int32_t _fpos_t;
|
||||
#define __fpos_t_defined 1
|
||||
typedef __int32_t _off_t;
|
||||
#endif
|
||||
#define __machine_off_t_defined
|
||||
|
||||
typedef __uint32_t _mode_t;
|
||||
#define __mode_t_defined 1
|
||||
typedef _off_t _fpos_t;
|
||||
#define __machine_fpos_t_defined
|
||||
|
||||
#endif
|
||||
typedef __uint32_t _mode_t;
|
||||
#define __machine_mode_t_defined
|
||||
|
||||
#endif /* _MACHINE__TYPES_H */
|
||||
|
@ -11,16 +11,16 @@ typedef __uint16_t __uid16_t;
|
||||
typedef __uint16_t __gid16_t;
|
||||
#endif
|
||||
|
||||
#define __dev_t_defined
|
||||
#define __machine_dev_t_defined
|
||||
typedef __uint32_t __dev_t;
|
||||
|
||||
#define __uid_t_defined
|
||||
#define __machine_uid_t_defined
|
||||
typedef __uint32_t __uid_t;
|
||||
|
||||
#define __gid_t_defined
|
||||
#define __machine_gid_t_defined
|
||||
typedef __uint32_t __gid_t;
|
||||
|
||||
#define __key_t_defined
|
||||
#define __machine_key_t_defined
|
||||
typedef long long __key_t;
|
||||
|
||||
#endif /* _MACHINE__TYPES_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user