From 9448411acfcaae8109c31be5828e75619f2cad9b Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sat, 29 Mar 2008 14:39:14 +0000 Subject: [PATCH] prelude/PrimOp is now mostly warning-free commutableOp seems to be unused, so we're no 100% there yet. --- compiler/prelude/PrimOp.lhs | 7 ++++++- utils/genprimopcode/Main.hs | 12 +++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/compiler/prelude/PrimOp.lhs b/compiler/prelude/PrimOp.lhs index a98e3a0..7c30d9e 100644 --- a/compiler/prelude/PrimOp.lhs +++ b/compiler/prelude/PrimOp.lhs @@ -4,7 +4,7 @@ \section[PrimOp]{Primitive operations (machine-level)} \begin{code} -{-# OPTIONS -w #-} +{-# OPTIONS -fno-warn-unused-binds #-} -- The above warning supression flag is a temporary kludge. -- While working on this module you are encouraged to remove it and fix -- any warnings in the module. See @@ -39,6 +39,7 @@ import BasicTypes ( Arity, Boxity(..) ) import Unique ( Unique, mkPrimOpIdUnique ) import Outputable import FastTypes +import FastString \end{code} %************************************************************************ @@ -130,9 +131,12 @@ data PrimOpInfo [Type] Type +mkDyadic, mkMonadic, mkCompare :: FastString -> Type -> PrimOpInfo mkDyadic str ty = Dyadic (mkVarOccFS str) ty mkMonadic str ty = Monadic (mkVarOccFS str) ty mkCompare str ty = Compare (mkVarOccFS str) ty + +mkGenPrimOp :: FastString -> [TyVar] -> [Type] -> Type -> PrimOpInfo mkGenPrimOp str tvs tys ty = GenPrimOp (mkVarOccFS str) tvs tys ty \end{code} @@ -464,6 +468,7 @@ commutableOp :: PrimOp -> Bool Utils: \begin{code} +dyadic_fun_ty, monadic_fun_ty, compare_fun_ty :: Type -> Type dyadic_fun_ty ty = mkFunTys [ty, ty] ty monadic_fun_ty ty = mkFunTy ty ty compare_fun_ty ty = mkFunTys [ty, ty] boolTy diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs index 3b30742..b96e9b4 100644 --- a/utils/genprimopcode/Main.hs +++ b/utils/genprimopcode/Main.hs @@ -376,12 +376,14 @@ gen_primop_list (Info _ entries) gen_primop_tag :: Info -> String gen_primop_tag (Info _ entries) - = unlines (max_def : zipWith f primop_entries [1 :: Int ..]) + = unlines (max_def_type : max_def : + tagOf_type : zipWith f primop_entries [1 :: Int ..]) where - primop_entries = filter is_primop entries - f i n = "tagOf_PrimOp " ++ cons i - ++ " = _ILIT(" ++ show n ++ ") :: FastInt" - max_def = "maxPrimOpTag = " ++ show (length primop_entries) ++ " :: Int" + primop_entries = filter is_primop entries + tagOf_type = "tagOf_PrimOp :: PrimOp -> FastInt" + f i n = "tagOf_PrimOp " ++ cons i ++ " = _ILIT(" ++ show n ++ ")" + max_def_type = "maxPrimOpTag :: Int" + max_def = "maxPrimOpTag = " ++ show (length primop_entries) gen_data_decl :: Info -> String gen_data_decl (Info _ entries) -- 1.7.10.4