[project @ 2001-08-14 13:40:07 by sewardj]
authorsewardj <unknown>
Tue, 14 Aug 2001 13:40:11 +0000 (13:40 +0000)
committersewardj <unknown>
Tue, 14 Aug 2001 13:40:11 +0000 (13:40 +0000)
Change the story about POSIX headers in C compilation.

Until now, all C code in the RTS and library cbits has by default been
compiled with settings for POSIXness enabled, that is:
   #define _POSIX_SOURCE   1
   #define _POSIX_C_SOURCE 199309L
   #define _ISOC9X_SOURCE
If you wanted to negate this, you'd have to define NON_POSIX_SOURCE
before including headers.

This scheme has some bad effects:

* It means that ccall-unfoldings exported via interfaces from a
  module compiled with -DNON_POSIX_SOURCE may not compile when
  imported into a module which does not -DNON_POSIX_SOURCE.

* It overlaps with the feature tests we do with autoconf.

* It seems to have caused borkage in the Solaris builds for some
  considerable period of time.

The New Way is:

* The default changes to not-being-in-Posix mode.

* If you want to force a C file into Posix mode, #include as
  the **first** include the new file ghc/includes/PosixSource.h.
  Most of the RTS C sources have this include now.

* NON_POSIX_SOURCE is almost totally expunged.  Unfortunately
  we have to retain some vestiges of it in ghc/compiler so that
  modules compiled via C on Solaris using older compilers don't
  break.

58 files changed:
configure.in
ghc/compiler/ghci/ByteCodeItbls.lhs
ghc/compiler/ghci/ByteCodeLink.lhs
ghc/compiler/main/DriverState.hs
ghc/compiler/main/Main.hs
ghc/compiler/prelude/PrelRules.lhs
ghc/compiler/utils/PrimPacked.lhs
ghc/compiler/utils/StringBuffer.lhs
ghc/includes/PosixSource.h [new file with mode: 0644]
ghc/includes/Stg.h
ghc/lib/std/PrelPosix.hsc
ghc/lib/std/Time.hsc
ghc/lib/std/cbits/inputReady.c
ghc/lib/std/cbits/system.c
ghc/rts/Adjustor.c
ghc/rts/BlockAlloc.c
ghc/rts/ClosureFlags.c
ghc/rts/Disassembler.c
ghc/rts/FrontPanel.c
ghc/rts/GC.c
ghc/rts/GCCompact.c
ghc/rts/Hash.c
ghc/rts/Interpreter.c
ghc/rts/Itimer.c
ghc/rts/Linker.c
ghc/rts/LinkerBasic.c
ghc/rts/MBlock.c
ghc/rts/Main.c
ghc/rts/Printer.c
ghc/rts/ProfHeap.c
ghc/rts/Profiling.c
ghc/rts/Proftimer.c
ghc/rts/RtsAPI.c
ghc/rts/RtsAPIDeprec.c
ghc/rts/RtsDllMain.c
ghc/rts/RtsFlags.c
ghc/rts/RtsStartup.c
ghc/rts/RtsUtils.c
ghc/rts/Sanity.c
ghc/rts/Schedule.c
ghc/rts/Select.c
ghc/rts/Signals.c
ghc/rts/Sparks.c
ghc/rts/Stable.c
ghc/rts/Stats.c
ghc/rts/StgCRun.c
ghc/rts/StgPrimFloat.c
ghc/rts/Storage.c
ghc/rts/StrHash.c
ghc/rts/Ticky.c
ghc/rts/VisCallbacks.c
ghc/rts/Weak.c
ghc/rts/parallel/HLComms.c
ghc/rts/parallel/LLComms.c
ghc/rts/parallel/ParInit.c
ghc/rts/parallel/SysMan.c
ghc/tests/codeGen/should_run/cg035.hs
mk/config.h.in

index cafba55..27447f3 100644 (file)
@@ -626,7 +626,7 @@ dnl ** check for full ANSI header (.h) files
 AC_HEADER_STDC
 
 dnl ** check for specific header (.h) files that we are interested in
