From 8152be7dfb272eafd97692a789a2596b883f413f Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 21 Jan 2016 16:56:48 +0100 Subject: Include fix for wint_t gcc problem. Gcc defines wint_t in the stddef header (even if it is not stanadard) and additionally defines it if stddef is reincluded. The fix now defines it before stddef is checked for reinclusion. --- runtime/include/stddef.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/runtime/include/stddef.h b/runtime/include/stddef.h index f61e87b4..5bdff564 100644 --- a/runtime/include/stddef.h +++ b/runtime/include/stddef.h @@ -29,12 +29,27 @@ /* -- common definitions (ISO C99 7.17) */ +/* We actually need to define this also if stddef.h is included and __STDDEF_H is + already defined since the gcc stddef also defines it if __need_wint_t is present + in any case */ +#if defined (__need_wint_t) +#ifndef _WINT_T +#define _WINT_T + +#ifndef __WINT_TYPE__ +#define __WINT_TYPE__ unsigned int +#endif +typedef __WINT_TYPE__ wint_t; +#endif +#undef __need_wint_t +#endif + #ifndef _STDDEF_H /* Glibc compatibility: if one of the __need_ macros is set, just define the corresponding type or macro and don't consider this file as fully included yet. */ -#if !defined(__need_size_t) && !defined(__need_ptrdiff_t) && !defined(__need_wchar_t) && !defined(__need_NULL) +#if !defined(__need_size_t) && !defined(__need_ptrdiff_t) && !defined(__need_wchar_t) && !defined(__need_NULL) && !defined(__need_wint_t) #define _STDDEF_H #endif @@ -90,17 +105,6 @@ typedef signed int wchar_t; #endif #endif -#if defined (__need_wint_t) -#ifndef _WINT_T -#define _WINT_T - -#ifndef __WINT_TYPE__ -#define __WINT_TYPE__ unsigned int -#endif -typedef __WINT_TYPE__ wint_t; -#endif -#undef __need_wint_t -#endif #if defined(_STDDEF_H) || defined(__need_NULL) #ifndef NULL -- cgit