[commit: ghc] master: Fix #8754 in a round-about way. (5023c91)
Simon Peyton Jones
simonpj at microsoft.com
Mon Feb 17 09:03:13 UTC 2014
Austin, eek... you really need a Note [Need to initialise the hooks], a significant comment, and an explicit mention of this ticket. Otherwise someone in 2 yrs time will have no clue why that lonely call to defaultsHook is so important, nor will be confident enough to remove it when the hookery is done better.
I have gotten into habit of writing a Note about virtually any fix. After all, it is by definition not obvious or we'd have got it right the first time. And I have too often re-invented the wheel when looking at Note-free code; or thanked the author when I read a Note and thought "ah, *that's* why!". I wrote up some of this here https://ghc.haskell.org/trac/ghc/wiki/Commentary/CodingStyle
I don't think the commit log is enough. git annotate may or may not lead you to the right comment, depending on how heavily modified that code is.
Thanks
Simon
| -----Original Message-----
| From: ghc-commits [mailto:ghc-commits-bounces at haskell.org] On Behalf Of
| git at git.haskell.org
| Sent: 17 February 2014 07:49
| To: ghc-commits at haskell.org
| Subject: [commit: ghc] master: Fix #8754 in a round-about way. (5023c91)
|
| Repository : ssh://git@git.haskell.org/ghc
|
| On branch : master
| Link :
| http://ghc.haskell.org/trac/ghc/changeset/5023c91780e90947680fe0640f7564
| a4f6448bea/ghc
|
| >---------------------------------------------------------------
|
| commit 5023c91780e90947680fe0640f7564a4f6448bea
| Author: Austin Seipp <austin at well-typed.com>
| Date: Sun Feb 16 19:10:16 2014 -0600
|
| Fix #8754 in a round-about way.
|
| For some reason on OS X, it seems like -Bsymbolic (which we use for
| hooks into the RTS) isn't working, which results in #8754, where
| stats
| don't work because defaultHooks doesn't initialize the stats flag.
| This
| seems to work on Linux static/dynamically, but only on OS X
| statically.
|
| After talking with Simon, really, the entire hooks thing is a bit
| fragile. For now, we just work around it (since GHCi is dynamically
| linked) by calling into the defaultHooks ourselves when GHC starts.
|
| Signed-off-by: Austin Seipp <austin at well-typed.com>
|
|
| >---------------------------------------------------------------
|
| 5023c91780e90947680fe0640f7564a4f6448bea
| ghc/Main.hs | 4 ++++
| 1 file changed, 4 insertions(+)
|
| diff --git a/ghc/Main.hs b/ghc/Main.hs
| index 868042b..1aa6553 100644
| --- a/ghc/Main.hs
| +++ b/ghc/Main.hs
| @@ -1,4 +1,5 @@
| {-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
| +{-# LANGUAGE ForeignFunctionInterface #-}
|
| -----------------------------------------------------------------------
| ------
| --
| @@ -76,6 +77,7 @@ import Data.Maybe
|
| main :: IO ()
| main = do
| + defaultsHook
| hSetBuffering stdout LineBuffering
| hSetBuffering stderr LineBuffering
| GHC.defaultErrorHandler defaultFatalMessager defaultFlushOut $ do @@
| -818,3 +820,5 @@ unknownFlagsErr fs = throwGhcException $ UsageError $
| concatMap oneError fs
| (case fuzzyMatch f (nub allFlags) of
| [] -> ""
| suggs -> "did you mean one of:\n" ++ unlines (map (" " ++)
| suggs))
| +
| +foreign import ccall safe "defaultsHook" defaultsHook :: IO ()
|
| _______________________________________________
| ghc-commits mailing list
| ghc-commits at haskell.org
| http://www.haskell.org/mailman/listinfo/ghc-commits
More information about the ghc-devs
mailing list