From bda3a0ad96cae8275cb03cceaf1329a0d28484b2 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 14 Apr 2009 12:11:32 +0000 Subject: [PATCH] Stopped the usage checker checking shared channels for CREW violations --- checks/Check.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/checks/Check.hs b/checks/Check.hs index 19b4666..592f90a 100644 --- a/checks/Check.hs +++ b/checks/Check.hs @@ -415,11 +415,19 @@ checkPlainVarUsage sharedAttr (m, p) = check p let examineVars = map (filterMapByKey filt . (`difference` (Set.fromList decl `Set.union` allSharedNames))) vars - checkCREW examineVars + examineVars' <- mapM (filterMapByKeyM (liftM not . isSharedType)) examineVars + checkCREW examineVars' where difference m s = m `Map.difference` (Map.fromAscList $ zip (Set.toAscList s) (repeat ())) + isSharedType :: Var -> m Bool + isSharedType v = do t <- astTypeOf v + case t of + A.ChanDataType _ sh _ -> return $ sh == A.Shared + A.ChanEnd _ sh _ -> return $ sh == A.Shared + _ -> return False + -- We must compare each read against all writes after us in the list, -- and each write against all reads and writes after us in the list: checkCREW :: [Map.Map Var (Maybe BK, Maybe BK)] -> m ()