diff --git a/checks/Check.hs b/checks/Check.hs index 20227a1..d8da2e9 100644 --- a/checks/Check.hs +++ b/checks/Check.hs @@ -467,7 +467,8 @@ checkParAssignUsage g = mapM_ checkParAssign . findAllProcess isParAssign g mockedupParItems = fmap ((,) bk) $ ParItems [SeqItems [Usage Nothing Nothing Nothing $ 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) => FlowGraph' m (BK, UsageLabel) t -> A.Structured t -> m () checkProcCallArgsUsage g = mapM_ checkArgs . findAllProcess isProcCall g diff --git a/checks/CheckTest.hs b/checks/CheckTest.hs index 3f0ae11..6a5298d 100644 --- a/checks/CheckTest.hs +++ b/checks/CheckTest.hs @@ -106,6 +106,7 @@ viotests v = liftM (TestLabel "CheckTest" . TestList) $ sequence [ return testUnusedVar ,automaticTest FrontendOccam v "testcases/automatic/abbrev-check-1.occ.test" + ,automaticTest FrontendOccam v "testcases/automatic/pragma-1.occ.test" ] diff --git a/testcases/automatic/pragma-1.occ.test b/testcases/automatic/pragma-1.occ.test new file mode 100644 index 0000000..8795f4d --- /dev/null +++ b/testcases/automatic/pragma-1.occ.test @@ -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 +%