`ghc-options` is typically used only for fine control (e.g. `-f` options) or debugging (`-d` options). I think it warns if you stick a `-X` in there, but should accept it.
Optimization is controlled by `optimization` in the cabal file or `cabal.project`. Some other known options are handled the same way, including extensions from `language` and `default-extensions`. On Sun, Mar 15, 2026 at 4:28 PM Simon Peyton Jones < [email protected]> wrote: > It does mean every module in `base` and every module in `ghc-internal`. > We already seem to have `NoImplicitPrelude` in each of them despite a > `NoImplicitPrelude` in base.cabal. > > There must be a better way than editing several hundred modules to add a > one-line pragma. All I want to do is to get cabal to pass the flag to > every module. > > I thought there was a ghc-options directive in cabal? Maybe I can say > ghc-options: -XNoImplicitKnownKeyNames > and cabal will just pass it along? > > But I don't see *any* ghc-options in base.cabal. How does cabal decide > what options to pass to GHC when compiling base (e.g -O2)? > > Simon > > > On Sun, 15 Mar 2026 at 20:15, Brandon Allbery <[email protected]> wrote: > >> If you're adding it to a cabal file then you need to modify Cabal, >> because it wants to mark packages as unbuildable on ghcs that don't support >> declared extensions. Placing it in source files avoids this, but you would >> have to modify all files that need to know about it (hopefully that doesn't >> mean all of `base`). >> >> On Sun, Mar 15, 2026 at 4:08 PM Simon Peyton Jones < >> [email protected]> wrote: >> >>> Thanks. But where is this Cabal-syntax directory? How do I "bump the >>> cabal version"? >>> >>> I'm only trying to build GHC! I wasn't intending to modify cabal. >>> >>> Simon >>> >>> On Sun, 15 Mar 2026 at 17:26, Brandon Allbery <[email protected]> >>> wrote: >>> >>>> It goes in `Cabal-syntax/src/Language/Haskell/Extensions.hs`, in `data >>>> KnownExtension`. The parse table is built from the constructor names, and >>>> `No` prefixes are handled automatically. Note that you'll need to also bump >>>> the `cabal-version` (file format version) and add an entry to the file >>>> format documentation (`doc/file-format-changelog.rst`). >>>> >>>> On Sun, Mar 15, 2026 at 1:18 PM Simon Peyton Jones via ghc-devs < >>>> [email protected]> wrote: >>>> >>>>> Friends >>>>> >>>>> As part of the reinstallable base project I'm adding an >>>>> extension "ImplicitKnownKeyNames" to GHC. But if I put >>>>> "NoImplicitKnownKeyNames" in base.cabal.in I get the error >>>>> >>>>> Warning: [unknown-extension] Unknown extensions: >>>>> NoImplicitKnownKeyNames >>>>> >>>>> when building the base library. I think this comes from cabal. >>>>> >>>>> How can I tell cabal about the new extension? >>>>> >>>>> Thanks >>>>> >>>>> Simon >>>>> _______________________________________________ >>>>> ghc-devs mailing list -- [email protected] >>>>> To unsubscribe send an email to [email protected] >>>>> >>>> >>>> >>>> -- >>>> brandon s allbery kf8nh >>>> [email protected] >>>> >>> >> >> -- >> brandon s allbery kf8nh >> [email protected] >> > -- brandon s allbery kf8nh [email protected]
_______________________________________________ ghc-devs mailing list -- [email protected] To unsubscribe send an email to [email protected]
