-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Track the exact source of ghc-*-options related warnings
Previously, when running `cabal check` all the various ghc-*-options flags were merged together, thus losing the information about the exact place of the warning. This PR implements separate checking of ghc-*-options, which allows us to give users more precise warnings. Fixes #5342
- Loading branch information
Nikolai Obedin
committed
Oct 1, 2018
1 parent
6ef2523
commit c59b110
Showing
5 changed files
with
98 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
|
||
2.6.0.0 (current development version) | ||
* New solver flag: '--reject-unconstrained-dependencies'. (#2568) | ||
* 'check' reports warnings for various ghc-\*-options fields separately | ||
(#5342) | ||
|
||
2.4.0.0 Mikhail Glushenkov <[email protected]> September 2018 | ||
* Bugfix: "cabal new-build --ghc-option '--bogus' --ghc-option '-O1'" | ||
|
8 changes: 8 additions & 0 deletions
8
cabal-testsuite/PackageTests/Check/DifferentGhcOptions/cabal.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# cabal check | ||
Warning: The following warnings are likely to affect your build negatively: | ||
Warning: 'ghc-shared-options: -hide-package' is never needed. Cabal hides all packages. | ||
Warning: The following errors will cause portability problems on other environments: | ||
Warning: 'ghc-options: -fasm' is unnecessary and will not work on CPU architectures other than x86, x86-64, ppc or sparc. | ||
Warning: 'ghc-prof-options: -fhpc' is not not necessary. Use the configure flag --enable-coverage instead. | ||
Warning: 'ghc-shared-options: -Wall -Werror' makes the package very easy to break with future GHC versions because new GHC versions often add new warnings. Use just 'ghc-shared-options: -Wall' instead. Alternatively, if you want to use this, make it conditional based on a Cabal configuration flag (with 'manual: True' and 'default: False') and enable that flag during development. | ||
Warning: Hackage would reject this package. |
2 changes: 2 additions & 0 deletions
2
cabal-testsuite/PackageTests/Check/DifferentGhcOptions/cabal.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import Test.Cabal.Prelude | ||
main = cabalTest $ fails $ cabal "check" [] |
15 changes: 15 additions & 0 deletions
15
cabal-testsuite/PackageTests/Check/DifferentGhcOptions/pkg.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
cabal-version: 2.2 | ||
name: pkg | ||
version: 0 | ||
category: example | ||
maintainer: [email protected] | ||
synopsis: synopsis | ||
description: description | ||
license: BSD-3-Clause | ||
|
||
library | ||
exposed-modules: Foo | ||
default-language: Haskell2010 | ||
ghc-options: -fasm | ||
ghc-prof-options: -fhpc | ||
ghc-shared-options: -hide-package -Wall -Werror |