aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/include
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2016-01-21 16:56:48 +0100
committerBernhard Schommer <bernhardschommer@gmail.com>2016-01-21 16:56:48 +0100
commit8152be7dfb272eafd97692a789a2596b883f413f (patch)
treeb068c9455fb1828a640091499e05bd56254715f0 /runtime/include
parent77209cf4625da6ffe43ae355ffeda7cf525fc803 (diff)
downloadcompcert-kvx-8152be7dfb272eafd97692a789a2596b883f413f.tar.gz
compcert-kvx-8152be7dfb272eafd97692a789a2596b883f413f.zip
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.
Diffstat (limited to 'runtime/include')
-rw-r--r--runtime/include/stddef.h28
1 files 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 @@
/* <stddef.h> -- 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