haskell / haskeline

A Haskell library for line input in command-line programs.
https://hackage.haskell.org/package/haskeline
BSD 3-Clause "New" or "Revised" License
221 stars 75 forks source link

Suppress hsc2hs-related warning on GHC HEAD #35

Closed RyanGlScott closed 8 years ago

RyanGlScott commented 8 years ago

In GHC 8.0, hsc2hs will introduce an alignment macro that is equivalent to the one manually defined in System.Console.Haskeline.Backend.Win32, which causes a redefinition warning:

Win32.hsc:170:0: error: "hsc_alignment" redefined [-Werror]

In file included from libraries/haskeline/dist-install/build/System/Console/Haskeline/Backend/Win32_hsc_make.c:1:0:

C:\code\HEAD\inplace/lib/template-hsc.h:88:0: note: this is the location of the previous definition

#define hsc_alignment(t...) \

^

This adds the simple fix of surrounding the #let alignment ... directive with #if __GLASGOW_HASKELL__ < 711 to suppress the warning. (For some reason, git diff thinks I changed the entire file, but I think it's just my text editor changing Windows-style line-endings to Unix-style ones.)

RyanGlScott commented 8 years ago

OK, I've reworked it to incorporate two different commits.

BTW, the build is failing on Travis CI with GHC 7.2.1 due to an unrelated transformers issue. I'm currently looking into it.

RyanGlScott commented 8 years ago

OK, it turns out not to be transformers' fault. The culprit is a really awful GHC 7.2.1–specific bug involving SafeHaskell. The workaround is just to invoke

ghc-pkg trust base

before building transformers. I've adjusted .travis.yml accordingly.

judah commented 8 years ago

Thanks for the fix!