summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-06-11 20:31:24 +0200
committerThomas Miedema <thomasmiedema@gmail.com>2015-06-11 20:31:27 +0200
commit0db0ac4a255931036c5859c3f22108f4e27ccd11 (patch)
treed29e8f47358e1443e147b8604ce3e756cd3b40cd
parenta4318c668fa49ff3423feed184c0ce58227359b8 (diff)
downloadhaskell-0db0ac4a255931036c5859c3f22108f4e27ccd11.tar.gz
Removes all occurrences of __MINGW32__ (#10485)
In Haskell files, replace `__MINGW32__` by `mingw32_HOST_OS`. In .c and .h files, delete `__MINGW32__` when `_WIN32` is also tested because `_WIN32` is always defined when `__MINGW32__` is. Also replace `__MINGW32__` by `_WIN32` when used standalone for consistency. Differential Revision: https://phabricator.haskell.org/D971
-rw-r--r--libraries/base/System/Posix/Internals.hs14
-rw-r--r--libraries/base/cbits/Win32Utils.c2
-rw-r--r--libraries/base/cbits/consUtils.c4
-rw-r--r--libraries/base/cbits/iconv.c2
-rw-r--r--libraries/base/cbits/inputReady.c4
-rw-r--r--libraries/base/include/HsBase.h22
-rw-r--r--utils/hp2ps/Main.c2
-rw-r--r--utils/touchy/touchy.c2
8 files changed, 26 insertions, 26 deletions
diff --git a/libraries/base/System/Posix/Internals.hs b/libraries/base/System/Posix/Internals.hs
index c49e61359a..1074a2c877 100644
--- a/libraries/base/System/Posix/Internals.hs
+++ b/libraries/base/System/Posix/Internals.hs
@@ -134,7 +134,7 @@ ioe_unknownfiletype = IOError Nothing UnsupportedOperation "fdType"
Nothing
fdGetMode :: FD -> IO IOMode
-#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
+#if defined(mingw32_HOST_OS)
fdGetMode _ = do
-- We don't have a way of finding out which flags are set on FDs
-- on Windows, so make a handle that thinks that anything goes.
@@ -314,7 +314,7 @@ foreign import ccall unsafe "consUtils.h is_console__"
-- Turning on non-blocking for a file descriptor
setNonBlockingFD :: FD -> Bool -> IO ()
-#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
+#if !defined(mingw32_HOST_OS)
setNonBlockingFD fd set = do
flags <- throwErrnoIfMinus1Retry "setNonBlockingFD"
(c_fcntl_read fd const_f_getfl)
@@ -336,7 +336,7 @@ setNonBlockingFD _ _ = return ()
-- -----------------------------------------------------------------------------
-- Set close-on-exec for a file descriptor
-#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
+#if !defined(mingw32_HOST_OS)
setCloseOnExec :: FD -> IO ()
setCloseOnExec fd = do
throwErrnoIfMinus1_ "setCloseOnExec" $
@@ -346,7 +346,7 @@ setCloseOnExec fd = do
-- -----------------------------------------------------------------------------
-- foreign imports
-#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
+#if !defined(mingw32_HOST_OS)
type CFilePath = CString
#else
type CFilePath = CWString
@@ -376,7 +376,7 @@ foreign import ccall unsafe "HsBase.h __hscore_fstat"
foreign import ccall unsafe "HsBase.h isatty"
c_isatty :: CInt -> IO CInt
-#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
+#if defined(mingw32_HOST_OS)
foreign import ccall unsafe "io.h _lseeki64"
c_lseek :: CInt -> Int64 -> CInt -> IO Int64
#else
@@ -427,7 +427,7 @@ foreign import ccall unsafe "HsBase.h unlink"
foreign import ccall unsafe "HsBase.h getpid"
c_getpid :: IO CPid
-#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
+#if !defined(mingw32_HOST_OS)
foreign import capi unsafe "HsBase.h fcntl"
c_fcntl_read :: CInt -> CInt -> IO CInt
@@ -539,7 +539,7 @@ foreign import ccall unsafe "HsBase.h __hscore_ptr_c_cc" ptr_c_cc :: Ptr CTermi
#endif
s_issock :: CMode -> Bool
-#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
+#if !defined(mingw32_HOST_OS)
s_issock cmode = c_s_issock cmode /= 0
foreign import capi unsafe "sys/stat.h S_ISSOCK" c_s_issock :: CMode -> CInt
#else
diff --git a/libraries/base/cbits/Win32Utils.c b/libraries/base/cbits/Win32Utils.c
index 7038cbf48e..1b9292c3b4 100644
--- a/libraries/base/cbits/Win32Utils.c
+++ b/libraries/base/cbits/Win32Utils.c
@@ -4,7 +4,7 @@
Useful Win32 bits
------------------------------------------------------------------------- */
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
+#if defined(_MSC_VER) || defined(_WIN32)
#include "HsBase.h"
diff --git a/libraries/base/cbits/consUtils.c b/libraries/base/cbits/consUtils.c
index b20eb7ae07..c56be21632 100644
--- a/libraries/base/cbits/consUtils.c
+++ b/libraries/base/cbits/consUtils.c
@@ -3,7 +3,7 @@
*
* Win32 Console API support
*/
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_MSC_VER) || defined(_WIN32) || defined(__CYGWIN__)
/* to the end */
#include "consUtils.h"
@@ -108,4 +108,4 @@ flush_input_console__(int fd)
return -1;
}
-#endif /* defined(__MINGW32__) || ... */
+#endif /* defined(_WIN32) || ... */
diff --git a/libraries/base/cbits/iconv.c b/libraries/base/cbits/iconv.c
index 4aedca8587..2246ca67db 100644
--- a/libraries/base/cbits/iconv.c
+++ b/libraries/base/cbits/iconv.c
@@ -1,4 +1,4 @@
-#ifndef __MINGW32__
+#ifndef _WIN32
#include <stdlib.h>
#include <iconv.h>
diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c
index dac9d9b524..edb44726c5 100644
--- a/libraries/base/cbits/inputReady.c
+++ b/libraries/base/cbits/inputReady.c
@@ -17,7 +17,7 @@ int
fdReady(int fd, int write, int msecs, int isSock)
{
if
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
+#if defined(_MSC_VER) || defined(_WIN32)
( isSock ) {
#else
( 1 ) {
@@ -54,7 +54,7 @@ fdReady(int fd, int write, int msecs, int isSock)
/* 1 => Input ready, 0 => not ready, -1 => error */
return (ready);
}
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
+#if defined(_MSC_VER) || defined(_WIN32)
else {
DWORD rc;
HANDLE hFile = (HANDLE)_get_osfhandle(fd);
diff --git a/libraries/base/include/HsBase.h b/libraries/base/include/HsBase.h
index 46d0f0c102..7afd5a5aee 100644
--- a/libraries/base/include/HsBase.h
+++ b/libraries/base/include/HsBase.h
@@ -86,7 +86,7 @@
#if HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
-#if HAVE_WINSOCK_H && defined(__MINGW32__)
+#if HAVE_WINSOCK_H && defined(_WIN32)
#include <winsock.h>
#endif
#if HAVE_LIMITS_H
@@ -111,7 +111,7 @@
# include <mach/mach_time.h>
#endif
-#if !defined(__MINGW32__) && !defined(irix_HOST_OS)
+#if !defined(_WIN32) && !defined(irix_HOST_OS)
# if HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
# endif
@@ -134,14 +134,14 @@
#endif
#include "WCsubst.h"
-#if defined(__MINGW32__)
+#if defined(_WIN32)
/* in Win32Utils.c */
extern void maperrno (void);
extern int maperrno_func(DWORD dwErrorCode);
extern HsWord64 getMonotonicUSec(void);
#endif
-#if defined(__MINGW32__)
+#if defined(_WIN32)
#include <io.h>
#include <fcntl.h>
#include <shlobj.h>
@@ -298,14 +298,14 @@ __hscore_ftruncate( int fd, off_t where )
INLINE int
__hscore_setmode( int fd, HsBool toBin )
{
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
+#if defined(_MSC_VER) || defined(_WIN32)
return setmode(fd,(toBin == HS_BOOL_TRUE) ? _O_BINARY : _O_TEXT);
#else
return 0;
#endif
}
-#if defined(__MINGW32__)
+#if defined(_WIN32)
// We want the versions of stat/fstat/lseek that use 64-bit offsets,
// and you have to ask for those explicitly. Unfortunately there
// doesn't seem to be a 64-bit version of truncate/ftruncate, so while
@@ -331,7 +331,7 @@ INLINE dev_t __hscore_st_dev ( struct_stat* st ) { return st->st_dev; }
INLINE ino_t __hscore_st_ino ( struct_stat* st ) { return st->st_ino; }
#endif
-#if defined(__MINGW32__)
+#if defined(_WIN32)
INLINE int __hscore_stat(wchar_t *file, struct_stat *buf) {
return _wstati64(file,buf);
}
@@ -375,7 +375,7 @@ __hscore_ptr_c_cc( struct termios* ts )
INLINE HsInt
__hscore_sizeof_termios( void )
{
-#ifndef __MINGW32__
+#ifndef _WIN32
return sizeof(struct termios);
#else
return 0;
@@ -383,7 +383,7 @@ __hscore_sizeof_termios( void )
}
#endif
-#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(_WIN32)
+#if !defined(_MSC_VER) && !defined(_WIN32)
INLINE HsInt
__hscore_sizeof_sigset_t( void )
{
@@ -468,7 +468,7 @@ INLINE int __hscore_sig_setmask( void )
#endif
}
-#ifndef __MINGW32__
+#ifndef _WIN32
INLINE size_t __hscore_sizeof_siginfo_t (void)
{
return sizeof(siginfo_t);
@@ -519,7 +519,7 @@ __hscore_fd_cloexec( void )
extern void* __hscore_get_saved_termios(int fd);
extern void __hscore_set_saved_termios(int fd, void* ts);
-#ifdef __MINGW32__
+#ifdef _WIN32
INLINE int __hscore_open(wchar_t *file, int how, mode_t mode) {
if ((how & O_WRONLY) || (how & O_RDWR) || (how & O_APPEND))
return _wsopen(file,how | _O_NOINHERIT,_SH_DENYNO,mode);
diff --git a/utils/hp2ps/Main.c b/utils/hp2ps/Main.c
index 1c21d2b2cb..709bb1357d 100644
--- a/utils/hp2ps/Main.c
+++ b/utils/hp2ps/Main.c
@@ -143,7 +143,7 @@ nextarg: ;
if (!filter) {
pathName = copystring(argv[0]);
DropSuffix(pathName, ".hp");
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
+#if defined(_MSC_VER) || defined(_WIN32)
DropSuffix(pathName, ".exe");
#endif
baseName = copystring(Basename(pathName));
diff --git a/utils/touchy/touchy.c b/utils/touchy/touchy.c
index 7252012366..a8ac14658d 100644
--- a/utils/touchy/touchy.c
+++ b/utils/touchy/touchy.c
@@ -2,7 +2,7 @@
* Simple 'touch' program for Windows
*
*/
-#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(_WIN32)
+#if !defined(_MSC_VER) && !defined(_WIN32)
#error "Win32-only, the platform you're using is supposed to have 'touch' already."
#else
#include <stdio.h>