Refactor collection of C preprocessor options
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
There current `getCppOptions` in [`Cabal/Distribution/Simple/PreProcess.hs`][0] gathers all applicable CPP options for all applicable CPP use cases. However, there is the possibility that some CPP options should be applied only in some CPP use cases and not in others.
One such example is the case where some `cc-options` should be passed to the CPP for some C sources, but those options should _not_ be passed to the CPP for Haskell sources, C++ sources, `cpphs`, etc.
_There is the potential for this to cause compilation issues!_
We should [create separate functions][1] for collecting CPP options for each CPP use case:
* `getCppOptionsForHs`
* `getCppOptionsForCxx`
* `getCppOptionsForC`
Additionally, we should look at all the current call sites of `getCppOptions` and decide which (possibly multiple) of the three new functions should be used to generate the appropriate CPP options.
[0]: https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/PreProcess.hs
[1]: https://github.com/haskell/cabal/pull/5315/commits/3f8c55ce7457408f31dbc5dc6d6be6fd7a84c501#diff-12e29e3caf265fe2eb327ba2ccc9d885L539
Contributor guide
Assessment
This issue has not been assessed yet.