Remove some ifdeffery
authorIan Lynagh <igloo@earth.li>
Sat, 14 Jun 2008 20:26:40 +0000 (20:26 +0000)
committerIan Lynagh <igloo@earth.li>
Sat, 14 Jun 2008 20:26:40 +0000 (20:26 +0000)
compiler/ghci/Linker.lhs
compiler/utils/Util.lhs

index ad90900..804d6c0 100644 (file)
@@ -397,13 +397,12 @@ reallyInitDynLinker dflags
        ; classified_ld_inputs <- mapM classifyLdInput cmdline_ld_inputs
 
                -- (e) Link any MacOS frameworks
-#ifdef darwin_TARGET_OS        
-       ; let framework_paths = frameworkPaths dflags
-       ; let frameworks      = cmdlineFrameworks dflags
-#else
-       ; let frameworks      = []
-       ; let framework_paths = []
-#endif
+       ; let framework_paths
+               | isDarwinTarget = frameworkPaths dflags
+               | otherwise      = []
+       ; let frameworks
+               | isDarwinTarget = cmdlineFrameworks dflags
+               | otherwise      = []
                -- Finally do (c),(d),(e)       
         ; let cmdline_lib_specs = [ l | Just l <- classified_ld_inputs ]
                               ++ map DLL       minus_ls 
@@ -950,11 +949,8 @@ data LibrarySpec
 -- used by lookupSymbol.  So we must call addDLL for each library 
 -- just to get the DLL handle into the list.
 partOfGHCi
-#          if defined(mingw32_TARGET_OS) || defined(darwin_TARGET_OS)
-           = [ ]
-#          else
-           = [ "base", "haskell98", "template-haskell", "editline" ]
-#          endif
+ | isWindowsTarget || isDarwinTarget = []
+ | otherwise = [ "base", "haskell98", "template-haskell", "editline" ]
 
 showLS (Object nm)    = "(static) " ++ nm
 showLS (DLL nm)       = "(dynamic) " ++ nm
index 217a450..9bae07f 100644 (file)
@@ -6,7 +6,7 @@
 
 \begin{code}
 module Util (
-        debugIsOn, isWindowsHost,
+        debugIsOn, isWindowsHost, isWindowsTarget, isDarwinTarget,
 
         -- general list processing
         zipEqual, zipWithEqual, zipWith3Equal, zipWith4Equal,
@@ -124,6 +124,20 @@ isWindowsHost = True
 #else
 isWindowsHost = False
 #endif
+
+isWindowsTarget :: Bool
+#ifdef mingw32_TARGET_OS
+isWindowsTarget = True
+#else
+isWindowsTarget = False
+#endif
+
+isDarwinTarget :: Bool
+#ifdef darwin_TARGET_OS
+isDarwinTarget = True
+#else
+isDarwinTarget = False
+#endif
 \end{code}
 
 %************************************************************************