-AC_CHECK_HEADERS(Files.h arpa/inet.h assert.h console.h ctype.h dirent.h errno.h fcntl.h float.h ftw.h grp.h ieee754.h inttypes.h malloc.h memory.h nlist.h pascal.h pwd.h sgtty.h siginfo.h signal.h stat.h stdint.h stdlib.h stdarg.h string.h sys/fault.h sys/file.h sys/ioctl.h sys/limits.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.h sys/socket.h netdb.h netinet/in.h netinet/tcp.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/un.h sys/utsname.h sys/vadvise.h sys/wait.h termio.h termios.h time.h types.h unistd.h utime.h values.h vfork.h bfd.h winsock.h)
+AC_CHECK_HEADERS(Files.h arpa/inet.h assert.h console.h ctype.h dirent.h errno.h fcntl.h float.h ftw.h grp.h ieee754.h inttypes.h limits.h malloc.h memory.h nlist.h pascal.h pwd.h sgtty.h siginfo.h signal.h stat.h stdint.h stdlib.h stdarg.h string.h sys/fault.h sys/file.h sys/ioctl.h sys/limits.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.h sys/socket.h netdb.h netinet/in.h netinet/tcp.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/un.h sys/utsname.h sys/vadvise.h sys/wait.h termio.h termios.h time.h types.h unistd.h utime.h values.h vfork.h bfd.h winsock.h)
 
 AC_CHECK_HEADER(readline/readline.h, HaveReadlineReadlineH=YES, HaveReadlineReadlineH=NO)
 AC_CHECK_HEADER(readline/history.h, HaveReadlineHistoryH=YES, HaveReadlineHistoryH=NO)
index 7a42b8d..ae1f35b 100644 (file)
@@ -4,6 +4,9 @@
 \section[ByteCodeItbls]{Generate infotables for interpreter-made bytecodes}
 
 \begin{code}
