Skip to content

Commit

Permalink
Remove warning on option -threaded when building libraries (#8432)
Browse files Browse the repository at this point in the history
* Remove warning on option -threaded when building libraries

Fixes #8431. Accompanied by option -flink-rts, option -threaded defines
the flavour of the ghc RTS library the built library will be linked
against. Note that bare ghc does not warn when option -threaded is used
for building a library either.

* Cabal no longer warns on -threaded option when building libraries

Note that this commit modifies regression check for issue #774.

* A small changelog was added
  • Loading branch information
lyokha authored Aug 31, 2022
1 parent 9de8967 commit 1003ed6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
1 change: 0 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/issue-774.check
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ issue-774.cabal:13:22: Packages with 'cabal-version: 1.12' or later should speci
No 'category' field.
No 'maintainer' field.
The 'license' field is missing or is NONE.
'ghc-options: -threaded' has no effect for libraries. It should only be used for executables.
'ghc-options: -rtsopts' has no effect for libraries. It should only be used for executables.
'ghc-options: -with-rtsopts' has no effect for libraries. It should only be used for executables.
7 changes: 0 additions & 7 deletions Cabal/src/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ data CheckExplanation =
| OptSplitObjs String
| OptWls String
| OptExts String
| OptThreaded String
| OptRts String
| OptWithRts String
| COptONumber String String
Expand Down Expand Up @@ -494,9 +493,6 @@ ppExplanation (OptWls fieldName) =
ppExplanation (OptExts fieldName) =
"Instead of '" ++ fieldName ++ ": -fglasgow-exts' it is preferable to use "
++ "the 'extensions' field."
ppExplanation (OptThreaded fieldName) =
"'" ++ fieldName ++ ": -threaded' has no effect for libraries. It should "
++ "only be used for executables."
ppExplanation (OptRts fieldName) =
"'" ++ fieldName ++ ": -rtsopts' has no effect for libraries. It should "
++ "only be used for executables."
Expand Down Expand Up @@ -1376,9 +1372,6 @@ checkGhcOptions fieldName getOptions pkg =
, checkFlags ["-fglasgow-exts"] $
PackageDistSuspicious (OptExts fieldName)

, check ("-threaded" `elem` lib_ghc_options) $
PackageBuildWarning (OptThreaded fieldName)

, check ("-rtsopts" `elem` lib_ghc_options) $
PackageBuildWarning (OptRts fieldName)

Expand Down
15 changes: 15 additions & 0 deletions changelog.d/pr-8432
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
synopsis: Remove warning on option -threaded when building libraries
packages: Cabal
prs: #8432
issues: #8431 #774

description: {

- Accompanied by option `-flink-rts`, option `-threaded` defines the flavour of
the ghc RTS library the built library will be linked against. Note that bare
ghc does not warn when option `-threaded` is used for building a library
either.
- Note that the changes require modification of the regression check for issue
#774 which can be regarded as a proper test for this PR.

}

0 comments on commit 1003ed6

Please sign in to comment.