forked from 0ad/0ad
mucking about with base lib headers:
lib/posix_types.h: wrapper for stdint / sysdep/win/wposix_types.h included by types.h; replaces posix.h there. (works around wsock conflicts by not pulling in all posix stuff everywhere) This was SVN commit r1973.
This commit is contained in:
parent
56af3ca47d
commit
5b3d4a196c
10
source/lib/posix_types.h
Normal file
10
source/lib/posix_types.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// lightweight header that defines POSIX types (e.g. ssize_t and int8_t,
|
||||||
|
// which is also provided by C99) without pulling in all POSIX declarations.
|
||||||
|
// included from lib/types.h in place of posix.h; this helps avoid conflicts
|
||||||
|
// due to incompatible winsock definitions.
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# include "sysdep/win/wposix_types.h"
|
||||||
|
#else
|
||||||
|
# include <stdint.h>
|
||||||
|
#endif // #ifdef _WIN32
|
@ -30,18 +30,9 @@ typedef unsigned long long uint64_t;
|
|||||||
#error "port uint64_t"
|
#error "port uint64_t"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
// note: we used to define [u]intptr_t here (if not already done).
|
||||||
# ifndef _UINTPTR_T_DEFINED
|
// however, it's not necessary with VC7 and later, and the compiler's
|
||||||
# define _UINTPTR_T_DEFINED
|
// definition squelches 'pointer-to-int truncation' warnings, so don't.
|
||||||
# define uintptr_t unsigned int
|
|
||||||
# endif // _UINTPTR_T_DEFINED
|
|
||||||
# ifndef _INTPTR_T_DEFINED
|
|
||||||
# define _INTPTR_T_DEFINED
|
|
||||||
# define intptr_t signed int
|
|
||||||
# endif // _INTPTR_T_DEFINED
|
|
||||||
#else // _MSC_VER
|
|
||||||
# include <stdint.h>
|
|
||||||
#endif // _MSC_VER
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// convenience type (shorter defs than stdint uintN_t)
|
// convenient type aliases (shorter than uintN_t from stdint.h)
|
||||||
|
|
||||||
#ifndef __TYPES_H__
|
#ifndef __TYPES_H__
|
||||||
#define __TYPES_H__
|
#define __TYPES_H__
|
||||||
|
|
||||||
#include "posix.h"
|
#include "posix_types.h"
|
||||||
|
|
||||||
// defines instead of typedefs so we can #undef conflicting decls
|
// defines instead of typedefs so we can #undef conflicting decls
|
||||||
|
|
||||||
@ -27,10 +27,8 @@ typedef unsigned int PS_uint;
|
|||||||
|
|
||||||
// the standard only guarantees 16 bits.
|
// the standard only guarantees 16 bits.
|
||||||
// we use this for memory offsets and ranges, so it better be big enough.
|
// we use this for memory offsets and ranges, so it better be big enough.
|
||||||
#ifdef SIZE_MAX // nested #if to avoid ICC warning if not defined
|
#if defined(SIZE_MAX) && SIZE_MAX < 32
|
||||||
# if SIZE_MAX < 32
|
# error "check size_t and SIZE_MAX - too small?"
|
||||||
# error "check size_t and SIZE_MAX - too small?"
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user