+
+{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
+
 module ByteCodeItbls ( ItblEnv, ItblPtr, mkITbls ) where
 
 #include "HsVersions.h"
index 70727f4..73ccb95 100644 (file)
@@ -4,6 +4,9 @@
 \section[ByteCodeLink]{Bytecode assembler and linker}
 
 \begin{code}
+
+{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
+
 module ByteCodeLink ( UnlinkedBCO, UnlinkedBCOExpr, assembleBCO,
                      ClosureEnv, HValue, filterNameMap,
                      linkIModules, linkIExpr,
index e9b6282..e45dcd0 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.53 2001/08/13 15:49:38 simonmar Exp $
+-- $Id: DriverState.hs,v 1.54 2001/08/14 13:40:08 sewardj Exp $
 --
 -- Settings for the driver
 --
@@ -146,7 +146,7 @@ GLOBAL_VAR(v_minus_o2_for_C,            False, Bool)
 GLOBAL_VAR(v_MaxSimplifierIterations,   4,     Int)
 GLOBAL_VAR(v_StgStats,                  False, Bool)
 GLOBAL_VAR(v_UsageSPInf,               False, Bool)  -- Off by default
-GLOBAL_VAR(v_Strictness,               True,  Bool)
+GLOBAL_VAR(v_Strictness,               False{-True-},  Bool)
 GLOBAL_VAR(v_CPR,                      True,  Bool)
 GLOBAL_VAR(v_CSE,                      True,  Bool)
 
index 0ecb6d2..b11326c 100644 (file)
@@ -1,6 +1,7 @@
-{-# OPTIONS -fno-warn-incomplete-patterns #-}
+{-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
+
 -----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.86 2001/08/13 15:49:38 simonmar Exp $
+-- $Id: Main.hs,v 1.87 2001/08/14 13:40:08 sewardj Exp $
 --
 -- GHC Driver program
 --
index bf3549e..7b944ed 100644 (file)
@@ -12,6 +12,9 @@ ToDo:
    (i1 + i2) only if it results        in a valid Float.
 
 \begin{code}
+
+{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
+
 module PrelRules ( primOpRule, builtinRules ) where
 
 #include "HsVersions.h"
index d6b25c4..286cf12 100644 (file)
@@ -8,7 +8,7 @@ of bytes (character strings). Used by the interface lexer input
 subsystem, mostly.
 
 \begin{code}
-{-# OPTIONS -fvia-C -monly-3-regs #-}
+{-# OPTIONS -monly-3-regs -optc-DNON_POSIX_SOURCE #-}
 module PrimPacked
        (
         strLength,          -- :: _Addr -> Int
index 8853ed7..dfe061e 100644 (file)
@@ -7,7 +7,7 @@ Buffers for scanning string input stored in external arrays.
 
 \begin{code}
 
-{-# OPTIONS -fvia-C #-}
+{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
 
 module StringBuffer
        (
diff --git a/ghc/includes/PosixSource.h b/ghc/includes/PosixSource.h
new file mode 100644 (file)
index 0000000..5ccff75
--- /dev/null
@@ -0,0 +1,19 @@
+/* -----------------------------------------------------------------------------
+ * $Id: PosixSource.h,v 1.1 2001/08/14 13:40:08 sewardj Exp $
+ *
+ * (c) The GHC Team, 1998-2001
+ *
+ * Include this file into sources which should not need any non-Posix services.
+ * That includes most RTS C sources.
+ * ---------------------------------------------------------------------------*/
+
+#ifndef POSIXSOURCE_H
+#define POSIXSOURCE_H
+
+#define _POSIX_SOURCE   1
+#define _POSIX_C_SOURCE 199309L
+#define _ISOC9X_SOURCE
+
+/* Let's be ISO C9X too... */
+
+#endif
index 8908cf3..b046847 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Stg.h,v 1.36 2001/03/01 12:25:32 rrt Exp $
+ * $Id: Stg.h,v 1.37 2001/08/14 13:40:08 sewardj Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
 #ifndef STG_H
 #define STG_H
 
-#ifndef NON_POSIX_SOURCE
-#define _POSIX_SOURCE   1
-#define _POSIX_C_SOURCE 199309L
-#define _ISOC9X_SOURCE
-#endif
-
-/* Let's be ISO C9X too... */
 
 /* If we include "Stg.h" directly, we're in STG code, and we therefore
  * get all the global register variables, macros etc. that go along
index 59b953c..6432a29 100644 (file)
@@ -1,15 +1,18 @@
-{-# OPTIONS -fno-implicit-prelude -optc-DNON_POSIX_SOURCE #-}
+{-# OPTIONS -fno-implicit-prelude #-}
 
 -- ---------------------------------------------------------------------------
--- $Id: PrelPosix.hsc,v 1.10 2001/08/10 11:02:00 simonmar Exp $
+-- $Id: PrelPosix.hsc,v 1.11 2001/08/14 13:40:08 sewardj Exp $
 --
 -- POSIX support layer for the standard libraries
 --
--- NON_POSIX_SOURCE needed for the following features:
+-- Non-posix compliant in order to support the following features:
 --     * S_ISSOCK (no sockets in POSIX)
 
 module PrelPosix where
 
+-- See above comment for non-Posixness reasons.
+-- #include "PosixSource.h"
+
 #include "HsStd.h"
 
 import PrelBase
index fbfc0bd..45d8583 100644 (file)
@@ -1,9 +1,6 @@
-{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
--- JRS 010117: we had to say NON_POSIX_SOURCE to get the resulting .hc
--- to compile on sparc-solaris.  Blargh.
 
 -- -----------------------------------------------------------------------------
--- $Id: Time.hsc,v 1.19 2001/07/24 05:53:27 ken Exp $
+-- $Id: Time.hsc,v 1.20 2001/08/14 13:40:08 sewardj Exp $
 --
 -- (c) The University of Glasgow, 1995-2001
 --
index 5ab2991..69737c5 100644 (file)
@@ -1,16 +1,13 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: inputReady.c,v 1.8 2001/07/09 16:30:50 sof Exp $
+ * $Id: inputReady.c,v 1.9 2001/08/14 13:40:08 sewardj Exp $
  *
  * hReady Runtime Support
  */
 
-/* select and supporting types is not */
-#ifndef _AIX
-#define NON_POSIX_SOURCE  
-#endif
-
+/* select and supporting types is not Posix */
+/* #include "PosixSource.h" */
 #include "HsStd.h"
 
 /*
index d077323..b912a48 100644 (file)
@@ -1,13 +1,13 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: system.c,v 1.17 2001/08/07 08:18:15 rrt Exp $
+ * $Id: system.c,v 1.18 2001/08/14 13:40:08 sewardj Exp $
  *
  * system Runtime Support
  */
 
 /* The itimer stuff in this module is non-posix */
-#define NON_POSIX_SOURCE
+/* #include "PosixSource.h" */
 
 #include "HsStd.h"
 
index e4a0f03..4d6c223 100644 (file)
@@ -36,6 +36,7 @@ and C resources. Failure to do so result in memory leaks on both the C and
 Haskell side.
 
 */
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsUtils.h"
 #include "RtsFlags.h"
index 6186671..65205f8 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: BlockAlloc.c,v 1.9 2001/07/23 17:23:19 simonmar Exp $
+ * $Id: BlockAlloc.c,v 1.10 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team 1998-2000
  * 
@@ -16,6 +16,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsFlags.h"
 #include "RtsUtils.h"
index b94670b..314d5f5 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: ClosureFlags.c,v 1.10 2001/07/23 17:23:19 simonmar Exp $
+ * $Id: ClosureFlags.c,v 1.11 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 
 StgWord16 closure_flags[] = {
index 574f0a8..0063a65 100644 (file)
@@ -5,12 +5,13 @@
  * Copyright (c) 1994-1998.
  *
  * $RCSfile: Disassembler.c,v $
- * $Revision: 1.23 $
- * $Date: 2001/08/09 11:19:16 $
+ * $Revision: 1.24 $
+ * $Date: 2001/08/14 13:40:09 $
  * ---------------------------------------------------------------------------*/
 
 #ifdef DEBUG
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsAPI.h"
 #include "RtsUtils.h"
index 5f28103..78675c6 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: FrontPanel.c,v 1.4 2001/01/19 11:08:05 simonmar Exp $
+ * $Id: FrontPanel.c,v 1.5 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team 2000
  *
@@ -9,7 +9,8 @@
 
 #ifdef RTS_GTK_FRONTPANEL
 
-#define NON_POSIX_SOURCE
+/* Alas, not Posix. */
+/* #include "PosixSource.h" */
 
 #include "Rts.h"
 #include "RtsUtils.h"
index 67d744a..23c835f 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: GC.c,v 1.119 2001/08/10 10:52:12 simonmar Exp $
+ * $Id: GC.c,v 1.120 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsFlags.h"
 #include "RtsUtils.h"
index 8f494f4..3254ba6 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: GCCompact.c,v 1.8 2001/08/10 09:40:11 simonmar Exp $
+ * $Id: GCCompact.c,v 1.9 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team 2001
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsUtils.h"
 #include "RtsFlags.h"
index 50fb3bc..9b9e98a 100644 (file)
@@ -1,5 +1,5 @@
 /*-----------------------------------------------------------------------------
- * $Id: Hash.c,v 1.5 2001/06/27 11:29:10 sewardj Exp $
+ * $Id: Hash.c,v 1.6 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The AQUA Project, Glasgow University, 1995-1998
  * (c) The GHC Team, 1999
@@ -9,6 +9,7 @@
  * pp. 446 -- 457.
  * -------------------------------------------------------------------------- */
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "Hash.h"
 #include "RtsUtils.h"
index 68ab9fe..deb42fb 100644 (file)
@@ -5,10 +5,11 @@
  * Copyright (c) 1994-2000.
  *
  * $RCSfile: Interpreter.c,v $
- * $Revision: 1.29 $
- * $Date: 2001/08/09 11:23:19 $
+ * $Revision: 1.30 $
+ * $Date: 2001/08/14 13:40:09 $
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsAPI.h"
 #include "RtsUtils.h"
index 5b10a5b..1d63adf 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Itimer.c,v 1.22 2001/03/02 10:52:15 simonmar Exp $
+ * $Id: Itimer.c,v 1.23 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1995-1999
  *
@@ -18,9 +18,8 @@
  * to support.  So much for standards.
  */
 
-#if !defined(_AIX)
-# define NON_POSIX_SOURCE
-#endif
+/* This is not posix compliant. */
+/* #include "PosixSource.h" */
 
 #include "Rts.h"
 #include "RtsFlags.h"
index fe6326b..a4f85e1 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Linker.c,v 1.56 2001/08/13 14:34:40 simonmar Exp $
+ * $Id: Linker.c,v 1.57 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 2000
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsFlags.h"
 #include "HsFFI.h"
index 391fb92..bd079ef 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: LinkerBasic.c,v 1.2 2001/02/12 13:03:17 sewardj Exp $
+ * $Id: LinkerBasic.c,v 1.3 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 2000
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "Hash.h"
 #include "StoragePriv.h"
index a1b39dd..4ebbc28 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: MBlock.c,v 1.22 2001/07/24 06:31:36 ken Exp $
+ * $Id: MBlock.c,v 1.23 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -9,7 +9,8 @@
  *
  * ---------------------------------------------------------------------------*/
 
-#define NON_POSIX_SOURCE
+/* This is non-posix compliant. */
+/* #include "PosixSource.h" */
 
 #include "Rts.h"
 #include "RtsUtils.h"
index 41f9d99..11a0027 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Main.c,v 1.29 2001/08/07 20:10:30 ken Exp $
+ * $Id: Main.c,v 1.30 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team 1998-2000
  *
@@ -9,6 +9,7 @@
 
 #define COMPILING_RTS_MAIN
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsAPI.h"
 #include "SchedAPI.h"
index e73b3f7..949ca86 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Printer.c,v 1.44 2001/08/09 11:19:16 sewardj Exp $
+ * $Id: Printer.c,v 1.45 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1994-2000.
  *
@@ -7,6 +7,7 @@
  * 
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "Printer.h"
 
index fb872ea..5597792 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: ProfHeap.c,v 1.24 2001/08/07 19:34:01 ken Exp $
+ * $Id: ProfHeap.c,v 1.25 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -15,6 +15,7 @@
 
 #if defined(PROFILING) || defined(DEBUG_HEAP_PROF)
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsUtils.h"
 #include "RtsFlags.h"
index 23cd5a7..a9d259e 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Profiling.c,v 1.21 2001/07/23 23:37:35 andy Exp $
+ * $Id: Profiling.c,v 1.22 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -9,6 +9,7 @@
 
 #ifdef PROFILING
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsUtils.h"
 #include "RtsFlags.h"
index ae63670..42766d3 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Proftimer.c,v 1.6 2000/04/03 15:54:49 simonmar Exp $
+ * $Id: Proftimer.c,v 1.7 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -9,6 +9,7 @@
 
 #if defined (PROFILING)
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "Profiling.h"
 #include "Itimer.h"
index a8661b7..178d1f6 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: RtsAPI.c,v 1.27 2001/08/03 16:30:13 sof Exp $
+ * $Id: RtsAPI.c,v 1.28 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-2001
  *
@@ -7,6 +7,7 @@
  *
  * --------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "Storage.h"
 #include "RtsAPI.h"
index 45d9ba2..efed3d7 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: RtsAPIDeprec.c,v 1.1 2001/01/11 17:25:56 simonmar Exp $
+ * $Id: RtsAPIDeprec.c,v 1.2 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-2001
  *
@@ -7,6 +7,7 @@
  *
  * --------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsUtils.h"
 #include "Storage.h"
index 92c4474..bc5cb07 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsDllMain.c,v 1.2 2000/04/26 17:27:00 rrt Exp $
+ * $Id: RtsDllMain.c,v 1.3 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team 1999-2000
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsAPI.h"
 
index b491661..2f975af 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsFlags.c,v 1.48 2001/08/13 12:34:37 simonmar Exp $
+ * $Id: RtsFlags.c,v 1.49 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The AQUA Project, Glasgow University, 1994-1997
  * (c) The GHC Team, 1998-1999
@@ -21,6 +21,7 @@
 //@node Includes, Constants
 //@subsection Includes
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsFlags.h"
 #include "RtsUtils.h"
index 4f33e59..8732c9a 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsStartup.c,v 1.51 2001/05/25 18:33:46 sof Exp $
+ * $Id: RtsStartup.c,v 1.52 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsAPI.h"
 #include "RtsUtils.h"
index 7054f45..1820c79 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsUtils.c,v 1.19 2001/07/24 06:31:36 ken Exp $
+ * $Id: RtsUtils.c,v 1.20 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -8,7 +8,7 @@
  * ---------------------------------------------------------------------------*/
 
 /* gettimeofday isn't POSIX */
-#define NON_POSIX_SOURCE
+/* #include "PosixSource.h" */
 
 #include "Rts.h"
 #include "RtsTypes.h"
index 4150916..ab2254d 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Sanity.c,v 1.29 2001/07/24 05:04:59 ken Exp $
+ * $Id: Sanity.c,v 1.30 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-2001
  *
@@ -14,6 +14,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 
 #ifdef DEBUG                                                   /* whole file */
index fa26c03..c8a6a94 100644 (file)
@@ -1,5 +1,5 @@
 /* ---------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.99 2001/07/30 09:47:13 simonmar Exp $
+ * $Id: Schedule.c,v 1.100 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -74,6 +74,7 @@
 //@node Includes, Variables and Data structures, Main scheduling code, Main scheduling code
 //@subsection Includes
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "SchedAPI.h"
 #include "RtsUtils.h"
index 1682481..585fe7b 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Select.c,v 1.16 2001/02/28 14:23:55 sewardj Exp $
+ * $Id: Select.c,v 1.17 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team 1995-1999
  *
@@ -8,7 +8,7 @@
  * ---------------------------------------------------------------------------*/
 
 /* we're outside the realms of POSIX here... */
-#define NON_POSIX_SOURCE
+/* #include "PosixSource.h" */
 
 #include "Rts.h"
 #include "Schedule.h"
index 1adfb04..d476a01 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Signals.c,v 1.20 2001/07/26 03:24:01 ken Exp $
+ * $Id: Signals.c,v 1.21 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -7,8 +7,9 @@
  *
  * ---------------------------------------------------------------------------*/
 
-#define NON_POSIX_SOURCE
-
+/* This is non=Posix compliant.
+   #include "PosixSource.h" 
+*/
 #include "Rts.h"
 #include "SchedAPI.h"
 #include "Schedule.h"
index 9a37d69..46c3225 100644 (file)
@@ -1,5 +1,5 @@
 /* ---------------------------------------------------------------------------
- * $Id: Sparks.c,v 1.3 2001/03/22 03:51:10 hwloidl Exp $
+ * $Id: Sparks.c,v 1.4 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 2000
  *
@@ -20,6 +20,7 @@
 //@node Includes, GUM code, Spark Management Routines, Spark Management Routines
 //@subsection Includes
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "Schedule.h"
 #include "SchedAPI.h"
index 7082cb3..52876bd 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Stable.c,v 1.16 2001/08/08 16:03:47 simonmar Exp $
+ * $Id: Stable.c,v 1.17 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "Hash.h"
 #include "StablePriv.h"
index 70dd866..3c4d6e6 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Stats.c,v 1.31 2001/07/23 17:23:20 simonmar Exp $
+ * $Id: Stats.c,v 1.32 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -7,7 +7,9 @@
  *
  * ---------------------------------------------------------------------------*/
 
-#define NON_POSIX_SOURCE
+/* Alas, no.  This source is non-posix.
+   #include "PosixSource.h" 
+*/
 
 #include "Rts.h"
 #include "RtsFlags.h"
index fc4ca66..46c47fe 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StgCRun.c,v 1.25 2001/08/07 20:06:41 ken Exp $
+ * $Id: StgCRun.c,v 1.26 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -33,6 +33,8 @@
  *
  * -------------------------------------------------------------------------- */
 
+#include "PosixSource.h"
+
 
 /*
  * We define the following (unused) global register variables, because for
@@ -78,19 +80,6 @@ register double fake_f9 __asm__("$f9");
    any architecture (using miniinterpreter)
    -------------------------------------------------------------------------- */
        
-/* The static @jmp_environment@ variable allows @miniInterpret@ to
- * communicate with @StgReturn@.
- * 
- * Because @StgRun@ may be used recursively, we carefully
- * save and restore the whole of @jmp_environment@.
- */
-#include <setjmp.h>
-#include <string.h> /* for memcpy */
-
-static jmp_buf jmp_environment;
-
-#if 1
-
 extern StgThreadReturnCode StgRun(StgFunPtr f, StgRegTable *basereg)
 {
    while (f) {
@@ -109,144 +98,6 @@ EXTFUN(StgReturn)
    return 0;
 }
 
-#else
-
-#define CHECK_STACK   0
-#define STACK_DETAILS 0
-
-static int enters = 0;
-
-static void scanStackSeg ( W_* ptr, int nwords )
-{
-   W_ w;
-#if CHECK_STACK
-   int nwords0 = nwords;
-#if STACK_DETAILS
-   while (nwords > 0) {
-      w = *ptr;
-      if (IS_ARG_TAG(w)) {
-         fprintf ( stderr, "%d",w ); nwords--; ptr++;
-        while (w) { fprintf(stderr, "_"); w--; nwords--; ptr++; }
-      }
-      else {
-         fprintf(stderr, "p"); 
-         nwords--; ptr++;
-      }
-   }
-   if (nwords < 0) fprintf(stderr, "erk: nwords < 0\n");
-#endif
-   checkStackChunk ( ptr, ptr-nwords0 );
-#endif
-}
-
-extern StgFunPtr stg_enterStackTop;
-extern StgThreadReturnCode StgRun(StgFunPtr f, StgRegTable *basereg)
-{
-    char* nm;
-    while (1) {
-
-#if CHECK_STACK
-   {
-   int i;
-   StgTSO*  tso = basereg->rCurrentTSO;
-   StgWord* sb  = tso->stack + tso->stack_size;
-   StgWord* sp;
-   StgWord* su;
-   int ws;
-
-   if (f == &stg_enterStackTop) {
-      sp = tso->sp;
-      su = tso->su;
-   } else {
-      sp  = basereg->rSp;
-      su  = basereg->rSu;
-   }
-
-#if STACK_DETAILS
-   fprintf(stderr, 
-           "== SB = %p   SP = %p(%p)   SU = %p   SpLim = %p(%p)\n", 
-           sb, sp, tso->sp,   su, basereg->rSpLim, tso->stack + RESERVED_STACK_WORDS);
-#endif
-
-   if (su >= sb) goto postloop;
-   if (!sp || !su) goto postloop;
-
-   printStack ( sp, sb, su);
-
-   while (1) {
-      ws = su - sp;
-      switch (get_itbl((StgClosure*)su)->type) {
-         case STOP_FRAME: 
-            scanStackSeg(sp,ws);
-#if STACK_DETAILS
-            fprintf(stderr, "S%d ",ws); 
-            fprintf(stderr, "\n");
-#endif
-            goto postloop;
-         case UPDATE_FRAME: 
-            scanStackSeg(sp,ws);
-#if STACK_DETAILS
-            fprintf(stderr,"U%d ",ws); 
-#endif
-            sp = su + sizeofW(StgUpdateFrame);
-            su = ((StgUpdateFrame*)su)->link;
-            break;
-         case SEQ_FRAME: 
-            scanStackSeg(sp,ws);
-#if STACK_DETAILS
-            fprintf(stderr,"Q%d ",ws); 
-#endif
-            sp = su + sizeofW(StgSeqFrame);
-            su = ((StgSeqFrame*)su)->link;
-            break;
-         case CATCH_FRAME: 
-            scanStackSeg(sp,ws);
-#if STACK_DETAILS
-            fprintf(stderr,"C%d ",ws); 
-#endif
-            sp = su + sizeofW(StgCatchFrame);
-            su = ((StgCatchFrame*)su)->link;
-            break;
-         default:
-            fprintf(stderr, "?\nweird record on stack\n");
-            assert(0);
-            goto postloop;
-      }
-   }
-   postloop:
-   }
-#endif
-#if STACK_DETAILS
-       fprintf(stderr,"\n");
-#endif
-#if 1
-       fprintf(stderr,"-- enter %p ", f);
-       nm = nameFromOPtr ( f );
-          if (nm) fprintf(stderr, "%s", nm); else
-          printPtr((P_)f);
-       fprintf ( stderr, "\n");
-#endif
-#if STACK_DETAILS
-       fprintf(stderr,"\n");
-#endif
-    zzz:
-       if (enters % 1000 == 0) fprintf(stderr, "%d enters\n",enters);
-       enters++;
-       f = (StgFunPtr) (f)();
-       if (!f) break;
-    }
-    fprintf (stderr, "miniInterpreter: bye!\n\n" );
-    return (StgThreadReturnCode)R1.i;
-}
-
-EXTFUN(StgReturn)
-{
-   return 0;
-}
-#endif
-
-
-
 #else /* !USE_MINIINTERPRETER */
 
 #ifdef LEADING_UNDERSCORE
index 7928fcb..1be9995 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StgPrimFloat.c,v 1.7 2001/07/23 23:29:47 ken Exp $
+ * $Id: StgPrimFloat.c,v 1.8 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 
 /*
index feff59c..a2c111b 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Storage.c,v 1.48 2001/08/09 12:46:06 sewardj Exp $
+ * $Id: Storage.c,v 1.49 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsUtils.h"
 #include "RtsFlags.h"
index 7b6e66b..f49610a 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StrHash.c,v 1.2 2000/08/07 23:37:23 qrczak Exp $
+ * $Id: StrHash.c,v 1.3 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1994-2000
  *
@@ -12,6 +12,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "StrHash.h"
 
index c8ccdbb..a24e7d0 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Ticky.c,v 1.12 1999/11/11 17:50:48 simonpj Exp $
+ * $Id: Ticky.c,v 1.13 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The AQUA project, Glasgow University, 1992-1997
  * (c) The GHC Team, 1998-1999
@@ -10,6 +10,7 @@
 #if defined(TICKY_TICKY)
 
 #define TICKY_C                        /* define those variables */
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsFlags.h"
 #include "Ticky.h"
index 928ed60..dbcc847 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: VisCallbacks.c,v 1.1 2000/11/01 11:41:47 simonmar Exp $
+ * $Id: VisCallbacks.c,v 1.2 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team 2000
  *
@@ -9,8 +9,6 @@
 
 #ifdef RTS_GTK_FRONTPANEL
 
-#define NON_POSIX_SOURCE
-
 #include "Rts.h"
 
 #include <gtk/gtk.h>
index 91a2fc0..1c03e69 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Weak.c,v 1.17 2000/12/04 12:31:22 simonmar Exp $
+ * $Id: Weak.c,v 1.18 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsAPI.h"
 #include "SchedAPI.h"
index 889892a..9435536 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * Time-stamp: <Wed Mar 21 2001 16:34:41 Stardate: [-30]6363.45 hwloidl>
- * $Id: HLComms.c,v 1.5 2001/05/28 07:13:54 sof Exp $
+ * $Id: HLComms.c,v 1.6 2001/08/14 13:40:10 sewardj Exp $
  *
  * High Level Communications Routines (HLComms.lc)
  *
@@ -31,9 +31,8 @@
 //@node Macros etc, Includes, High Level Communications Routines, High Level Communications Routines
 //@subsection Macros etc
 
-# ifndef _AIX
-# define NON_POSIX_SOURCE /* so says Solaris */
-# endif
+/* Evidently not Posix */
+/* #include "PosixSource.h" */
 
 //@node Includes, GUM Message Sending and Unpacking Functions, Macros etc, High Level Communications Routines
 //@subsection Includes
index 84f5ff9..db56bc6 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * Time-stamp: <Mon Mar 19 2001 22:10:38 Stardate: [-30]6354.62 hwloidl>
- * $Id: LLComms.c,v 1.4 2001/03/22 03:51:11 hwloidl Exp $
+ * $Id: LLComms.c,v 1.5 2001/08/14 13:40:10 sewardj Exp $
  *
  * GUM Low-Level Inter-Task Communication
  *
@@ -43,7 +43,9 @@
 //@node Macros etc, Includes, GUM Low-Level Inter-Task Communication, GUM Low-Level Inter-Task Communication
 //@subsection Macros etc
 
-#define NON_POSIX_SOURCE /* so says Solaris */
+/* Evidently not Posix */
+/* #include "PosixSource.h" */
+
 #define UNUSED           /* nothing */
 
 //@node Includes, Auxiliary functions, Macros etc, GUM Low-Level Inter-Task Communication
index 917b658..f77564c 100644 (file)
@@ -1,6 +1,6 @@
 /* --------------------------------------------------------------------------
    Time-stamp: <Wed Mar 21 2001 16:37:16 Stardate: [-30]6363.46 hwloidl>
-   $Id: ParInit.c,v 1.4 2001/03/22 03:51:11 hwloidl Exp $
+   $Id: ParInit.c,v 1.5 2001/08/14 13:40:10 sewardj Exp $
 
    Initialising the parallel RTS
 
@@ -14,8 +14,6 @@
 
 #ifdef PAR /* whole file */
 
-#define NON_POSIX_SOURCE /* so says Solaris */
-
 //@menu
 //* Includes::                 
 //* Global variables::         
@@ -25,6 +23,9 @@
 //@node Includes, Global variables
 //@subsection Includes
 
+/* Evidently not Posix */
+/* #include "PosixSource.h" */
+
 #include <setjmp.h>
 #include "Rts.h"
 #include "RtsFlags.h"
index 9f82bc4..ea27228 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    Time-stamp: <Wed Mar 21 2001 17:16:28 Stardate: [-30]6363.59 hwloidl>
-   $Id: SysMan.c,v 1.4 2001/03/22 03:51:12 hwloidl Exp $
+   $Id: SysMan.c,v 1.5 2001/08/14 13:40:10 sewardj Exp $
 
    GUM System Manager Program
    Handles startup, shutdown and global synchronisation of the parallel system.
@@ -99,6 +99,9 @@ o Begins execution.
 //@node Includes, Macros etc, General docu, GUM System Manager Program
 //@subsection Includes
 
+/* Evidently not Posix */
+/* #include "PosixSource.h" */
+
 #include "Rts.h"
 #include "ParTypes.h"
 #include "LLC.h"
@@ -108,8 +111,6 @@ o Begins execution.
 //@node Macros etc, Variables, Includes, GUM System Manager Program
 //@subsection Macros etc
 
-#define NON_POSIX_SOURCE /* so says Solaris */
-
 /* SysMan is put on top of the GHC routine that does the RtsFlags handling.
    So, we cannot use the standard macros. For the time being we use a macro
    that is fixed at compile time.
@@ -294,7 +295,7 @@ main (int argc, char **argv) {
 
   IF_PAR_DEBUG(verbose,
               fprintf(stderr,
-                      "==== RFP: GdH enabled SysMan reporting for duty ($Revision: 1.4 $)\n"));
+                      "==== RFP: GdH enabled SysMan reporting for duty ($Revision: 1.5 $)\n"));
   
   if (argc > 1) {
     if (*argv[1] == '-') {
index 7b7b7d0..487b8b4 100644 (file)
@@ -1,8 +1,3 @@
-{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
-
--- The above option is required because 'erf' isn't a POSIX function, and we
--- need a prototype for it in order to compile the following code correctly.
--- Defining NON_POSIX_SOURCE tells the RTS not to define _POSIX_SOURCE.
 
 module Main (main) where
 
index f6567d8..0b2308f 100644 (file)
 /* Define if you have the <io.h> header file.  */
 #undef HAVE_IO_H
 
+/* Define if you have the <limits.h> header file.  */
+#undef HAVE_LIMITS_H
+
 /* Define if you have the <malloc.h> header file.  */
 #undef HAVE_MALLOC_H