summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Gardas <karel.gardas@centrum.cz>2016-03-29 12:21:54 +0200
committerKarel Gardas <karel.gardas@centrum.cz>2016-03-29 15:55:12 +0200
commitbe2a7baf15c6cf414e2287bff3ed345c50de88bd (patch)
tree5da37b243cf2abf0c617dce81de4519c51b57333
parentb0ab8db61568305f50947058fc5573e2382c84eb (diff)
downloadhaskell-be2a7baf15c6cf414e2287bff3ed345c50de88bd.tar.gz
cleanup POSIX/XOPEN defines for switch to C99
Summary: This patch cleans up various POSIX and XOPEN defines. We aim to switch to C99 solely and for this the lowest version of supported POSIX/XOPEN is: _XOPEN_SOURCE 600 _POSIX_C_SOURCE 200112L Test Plan: tested on Solaris 11 and OpenBSD 5.9. Should be good also on Solaris 10, FreeBSD and DragonFlyBSD. We need to test on Mac OS X, Linux and MinGW Reviewers: austin, bgamari, erikd, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2056
-rw-r--r--rts/PosixSource.h28
1 files changed, 12 insertions, 16 deletions
diff --git a/rts/PosixSource.h b/rts/PosixSource.h
index 6246e3e35b..f4b880e525 100644
--- a/rts/PosixSource.h
+++ b/rts/PosixSource.h
@@ -11,25 +11,21 @@
#include <ghcplatform.h>
-#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(solaris2_HOST_OS)
+/* 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
-#else
-#define _POSIX_SOURCE 1
-#define _POSIX_C_SOURCE 199506L
-#define _XOPEN_SOURCE 500
-// FreeBSD takes a different approach to _ISOC99_SOURCE: on FreeBSD it
-// means "I want *just* C99 things", whereas on GNU libc and Solaris
-// it means "I also want C99 things".
-//
-// On both GNU libc and FreeBSD, _ISOC99_SOURCE is implied by
-// _XOPEN_SOURCE==600, but on Solaris it is an error to omit it.
-#define _ISOC99_SOURCE
-// Defining __USE_MINGW_ANSI_STDIO is the most portable way to tell
-// mingw that we want to use the standard %lld style format specifiers,
-// rather than the Windows %I64d style
+
#define __USE_MINGW_ANSI_STDIO 1
-#endif
#if defined(darwin_HOST_OS)
/* If we don't define this the including sysctl breaks with things like