summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2016-07-22 09:45:36 +0200
committerBen Gamari <ben@smart-cactus.org>2016-07-22 09:46:17 +0200
commitfb34b27c97515d06bcc00065b352704a5ea21557 (patch)
treed40e56094b9766e102368824ae794b6f0c7ba95a /rts
parentbbf36f89c7ddee9ec63b12fe735cc758de4e3da2 (diff)
downloadhaskell-fb34b27c97515d06bcc00065b352704a5ea21557.tar.gz
Revert "Cleanup PosixSource.h"
This reverts commit cac3fb06f4b282eee21159c364c4d08e8fdedce9. This breaks OS X and Windows.
Diffstat (limited to 'rts')
-rw-r--r--rts/PosixSource.h25
-rw-r--r--rts/posix/OSThreads.c5
2 files changed, 23 insertions, 7 deletions
diff --git a/rts/PosixSource.h b/rts/PosixSource.h
index c4e328c639..f4b880e525 100644
--- a/rts/PosixSource.h
+++ b/rts/PosixSource.h
@@ -11,7 +11,28 @@
#include <ghcplatform.h>
-#define _POSIX_C_SOURCE 200809L
-#define _XOPEN_SOURCE 700
+/* We aim for C99 so we need to define following two defines in a consistent way
+ with what POSIX/XOPEN provide for C99. Some OSes are particularly picky about
+ the right versions defined here, e.g. Solaris
+ We also settle on lowest version of POSIX/XOPEN needed for proper C99 support
+ here which is POSIX.1-2001 compilation and Open Group Technical Standard,
+ Issue 6 (XPG6). XPG6 itself is a result of the merge of X/Open and POSIX
+ specification. It is also referred as IEEE Std. 1003.1-2001 or ISO/IEC
+ 9945:2002 or UNIX 03 and SUSv3.
+ Please also see trac ticket #11757 for more information about switch
+ to C99/C11.
+*/
+#define _POSIX_C_SOURCE 200112L
+#define _XOPEN_SOURCE 600
+
+#define __USE_MINGW_ANSI_STDIO 1
+
+#if defined(darwin_HOST_OS)
+/* If we don't define this the including sysctl breaks with things like
+ /usr/include/bsm/audit.h:224:0:
+ error: syntax error before 'u_char'
+*/
+#define _DARWIN_C_SOURCE 1
+#endif
#endif /* POSIXSOURCE_H */
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c
index 4010c5df8e..112a311f79 100644
--- a/rts/posix/OSThreads.c
+++ b/rts/posix/OSThreads.c
@@ -14,11 +14,6 @@
* because of some specific types, like u_char, u_int, etc. */
#define __BSD_VISIBLE 1
#endif
-#if defined(darwin_HOST_OS)
-/* Inclusion of system headers usually requires _DARWIN_C_SOURCE on Mac OS X
- * because of some specific types like u_char, u_int, etc. */
-#define _DARWIN_C_SOURCE 1
-#endif
#include "Rts.h"