Skip to content
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

Only use cpphs for .cpphs files #8383

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions Cabal/src/Distribution/Simple/PreProcess.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module Distribution.Simple.PreProcess (preprocessComponent, preprocessExtras,
knownSuffixHandlers, ppSuffixes,
PPSuffixHandler, PreProcessor(..),
mkSimplePreProcessor, runSimplePreProcessor,
ppCpp, ppCpp', ppGreenCard, ppC2hs, ppHsc2hs,
ppCpp, ppCpp', ppGhcCpp, ppGreenCard, ppC2hs, ppHsc2hs,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this export for? Is the function now unused and could be deleted instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured users might want it - seemed safest to allow it in custom Setup.hs if they really want.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I'd tend to not extend the API unless there's a clear need (and we add some test coverage). But it's not for me to decide.

ppHappy, ppAlex, ppUnlit, platformDefines,
unsorted
)
Expand Down Expand Up @@ -385,11 +385,8 @@ ppCpp :: BuildInfo -> LocalBuildInfo -> ComponentLocalBuildInfo -> PreProcessor
ppCpp = ppCpp' []

ppCpp' :: [String] -> BuildInfo -> LocalBuildInfo -> ComponentLocalBuildInfo -> PreProcessor
ppCpp' extraArgs bi lbi clbi =
case compilerFlavor (compiler lbi) of
GHC -> ppGhcCpp ghcProgram (const True) args bi lbi clbi
GHCJS -> ppGhcCpp ghcjsProgram (const True) args bi lbi clbi
_ -> ppCpphs args bi lbi clbi
ppCpp' extraArgs bi lbi =
ppCpphs args bi lbi
where cppArgs = getCppOptions bi lbi
args = cppArgs ++ extraArgs

Expand Down
11 changes: 11 additions & 0 deletions changelog.d/pr-8383
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
synopsis: Use cpphs for .cpphs files
packages: Cabal
prs: #8383
issues: #4278

description: {

- .cpphs files are now processed with cpphs only
- .cpphs files may require build-tool-depends cpphs:cpphs now

}