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

Add a flag for the unsupported calling convention warning

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