X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcForeign.lhs;h=a7101118b04567be8f7c7c4ee9fe0c99202eb3ca;hb=922de8ca1aa3f2a1796e8cfa9bf8e52d7b959d9b;hp=fa91028f0060336eb8dcf81c0fde2ce952e94354;hpb=16513d4899e167d20e120c2b3907230b7ff9dd83;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcForeign.lhs b/compiler/typecheck/TcForeign.lhs index fa91028..a710111 100644 --- a/compiler/typecheck/TcForeign.lhs +++ b/compiler/typecheck/TcForeign.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1998 % \section[TcForeign]{Typechecking \tr{foreign} declarations} @@ -22,38 +23,23 @@ module TcForeign import HsSyn import TcRnMonad -import TcHsType ( tcHsSigType, UserTypeCtxt(..) ) -import TcExpr ( tcPolyExpr ) +import TcHsType +import TcExpr -import ForeignCall ( CCallConv(..) ) -import ErrUtils ( Message ) -import Id ( Id, mkLocalId, mkExportedLocalId ) +import ForeignCall +import ErrUtils +import Id #if alpha_TARGET_ARCH -import Type ( typePrimRep ) -import SMRep ( argMachRep, primRepToCgRep, primRepHint ) +import Type +import SMRep +import MachOp #endif -import OccName ( mkForeignExportOcc ) -import Name ( Name, NamedThing(..), mkExternalName ) -import TcType ( Type, tcSplitFunTys, tcSplitTyConApp_maybe, - tcSplitForAllTys, tcSplitIOType_maybe, - isFFIArgumentTy, isFFIImportResultTy, - isFFIExportResultTy, isFFILabelTy, - isFFIExternalTy, isFFIDynArgumentTy, - isFFIDynResultTy, isFFIDotnetTy, isFFIDotnetObjTy, - toDNType - ) -import ForeignCall ( CExportSpec(..), CCallTarget(..), - CLabelString, isCLabelString, - isDynamicTarget, withDNTypes, DNKind(..), DNCallSpec(..) ) -import PrelNames ( hasKey, ioTyConKey ) -import DynFlags ( DynFlags(..), HscTarget(..) ) +import Name +import TcType +import DynFlags import Outputable -import SrcLoc ( Located(..), srcSpanStart ) -import Bag ( consBag ) - -#if alpha_TARGET_ARCH -import MachOp ( machRepByteWidth, MachHint(FloatHint) ) -#endif +import SrcLoc +import Bag \end{code} \begin{code} @@ -228,8 +214,7 @@ tcFExport fo@(ForeignExport (L loc nm) hs_ty spec) = newUnique `thenM` \ uniq -> getModule `thenM` \ mod -> let - gnm = mkExternalName uniq mod (mkForeignExportOcc (getOccName nm)) - Nothing (srcSpanStart loc) + gnm = mkExternalName uniq mod (mkForeignExportOcc (getOccName nm)) loc id = mkExportedLocalId gnm sig_ty bind = L loc (VarBind id rhs) in @@ -288,7 +273,6 @@ checkForeignRes non_io_result_ok pred_res_ty ty \end{code} \begin{code} -checkDotnet HscILX = Nothing #if defined(mingw32_TARGET_OS) checkDotnet HscC = Nothing checkDotnet _ = Just (text "requires C code generation (-fvia-C)") @@ -309,10 +293,9 @@ checkCOrAsmOrInterp other checkCOrAsmOrDotNetOrInterp HscC = Nothing checkCOrAsmOrDotNetOrInterp HscAsm = Nothing -checkCOrAsmOrDotNetOrInterp HscILX = Nothing checkCOrAsmOrDotNetOrInterp HscInterpreted = Nothing checkCOrAsmOrDotNetOrInterp other - = Just (text "requires interpreted, C, native or .NET ILX code generation") + = Just (text "requires interpreted, C or native code generation") checkCg check = getDOpts `thenM` \ dflags -> @@ -323,7 +306,7 @@ checkCg check case check target of Nothing -> returnM () Just err -> addErrTc (text "Illegal foreign declaration:" <+> err) -\end{code} +\end{code} Calling conventions