| Copyright | (C) 2026 QBayLogic B.V. |
|---|---|
| License | BSD2 (see the file LICENSE) |
| Maintainer | QBayLogic B.V. <devops@qbaylogic.com> |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Clash.Warning
Description
Named warnings and the options controlling them.
Every warning Clash can emit has a name and can be controlled individually with GHC-style flags:
-W<name>- enable the warning
-Wno-<name>- disable the warning
-Werror=<name>- enable the warning and promote it to an error
-Wwarn=<name>,-Wno-error=<name>- demote the warning back to a
warning, also exempting it from a global
-Werror
Note that Clash parses its flags in a separate pass from GHC's, so ordering
between GHC's global -Werror and -Wwarn=<name> is not positional: an
explicit -Wwarn=<name> always wins over a global -Werror. Ordering
among the Clash warning flags themselves is positional (last one wins).
Synopsis
- data ClashWarning
- warningName :: ClashWarning -> String
- parseWarningName :: String -> Maybe ClashWarning
- data WarningOpts = WarningOpts {}
- defWarningOpts :: WarningOpts
- wopt :: ClashWarning -> WarningOpts -> Bool
- woptFatal :: Bool -> ClashWarning -> WarningOpts -> Bool
- enableWarning :: ClashWarning -> WarningOpts -> WarningOpts
- disableWarning :: ClashWarning -> WarningOpts -> WarningOpts
- promoteWarning :: ClashWarning -> WarningOpts -> WarningOpts
- demoteWarning :: ClashWarning -> WarningOpts -> WarningOpts
Documentation
data ClashWarning Source #
Warnings Clash can emit. See the module documentation of Clash.Warning for the command line flags controlling each of these.
Constructors
| WarnDubiousPrimitive | A primitive marked with Flag: |
| WarnNonSynthesizable | A primitive marked with Flag: |
| WarnPrimitiveDefinition | A primitive's Haskell definition looks problematic: it isn't marked OPAQUE, its result is always an error, or its blackbox uses arguments the Haskell definition doesn't use. Flag: |
| WarnCastSpecialization | A function is specialized on a non work-free cast, possibly duplicating work. Flag: |
| WarnIntegerNarrowing | A Flag: |
| WarnUnmatchableConstant | A case subject evaluated to a constant that matches none of the
alternatives, usually a missing reduction rule in the primitive evaluator.
Only reported when invariants are being checked ( Flag: |
Instances
warningName :: ClashWarning -> String Source #
The name of a warning as used in command line flags, e.g.
clash-dubious-primitive for WarnDubiousPrimitive.
parseWarningName :: String -> Maybe ClashWarning Source #
Inverse of warningName
Warning options
data WarningOpts Source #
Which warnings are enabled, and which of them are fatal. Construct with
defWarningOpts and the state transitions below; query with wopt and
woptFatal.
Constructors
| WarningOpts | |
Fields
| |
Instances
defWarningOpts :: WarningOpts Source #
All warnings enabled, none fatal
wopt :: ClashWarning -> WarningOpts -> Bool Source #
Is the given warning enabled?
woptFatal :: Bool -> ClashWarning -> WarningOpts -> Bool Source #
Should the given warning be promoted to an error? The first argument
indicates whether all warnings should be treated as errors (-Werror).
Flag-parsing state transitions
enableWarning :: ClashWarning -> WarningOpts -> WarningOpts Source #
-W<name>
disableWarning :: ClashWarning -> WarningOpts -> WarningOpts Source #
-Wno-<name>
promoteWarning :: ClashWarning -> WarningOpts -> WarningOpts Source #
-Werror=<name>. Implies -W<name>, like in GHC.
demoteWarning :: ClashWarning -> WarningOpts -> WarningOpts Source #
-Wwarn=<name> / -Wno-error=<name>