Commit 5cca0b44 authored by mad.one@gmail.com's avatar mad.one@gmail.com

Add -f[no-]warn-unsupported-llvm-version. Closes Trac #7579.

This controls whether or not the compiler warns if we're using an LLVM
version that's too old or too new. It's mostly useful when building the
compiler knowingly with an unsupported version, so you don't get a lot
of warnings in the build process.

There's no documentation for this since it's a flag only a few
developers would care about anyway.
Signed-off-by: mad.one@gmail.com's avatarAustin Seipp <mad.one@gmail.com>
parent b05531bd
...@@ -68,11 +68,12 @@ llvmCodeGen dflags h us cmms ...@@ -68,11 +68,12 @@ llvmCodeGen dflags h us cmms
ver <- (fromMaybe defaultLlvmVersion) `fmap` figureLlvmVersion dflags ver <- (fromMaybe defaultLlvmVersion) `fmap` figureLlvmVersion dflags
-- cache llvm version for later use -- cache llvm version for later use
writeIORef (llvmVersion dflags) ver writeIORef (llvmVersion dflags) ver
when (ver < minSupportLlvmVersion) $ let doWarn = wopt Opt_WarnUnsupportedLlvmVersion dflags
when (ver < minSupportLlvmVersion && doWarn) $
errorMsg dflags (text "You are using an old version of LLVM that" errorMsg dflags (text "You are using an old version of LLVM that"
<> text " isn't supported anymore!" <> text " isn't supported anymore!"
$+$ text "We will try though...") $+$ text "We will try though...")
when (ver > maxSupportLlvmVersion) $ when (ver > maxSupportLlvmVersion && doWarn) $
putMsg dflags (text "You are using a new version of LLVM that" putMsg dflags (text "You are using a new version of LLVM that"
<> text " hasn't been tested yet!" <> text " hasn't been tested yet!"
$+$ text "We will try though...") $+$ text "We will try though...")
......
...@@ -425,6 +425,7 @@ data WarningFlag = ...@@ -425,6 +425,7 @@ data WarningFlag =
| Opt_WarnSafe | Opt_WarnSafe
| Opt_WarnPointlessPragmas | Opt_WarnPointlessPragmas
| Opt_WarnUnsupportedCallingConventions | Opt_WarnUnsupportedCallingConventions
| Opt_WarnUnsupportedLlvmVersion
| Opt_WarnInlineRuleShadowing | Opt_WarnInlineRuleShadowing
deriving (Eq, Show, Enum) deriving (Eq, Show, Enum)
...@@ -2398,7 +2399,8 @@ fWarningFlags = [ ...@@ -2398,7 +2399,8 @@ fWarningFlags = [
( "warn-safe", Opt_WarnSafe, setWarnSafe ), ( "warn-safe", Opt_WarnSafe, setWarnSafe ),
( "warn-pointless-pragmas", Opt_WarnPointlessPragmas, nop ), ( "warn-pointless-pragmas", Opt_WarnPointlessPragmas, nop ),
( "warn-unsupported-calling-conventions", Opt_WarnUnsupportedCallingConventions, nop ), ( "warn-unsupported-calling-conventions", Opt_WarnUnsupportedCallingConventions, nop ),
( "warn-inline-rule-shadowing", Opt_WarnInlineRuleShadowing, nop ) ] ( "warn-inline-rule-shadowing", Opt_WarnInlineRuleShadowing, nop ),
( "warn-unsupported-llvm-version", Opt_WarnUnsupportedLlvmVersion, nop ) ]
-- | These @-\<blah\>@ flags can all be reversed with @-no-\<blah\>@ -- | These @-\<blah\>@ flags can all be reversed with @-no-\<blah\>@
negatableFlags :: [FlagSpec GeneralFlag] negatableFlags :: [FlagSpec GeneralFlag]
...@@ -2783,6 +2785,7 @@ standardWarnings ...@@ -2783,6 +2785,7 @@ standardWarnings
Opt_WarnAlternativeLayoutRuleTransitional, Opt_WarnAlternativeLayoutRuleTransitional,
Opt_WarnPointlessPragmas, Opt_WarnPointlessPragmas,
Opt_WarnUnsupportedCallingConventions, Opt_WarnUnsupportedCallingConventions,
Opt_WarnUnsupportedLlvmVersion,
Opt_WarnInlineRuleShadowing, Opt_WarnInlineRuleShadowing,
Opt_WarnDuplicateConstraints Opt_WarnDuplicateConstraints
] ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment