Made the usage checking check if a name was marked by a SHARED pragma before issuing an error
This commit is contained in:
parent
8a36f6e96f
commit
ee856a0d39
|
@ -85,8 +85,10 @@ checkArrayUsage (m,p) = mapM_ (checkIndexes m) $ Map.toList $
|
|||
-- Checks the given ParItems of writes and reads against each other. The
|
||||
-- String (array-name) and Meta are only used for printing out error messages
|
||||
checkIndexes :: Meta -> (String, ParItems (BK, [A.Expression], [A.Expression])) -> m ()
|
||||
checkIndexes m (arrName, indexes)
|
||||
= do userArrName <- getRealName (A.Name undefined arrName)
|
||||
checkIndexes m (arrName, indexes) = do
|
||||
sharedNames <- getCompState >>* csNameAttr
|
||||
when (Map.lookup arrName sharedNames /= Just NameShared) $
|
||||
do userArrName <- getRealName (A.Name undefined arrName)
|
||||
arrType <- astTypeOf (A.Name undefined arrName)
|
||||
arrLength <- case arrType of
|
||||
A.Array (A.Dimension d:_) _ -> return d
|
||||
|
|
|
@ -182,10 +182,20 @@ checkPlainVarUsage (m, p) = {- liftIO (putStrLn ("Checking: " ++ show (m,p))) >>
|
|||
|
||||
checkCREW :: [Var] -> Vars -> [Vars] -> m ()
|
||||
checkCREW decl item rest
|
||||
= do writtenTwice <- filterPlain $ (Map.keysSet (writtenVars item) `Set.intersection` Map.keysSet
|
||||
(writtenVars otherVars)) `Set.difference` Set.fromList decl
|
||||
writtenAndRead <- filterPlain $ (Map.keysSet (writtenVars item) `Set.intersection` readVars otherVars)
|
||||
`Set.difference` Set.fromList decl
|
||||
= do sharedNames <- getCompState >>* csNameAttr >>* Map.filter (== NameShared)
|
||||
>>* Map.keysSet >>* (Set.map $ UsageCheckUtils.Var . A.Variable emptyMeta . A.Name emptyMeta)
|
||||
writtenTwice <- filterPlain $
|
||||
((Map.keysSet (writtenVars item)
|
||||
`Set.intersection`
|
||||
Map.keysSet (writtenVars otherVars)
|
||||
) `Set.difference` Set.fromList decl
|
||||
) `Set.difference` sharedNames
|
||||
writtenAndRead <- filterPlain $
|
||||
((Map.keysSet (writtenVars item)
|
||||
`Set.intersection`
|
||||
readVars otherVars
|
||||
) `Set.difference` Set.fromList decl
|
||||
) `Set.difference` sharedNames
|
||||
when (not $ Set.null writtenTwice) $
|
||||
diePC m $ formatCode
|
||||
"The following variables are written-to in at least two places inside a PAR: %" writtenTwice
|
||||
|
|
Loading…
Reference in New Issue
Block a user