Commit 3e314cc2 authored by Ian Lynagh's avatar Ian Lynagh

Add a flag for the unsupported calling convention warning

parent ddc7f758
......@@ -357,6 +357,7 @@ data WarningFlag =
| Opt_WarnUnsafe
| Opt_WarnSafe
| Opt_WarnPointlessPragmas
| Opt_WarnUnsupportedCallingConventions
deriving (Eq, Show, Enum)
data Language = Haskell98 | Haskell2010
......@@ -1842,7 +1843,8 @@ fWarningFlags = [
( "warn-alternative-layout-rule-transitional", Opt_WarnAlternativeLayoutRuleTransitional, nop ),
( "warn-unsafe", Opt_WarnUnsafe, setWarnUnsafe ),
( "warn-safe", Opt_WarnSafe, setWarnSafe ),
( "warn-pointless-pragmas", Opt_WarnPointlessPragmas, nop ) ]
( "warn-pointless-pragmas", Opt_WarnPointlessPragmas, nop ),
( "warn-unsupported-calling-conventions", Opt_WarnUnsupportedCallingConventions, nop ) ]
-- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
fFlags :: [FlagSpec DynFlag]
......@@ -2174,7 +2176,8 @@ standardWarnings
Opt_WarnDodgyForeignImports,
Opt_WarnWrongDoBind,
Opt_WarnAlternativeLayoutRuleTransitional,
Opt_WarnPointlessPragmas
Opt_WarnPointlessPragmas,
Opt_WarnUnsupportedCallingConventions
]
minusWOpts :: [WarningFlag]
......
......@@ -48,6 +48,8 @@ import Platform
import SrcLoc
import Bag
import FastString
import Control.Monad
\end{code}
\begin{code}
......@@ -454,7 +456,8 @@ checkCConv StdCallConv = do dflags <- getDynFlags
if platformArch platform == ArchX86
then return StdCallConv
else do -- This is a warning, not an error. see #3336
addWarnTc (text "the 'stdcall' calling convention is unsupported on this platform," $$ text "treating as ccall")
when (wopt Opt_WarnUnsupportedCallingConventions dflags) $
addWarnTc (text "the 'stdcall' calling convention is unsupported on this platform," $$ text "treating as ccall")
return CCallConv
checkCConv PrimCallConv = do addErrTc (text "The `prim' calling convention can only be used with `foreign import'")
return PrimCallConv
......
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