-
Notifications
You must be signed in to change notification settings - Fork 710
Cabal doesn't pass *-options to GHC when compiling ordinary Haskell sources #10969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
1bd501e
to
c3e68be
Compare
I probably need to think about tests, maybe something started working besides |
Ok, got it, we just need to separate the flags |
4d8e74a
to
a439429
Compare
Add test for capi Add #if for GHC >=810
a439429
to
1b8e5bb
Compare
@ulysses4ever @phadej It's not very easy to add flags to sources files due to backward compatibility, so for now I suggest considering the pull request as is ¯\_(ツ)_/¯ (Anyway, this solved the problem with macros in header files) |
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.
Great start, thank you! Below are some inline questions.
One general question: did you check that this doesn't lead to duplicated options when cabal calls GHC? I assume other *-options are passed today sometimes. So, sometimes we'll get those options passed as today and through your change too. Is that right? It seems undesirable.
It's not very easy to add flags to sources files due to backward compatibility
Can you be more specific? Do you mean it's hard to test on older GHCs? This shouldn't be a problem because the tests can run for specific versions of GHC (e.g. starting from 8.10).
--- | ||
synopsis: Pass *-options to GHC when compiling ordinary Haskell sources | ||
packages: [Cabal] | ||
prs: 10969 |
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.
Please, also add the issues
field
prs: 10969 | ||
--- | ||
|
||
*-options should be always passed when invoking GHC, |
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.
Can you specify exactly which *-options are meant currently? (ASM, LD, etc...) And explain what's the difference with how there handled now: I assume they're passed only under specific circumstances now. Which ones?
@@ -0,0 +1,3 @@ | |||
# ForeignOptsCapi | |||
|
|||
This test case asserts that cabal passes `cc-options` to the C compiler when use `foreign import capi`. |
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.
But the patch does something to other *-options too. Is it possible to test this change w.r.t. other *-options?
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.
Same concerns as @ulysses4ever raised.
++ ["-optJSP" ++ opt | opt <- jsppOptions bi] | ||
++ ["-optl" ++ opt | opt <- ldOptions bi] | ||
++ ["-optc" ++ opt | opt <- ccOptions bi] | ||
#if __GLASGOW_HASKELL__ >= 810 |
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 is wrong. You should check for the configured compiler, not the one used to compile Cabal
.
Yes, it looks like so. I'd say the problem is rather that IMHO, it's wrong that there are separate EDIT: There might be situations where EDIT: So AFAICT, this is not the correct fix, not what I'd imagine seeing. |
Will close issues #9801 #4435
Main idea #9801 (comment)
Template Α: This PR modifies behaviour or interface
Include the following checklist in your PR:
significance: significant
in the changelog file.