Added some testcases for the correct use of the right pragma (of SHARED and PERMITALIASES)

This commit is contained in:
Neil Brown 2009-02-10 01:13:31 +00:00
parent 81959bd76b
commit 05c87e6935
3 changed files with 46 additions and 1 deletions

View File

@ -467,7 +467,8 @@ checkParAssignUsage g = mapM_ checkParAssign . findAllProcess isParAssign g
mockedupParItems = fmap ((,) bk) $ ParItems [SeqItems [Usage Nothing Nothing Nothing mockedupParItems = fmap ((,) bk) $ ParItems [SeqItems [Usage Nothing Nothing Nothing
$ processVarW v Nothing] | v <- vs] $ processVarW v Nothing] | v <- vs]
-- TODO for this pass, make the usage checker examine the PERMITALIASES pragma
-- instead of SHARED
checkProcCallArgsUsage :: forall m t. (CSMR m, Die m, MonadIO m, Data t) => checkProcCallArgsUsage :: forall m t. (CSMR m, Die m, MonadIO m, Data t) =>
FlowGraph' m (BK, UsageLabel) t -> A.Structured t -> m () FlowGraph' m (BK, UsageLabel) t -> A.Structured t -> m ()
checkProcCallArgsUsage g = mapM_ checkArgs . findAllProcess isProcCall g checkProcCallArgsUsage g = mapM_ checkArgs . findAllProcess isProcCall g

View File

@ -106,6 +106,7 @@ viotests v = liftM (TestLabel "CheckTest" . TestList) $ sequence
[ [
return testUnusedVar return testUnusedVar
,automaticTest FrontendOccam v "testcases/automatic/abbrev-check-1.occ.test" ,automaticTest FrontendOccam v "testcases/automatic/abbrev-check-1.occ.test"
,automaticTest FrontendOccam v "testcases/automatic/pragma-1.occ.test"
] ]

View File

@ -0,0 +1,43 @@
-- This file tests PRAGMAs for SHARED and PERMITALIASES
PROC p(INT x, INT y, CHAN INT c)
SKIP
:
PROC m()
INT x:
INT y:
CHAN INT c:
%%
PAR
c ! 3
p(x,x,c)
y := 3
y := 4
:
%PASS Correct pragmas
#PRAGMA SHARED c, y
#PRAGMA PERMITALIASES x
%PASS Correct pragmas #2
#PRAGMA SHARED c, y, x
#PRAGMA PERMITALIASES x
%PASS Correct pragmas #3
#PRAGMA SHARED c, y, x
#PRAGMA PERMITALIASES x, c, y
%FAIL Incorrect pragmas #1
%FAIL Incorrect pragmas #2
#PRAGMA SHARED c, y
%FAIL Incorrect pragmas #3
#PRAGMA SHARED c
#PRAGMA PERMITALIASES x
%FAIL Incorrect pragmas #4
#PRAGMA SHARED c, y, x
%FAIL Incorrect pragmas #5
#PRAGMA SHARED c
#PRAGMA PERMITALIASES x, y
%FAIL Incorrect pragmas #6
#PRAGMA SHARED y
#PRAGMA PERMITALIASES x, c
%