diff --git a/backends/BackendPasses.hs b/backends/BackendPasses.hs index dd61d40..576fc01 100644 --- a/backends/BackendPasses.hs +++ b/backends/BackendPasses.hs @@ -330,7 +330,13 @@ addSizesFormalParameters :: Pass addSizesFormalParameters = occamOnlyPass "Add array-size arrays to PROC headers" (prereq ++ [Prop.arraySizesDeclared]) [] - (applyDepthM doSpecification) + (\t -> do t' <- applyDepthM doSpecification t + cs <- getCompState + sequence_ [doSpecification $ A.Specification emptyMeta (A.Name emptyMeta n) + (A.Proc emptyMeta (A.PlainSpec, A.PlainRec) + fs (A.Skip emptyMeta)) + | (n, fs) <- csExternals cs] + return t') where doSpecification :: A.Specification -> PassM A.Specification doSpecification (A.Specification m n (A.Proc m' sm args body)) diff --git a/backends/GenerateC.hs b/backends/GenerateC.hs index 9119c7f..9fcb200 100644 --- a/backends/GenerateC.hs +++ b/backends/GenerateC.hs @@ -2041,8 +2041,12 @@ cgenProcCall n as (A.Recursive, _) -> let m = A.nameMeta n in call genPar A.PlainPar $ A.Only m $ A.ProcCall m n as - (_, Just fs) -> + (_, Just _) -> do tell ["{int args_plus_blank[] = {0"] + -- We don't use the formals in externals because they won't + -- have had array sizes added: + (A.Proc _ _ fs _) <- specTypeOfName n + liftIO $ putStrLn $ show (fs, as) call genActuals fs as tell ["};"] let (_:cs) = A.nameName n