diff options
author | Ben Gamari <ben@smart-cactus.org> | 2017-03-10 10:21:55 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-03-10 10:21:55 -0500 |
commit | db13d5f56d8e693b44bafc793d7b3bfac1c25b91 (patch) | |
tree | 128f2c23169c06c7a645979e37a1ba2cfda82c4b /haddock-api/src/Haddock.hs | |
parent | 240bc38b94ed2d0af27333b23392d03eeb615e82 (diff) | |
parent | d2be5e88281d8e3148bc55830c27c75844b86f38 (diff) |
Merge branch 'ghc-head'
Diffstat (limited to 'haddock-api/src/Haddock.hs')
-rw-r--r-- | haddock-api/src/Haddock.hs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs index 28974d19..bbaea359 100644 --- a/haddock-api/src/Haddock.hs +++ b/haddock-api/src/Haddock.hs @@ -68,7 +68,6 @@ import System.Directory (doesDirectoryExist) import GHC hiding (verbosity) import Config import DynFlags hiding (projectVersion, verbosity) -import StaticFlags (discardStaticFlags) import Packages import Panic (handleGhcException) import Module @@ -410,18 +409,9 @@ withGhc' libDir flags ghcActs = runGhc (Just libDir) $ do parseGhcFlags dynflags = do -- TODO: handle warnings? - -- NOTA BENE: We _MUST_ discard any static flags here, because we cannot - -- rely on Haddock to parse them, as it only parses the DynFlags. Yet if - -- we pass any, Haddock will fail. Since StaticFlags are global to the - -- GHC invocation, there's also no way to reparse/save them to set them - -- again properly. - -- - -- This is a bit of a hack until we get rid of the rest of the remaining - -- StaticFlags. See GHC issue #8276. - let flags' = discardStaticFlags flags - (dynflags', rest, _) <- parseDynamicFlags dynflags (map noLoc flags') + (dynflags', rest, _) <- parseDynamicFlags dynflags (map noLoc flags) if not (null rest) - then throwE ("Couldn't parse GHC options: " ++ unwords flags') + then throwE ("Couldn't parse GHC options: " ++ unwords flags) else return dynflags' ------------------------------------------------------------------------------- @@ -576,7 +566,15 @@ getExecDir = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. _ | ret < size -> fmap (Just . dropFileName) $ peekCWString buf | otherwise -> try_size (size * 2) -foreign import stdcall unsafe "windows.h GetModuleFileNameW" +# if defined(i386_HOST_ARCH) +# define WINDOWS_CCONV stdcall +# elif defined(x86_64_HOST_ARCH) +# define WINDOWS_CCONV ccall +# else +# error Unknown mingw32 arch +# endif + +foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW" c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32 #else getExecDir = return Nothing |