Skip to content

Commit

Permalink
Add test for haskell#7423
Browse files Browse the repository at this point in the history
i.e. Do not warn on -O2 if under off-by-default package configuration
flag conditional.
  • Loading branch information
ffaf1 committed Sep 23, 2022
1 parent 617f6ca commit 72e2f6e
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# cabal check
No errors or warnings could be found in the package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Test.Cabal.Prelude

-- Do not output warning when an -O2 is behind a cabal flag.
main = cabalTest $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cabal-version: 2.2
name: pkg
version: 0
category: example
maintainer: [email protected]
synopsis: synopsys
description: description
license: GPL-3.0-or-later

flag force-O2
default: False
manual: True

library
exposed-modules: Foo
default-language: Haskell2010
if flag(force-O2)
ghc-options: -O2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: These warnings may cause trouble when distributing the package:
Warning: 'ghc-options: -O2' is rarely needed. Check that it is giving a real benefit and not just imposing longer compile times on your users.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Test.Cabal.Prelude

-- Output warning when an -O2 outside a cabal flag, along with one inside.
main = cabalTest $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cabal-version: 2.2
name: pkg
version: 0
category: example
maintainer: [email protected]
synopsis: synopsys
description: description
license: GPL-3.0-or-later

flag force-O2
default: False
manual: True

library
exposed-modules: Foo
default-language: Haskell2010
ghc-options: -O2
if flag(force-O2)
ghc-options: -O2

0 comments on commit 72e2f6e

Please sign in to comment.