diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-02-13 22:57:55 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-02-13 22:57:55 -0700 |
| commit | 1d3c25e92880c6b845300bcd40666fac85c7cd71 (patch) | |
| tree | 844d5e0f40d2441e897a6fdbb752372f74ec3d38 | |
| parent | fe95a227c8d7a61618712df6920fa52de2533c8c (diff) | |
| download | zig-1d3c25e92880c6b845300bcd40666fac85c7cd71.tar.gz zig-1d3c25e92880c6b845300bcd40666fac85c7cd71.zip | |
fix some c header symbol collisions
| -rw-r--r-- | c_headers/stddef.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/c_headers/stddef.h b/c_headers/stddef.h index 7354996711..3b55d42c30 100644 --- a/c_headers/stddef.h +++ b/c_headers/stddef.h @@ -48,7 +48,13 @@ #if !__has_feature(modules) #define _PTRDIFF_T #endif + +/* Zig: wrap in _PTRDIFF_T_DEFINED to protect against mingw defining it twice */ +#if !defined(_PTRDIFF_T_DEFINED) typedef __PTRDIFF_TYPE__ ptrdiff_t; +#define _PTRDIFF_T_DEFINED +#endif + #endif #undef __need_ptrdiff_t #endif /* defined(__need_ptrdiff_t) */ @@ -59,7 +65,24 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; #if !__has_feature(modules) #define _SIZE_T #endif + +/* Zig: added to avoid collisions with mingw */ +#if !defined(_SIZE_T_DEFINED_) +#if !defined(_SIZE_T_DEFINED) +#if !defined(_BSD_SIZE_T_DEFINED_) +#if !defined(_SIZE_T_DECLARED) typedef __SIZE_TYPE__ size_t; +#define _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED +#define _BSD_SIZE_T_DEFINED_ +#define _SIZE_T_DECLARED +#endif +#endif +#endif +#endif + + + #endif #undef __need_size_t #endif /*defined(__need_size_t) */ @@ -87,9 +110,24 @@ typedef __SIZE_TYPE__ rsize_t; #define _WCHAR_T_DEFINED #endif #endif + +/* zig added to prevent duplicate definition with mingw */ +#if !defined(__INT_WCHAR_T_H) +#if !defined(_GCC_WCHAR_T) +#if !defined(_WCHAR_T_DECLARED) +#if !defined(_WCHAR_T_DEFINED) +#define __INT_WCHAR_T_H +#define _GCC_WCHAR_T +#define _WCHAR_T_DECLARED +#define _WCHAR_T_DEFINED typedef __WCHAR_TYPE__ wchar_t; #endif #endif +#endif +#endif + +#endif +#endif #undef __need_wchar_t #endif /* defined(__need_wchar_t) */ |
