Skip to content

Commit

Permalink
Add test for #7423
Browse files Browse the repository at this point in the history
i.e. Do not warn on -O2 if flag conditional
  • Loading branch information
ffaf1 committed Sep 1, 2022
1 parent e92d6d8 commit ec4740e
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: none@example.com
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

-- 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,19 @@
cabal-version: 2.2
name: pkg
version: 0
category: example
maintainer: none@example.com
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 ec4740e

Please sign in to comment.