Commit 23e344bb authored by Erik de Castro Lopo's avatar Erik de Castro Lopo Committed by Ben Gamari

Remove cygwin32_HOST_OS #ifdefs

Build system support for Cygwin was removed in b6be81b8.

Test Plan:
 - Validate on x86_64/linux
 - Cross-compile rts/RtsSymbols.c and rts/Linker.c to Windows using the
   i686-w64-mingw32-gcc and x86_64-w64-mingw32-gcc cross compilers.

Reviewers: hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1371
parent 73c273af
......@@ -6,7 +6,7 @@
-- Module : System.CPUTime
-- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/base/LICENSE)
--
--
-- Maintainer : libraries@haskell.org
-- Stability : provisional
-- Portability : portable
......@@ -18,7 +18,7 @@
#include "HsFFI.h"
#include "HsBaseConfig.h"
module System.CPUTime
module System.CPUTime
(
getCPUTime, -- :: IO Integer
cpuTimePrecision -- :: Integer
......@@ -57,10 +57,10 @@ import Foreign.C
##else
##endif
#if !defined(mingw32_HOST_OS) && !defined(cygwin32_HOST_OS)
#if !defined(mingw32_HOST_OS)
realToInteger :: Real a => a -> Integer
realToInteger ct = round (realToFrac ct :: Double)
-- CTime, CClock, CUShort etc are in Real but not Fractional,
-- CTime, CClock, CUShort etc are in Real but not Fractional,
-- so we must convert to Double before we can round it
#endif
......@@ -72,7 +72,7 @@ realToInteger ct = round (realToFrac ct :: Double)
getCPUTime :: IO Integer
getCPUTime = do
#if !defined(mingw32_HOST_OS) && !defined(cygwin32_HOST_OS)
#if !defined(mingw32_HOST_OS)
-- getrusage() is right royal pain to deal with when targetting multiple
-- versions of Solaris, since some versions supply it in libc (2.3 and 2.5),
-- while 2.4 has got it in libucb (I wouldn't be too surprised if it was back
......@@ -90,8 +90,8 @@ getCPUTime = do
u_usec <- (#peek struct timeval,tv_usec) ru_utime :: IO CSUSeconds
s_sec <- (#peek struct timeval,tv_sec) ru_stime :: IO CTime
s_usec <- (#peek struct timeval,tv_usec) ru_stime :: IO CSUSeconds
return ((realToInteger u_sec * 1000000 + realToInteger u_usec +
realToInteger s_sec * 1000000 + realToInteger s_usec)
return ((realToInteger u_sec * 1000000 + realToInteger u_usec +
realToInteger s_sec * 1000000 + realToInteger s_usec)
* 1000000)
type CRUsage = ()
......@@ -101,13 +101,13 @@ foreign import capi unsafe "HsBase.h getrusage" getrusage :: CInt -> Ptr CRUsage
_ <- times p_tms
u_ticks <- (#peek struct tms,tms_utime) p_tms :: IO CClock
s_ticks <- (#peek struct tms,tms_stime) p_tms :: IO CClock
return (( (realToInteger u_ticks + realToInteger s_ticks) * 1000000000000)
return (( (realToInteger u_ticks + realToInteger s_ticks) * 1000000000000)
`div` fromIntegral clockTicks)
type CTms = ()
foreign import ccall unsafe times :: Ptr CTms -> IO CClock
#else
ioException (IOError Nothing UnsupportedOperation
ioException (IOError Nothing UnsupportedOperation
"getCPUTime"
"can't get CPU time"
Nothing)
......@@ -127,12 +127,12 @@ foreign import ccall unsafe times :: Ptr CTms -> IO CClock
kt <- ft2psecs p_kernelTime
return (ut + kt)
else return 0
where
where
ft2psecs :: Ptr FILETIME -> IO Integer
ft2psecs ft = do
high <- (#peek FILETIME,dwHighDateTime) ft :: IO Word32
low <- (#peek FILETIME,dwLowDateTime) ft :: IO Word32
-- Convert 100-ns units to picosecs (10^-12)
-- Convert 100-ns units to picosecs (10^-12)
-- => multiply by 10^5.
return (((fromIntegral high) * (2^(32::Int)) + (fromIntegral low)) * 100000)
......
......@@ -58,22 +58,6 @@
#include <dlfcn.h>
#endif
#if defined(cygwin32_HOST_OS)
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <regex.h>
#include <sys/fcntl.h>
#include <sys/termios.h>
#include <sys/utime.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#endif
#if (defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS)) \
|| (!defined(powerpc_HOST_ARCH) && \
( defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || \
......@@ -110,7 +94,7 @@
# define OBJFORMAT_ELF
# include <regex.h> // regex is already used by dlopen() so this is OK
// to use here without requiring an additional lib
#elif defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
#elif defined (mingw32_HOST_OS)
# define OBJFORMAT_PEi386
# include <windows.h>
# include <shfolder.h> /* SHGetFolderPathW */
......
......@@ -108,7 +108,7 @@ vdebugBelch(const char*s, va_list ap)
#define BUFSIZE 512
#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
#if defined (mingw32_HOST_OS)
static int
isGUIApp(void)
{
......@@ -133,7 +133,7 @@ isGUIApp(void)
void GNU_ATTRIBUTE(__noreturn__)
rtsFatalInternalErrorFn(const char *s, va_list ap)
{
#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
#if defined (mingw32_HOST_OS)
if (isGUIApp())
{
char title[BUFSIZE], message[BUFSIZE];
......@@ -174,7 +174,7 @@ rtsFatalInternalErrorFn(const char *s, va_list ap)
void
rtsErrorMsgFn(const char *s, va_list ap)
{
#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
#if defined (mingw32_HOST_OS)
if (isGUIApp())
{
char buf[BUFSIZE];
......@@ -206,7 +206,7 @@ rtsSysErrorMsgFn(const char *s, va_list ap)
{
char *syserr;
#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
#if defined (mingw32_HOST_OS)
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
......@@ -245,7 +245,7 @@ rtsSysErrorMsgFn(const char *s, va_list ap)
}
vfprintf(stderr, s, ap);
if (syserr) {
#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
#if defined (mingw32_HOST_OS)
// Win32 error messages have a terminating \n
fprintf(stderr, ": %s", syserr);
#else
......@@ -256,7 +256,7 @@ rtsSysErrorMsgFn(const char *s, va_list ap)
}
}
#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
#if defined (mingw32_HOST_OS)
if (syserr) LocalFree(syserr);
#endif
}
......@@ -264,7 +264,7 @@ rtsSysErrorMsgFn(const char *s, va_list ap)
void
rtsDebugMsgFn(const char *s, va_list ap)
{
#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
#if defined (mingw32_HOST_OS)
if (isGUIApp())
{
char buf[BUFSIZE];
......
......@@ -47,93 +47,8 @@
SymI_NeedsDataProto(nocldstop)
#endif
#if defined (cygwin32_HOST_OS)
#define RTS_MINGW_ONLY_SYMBOLS /**/
/* Don't have the ability to read import libs / archives, so
* we have to stupidly list a lot of what libcygwin.a
* exports; sigh.
*/
#define RTS_CYGWIN_ONLY_SYMBOLS \
SymI_HasProto(regfree) \
SymI_HasProto(regexec) \
SymI_HasProto(regerror) \
SymI_HasProto(regcomp) \
SymI_HasProto(__errno) \
SymI_HasProto(access) \
SymI_HasProto(chmod) \
SymI_HasProto(chdir) \
SymI_HasProto(close) \
SymI_HasProto(creat) \
SymI_HasProto(dup) \
SymI_HasProto(dup2) \
SymI_HasProto(fstat) \
SymI_HasProto(fcntl) \
SymI_HasProto(getcwd) \
SymI_HasProto(getenv) \
SymI_HasProto(lseek) \
SymI_HasProto(open) \
SymI_HasProto(fpathconf) \
SymI_HasProto(pathconf) \
SymI_HasProto(stat) \
SymI_HasProto(pow) \
SymI_HasProto(tanh) \
SymI_HasProto(cosh) \
SymI_HasProto(sinh) \
SymI_HasProto(atan) \
SymI_HasProto(acos) \
SymI_HasProto(asin) \
SymI_HasProto(tan) \
SymI_HasProto(cos) \
SymI_HasProto(sin) \
SymI_HasProto(exp) \
SymI_HasProto(log) \
SymI_HasProto(sqrt) \
SymI_HasProto(localtime_r) \
SymI_HasProto(gmtime_r) \
SymI_HasProto(mktime) \
SymI_NeedsProto(_imp___tzname) \
SymI_HasProto(gettimeofday) \
SymI_HasProto(timezone) \
SymI_HasProto(tcgetattr) \
SymI_HasProto(tcsetattr) \
SymI_HasProto(memcpy) \
SymI_HasProto(memmove) \
SymI_HasProto(realloc) \
SymI_HasProto(malloc) \
SymI_HasProto(free) \
SymI_HasProto(fork) \
SymI_HasProto(lstat) \
SymI_HasProto(isatty) \
SymI_HasProto(mkdir) \
SymI_HasProto(opendir) \
SymI_HasProto(readdir) \
SymI_HasProto(rewinddir) \
SymI_HasProto(closedir) \
SymI_HasProto(link) \
SymI_HasProto(mkfifo) \
SymI_HasProto(pipe) \
SymI_HasProto(read) \
SymI_HasProto(rename) \
SymI_HasProto(rmdir) \
SymI_HasProto(select) \
SymI_HasProto(system) \
SymI_HasProto(write) \
SymI_HasProto(strcmp) \
SymI_HasProto(strcpy) \
SymI_HasProto(strncpy) \
SymI_HasProto(strerror) \
SymI_HasProto(sigaddset) \
SymI_HasProto(sigemptyset) \
SymI_HasProto(sigprocmask) \
SymI_HasProto(umask) \
SymI_HasProto(uname) \
SymI_HasProto(unlink) \
SymI_HasProto(utime) \
SymI_HasProto(waitpid)
#elif defined(mingw32_HOST_OS)
#if defined(mingw32_HOST_OS)
#define RTS_POSIX_ONLY_SYMBOLS /**/
#define RTS_CYGWIN_ONLY_SYMBOLS /**/
#if HAVE_GETTIMEOFDAY
#define RTS_MINGW_GETTIMEOFDAY_SYM SymI_NeedsProto(gettimeofday)
......@@ -476,7 +391,6 @@
#else
#define RTS_MINGW_ONLY_SYMBOLS /**/
#define RTS_CYGWIN_ONLY_SYMBOLS /**/
#endif
......@@ -1144,7 +1058,6 @@ RTS_SYMBOLS
RTS_RET_SYMBOLS
RTS_POSIX_ONLY_SYMBOLS
RTS_MINGW_ONLY_SYMBOLS
RTS_CYGWIN_ONLY_SYMBOLS
RTS_DARWIN_ONLY_SYMBOLS
RTS_LIBGCC_SYMBOLS
RTS_LIBFFI_SYMBOLS
......@@ -1182,7 +1095,6 @@ RtsSymbolVal rtsSyms[] = {
RTS_RET_SYMBOLS
RTS_POSIX_ONLY_SYMBOLS
RTS_MINGW_ONLY_SYMBOLS
RTS_CYGWIN_ONLY_SYMBOLS
RTS_DARWIN_ONLY_SYMBOLS
RTS_LIBGCC_SYMBOLS
RTS_LIBFFI_SYMBOLS
......
......@@ -460,7 +460,7 @@ void traceOSProcessInfo_(void) {
CAPSET_OSPROCESS_DEFAULT,
getpid());
#if !defined(cygwin32_HOST_OS) && !defined (mingw32_HOST_OS)
#if !defined (mingw32_HOST_OS)
/* Windows has no strong concept of process hierarchy, so no getppid().
* In any case, this trace event is mainly useful for tracing programs
* that use 'forkProcess' which Windows doesn't support anyway.
......
......@@ -15,7 +15,7 @@ withPathString = withCString
#endif
mungeDLL :: FilePath -> FilePath
#if defined(mingw32_HOST_OS) || defined(cygwin32_HOST_OS)
#if defined(mingw32_HOST_OS)
-- Strip extension because addDLL on Windows doesn't want it
mungeDLL f =
let (base, ext) = splitExtension f
......
......@@ -11,7 +11,7 @@ static void ctors2(void) { printf("ctors2\n"); fflush(stdout); }
static void modInitFunc1(void) { printf("modInitFunc1\n"); fflush(stdout); }
static void modInitFunc2(void) { printf("modInitFunc2\n"); fflush(stdout); }
#if defined(cygwin32_HOST_OS) || defined(mingw32_HOST_OS)
#if defined(mingw32_HOST_OS)
static void (*ctors[2])(void) __attribute__((
section(".ctors"),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment