-
Notifications
You must be signed in to change notification settings - Fork 97
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ready for review.
src/Development/IDE/GHC/CPP.hs
Outdated
#if MIN_GHC_API_VERSION(8,8,2) | ||
Just v | ||
| m:n:_ <- llvmVersionList v -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (m, n) ] | ||
| n:_ <- llvmVersionList v -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (n, 0) ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t have any projects which use LLVM, so I’d appreciate it if someone could double-check that this is doing what they expect.
Note that despite llvmVersionList
returning [Int]
, these branches are in fact exhaustive (under ghc
8.8.2), because LlvmVersion
contains a NonEmpty
list and converts it to a list otherwise unmodified. So we will always have at least a major version, and thus this will not silently fail (modulo future changes to ghc
’s API).
Just v | ||
| m:n:_ <- llvmVersionList v -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (m, n) ] | ||
| n:_ <- llvmVersionList v -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (n, 0) ] | ||
#elif MIN_GHC_API_VERSION(8,8,0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches the way this is written in GHC and is a bit easier to read imho: https://gitlab.haskell.org/ghc/ghc/blob/ghc-8.8/compiler/main/DriverPipeline.hs#L2174
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, good call 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shame they didn’t export that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole doCpp is exported from GHC 8.10 and above, so the whole thing can disappear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ndmitchell Do you mean that we should do that in this PR? Cos I’m not really set up to test against 8.10.* just now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No - we should leave it as it is for now. Once 8.10 is actually out we should do some conditional stuff - more just pointing out there is a long term plan for getting rid of it all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we need to support older versions so this can’t go away completely in particular not the code for 8.8.2
. We can however, use the definition from GHC in 8.10
but let’s please keep 8.10
support for a separate PR. I expect that there are a bunch of other issues anyway.
Co-Authored-By: Moritz Kiefer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks a lot! We should switch our CI to 8.8.2
once stackage nightly switches over.
* Fix the build for ghc-8.8.2. * Match the single-element list first. Co-Authored-By: Moritz Kiefer <[email protected]> Co-authored-by: Moritz Kiefer <[email protected]>
* Fix the build for ghc-8.8.2. * Match the single-element list first. Co-Authored-By: Moritz Kiefer <[email protected]> Co-authored-by: Moritz Kiefer <[email protected]>
* Fix the build for ghc-8.8.2. * Match the single-element list first. Co-Authored-By: Moritz Kiefer <[email protected]> Co-authored-by: Moritz Kiefer <[email protected]>
* Fix the build for ghc-8.8.2. * Match the single-element list first. Co-Authored-By: Moritz Kiefer <[email protected]> Co-authored-by: Moritz Kiefer <[email protected]>
This PR fixes the build for ghc 8.8.2 by using the new
LlvmVersion
API (which no longer exports constructors).Fixes #334.