simonpj 2003/06/23 03:35:23 PDT
Sender: cvs-ghc-admin@xxxxxxxxxxx
Errors-To: cvs-ghc-admin@xxxxxxxxxxx
X-BeenThere: cvs-ghc@xxxxxxxxxxx
X-Mailman-Version: 2.0.13
Precedence: bulk
List-Help: <mailto:cvs-ghc-request@xxxxxxxxxxx?subject=help>
List-Post: <mailto:cvs-ghc@xxxxxxxxxxx>
List-Subscribe: <http://www.haskell.org/mailman/listinfo/cvs-ghc>,
<mailto:cvs-ghc-request@xxxxxxxxxxx?subject=subscribe>
List-Id: GHC/CVS discussion and fptools/ghc CVS commit messages
<cvs-ghc.haskell.org>
List-Unsubscribe: <http://www.haskell.org/mailman/listinfo/cvs-ghc>,
<mailto:cvs-ghc-request@xxxxxxxxxxx?subject=unsubscribe>
List-Archive: <http://www.haskell.org/pipermail/cvs-ghc/>
Date: Mon, 23 Jun 2003 03:35:23 -0700
Modified files:
ghc/compiler/absCSyn CLabel.lhs
ghc/compiler/codeGen CodeGen.lhs
ghc/compiler/hsSyn HsSyn.lhs
ghc/compiler/main DriverFlags.hs DriverState.hs
HscStats.lhs Main.hs
ghc/compiler/parser Parser.y ParserCore.y
ghc/compiler/prelude PrelNames.lhs
ghc/compiler/rename RnNames.lhs
ghc/compiler/typecheck TcRnDriver.lhs
ghc/docs/users_guide ffi-chap.sgml phases.sgml
ghc/rts Main.c Prelude.h
Log:
-------------------
Dealing with 'main'
-------------------
1. In GHC 6.0, a module with no "module Main ... where" header
elicited an error "main is not in scope" if 'main' is not defined. We
don't want this behaviour in GHCi. This happened because the parser
expanded the (absent) header to "module Main( main ) where", and the
'main' in the export list isn't.
Solution: elaborate HsModule to record whether the 'module ..." header was
given explicitly by the user or not.
2. Add a -main-is flag, and document it, so that you can have a 'main'
function
that is not Main.main. Summary of changes
* The -main-is flag nominates what the main function is to be (see the
documentation).
No -main-is flag says that the main function is Main.main
-main-is Foo.baz says that the main function is Foo.baz
-main-is Foo says that the main function is Foo.main
-main-is baz says that the main function is Main.baz
Let's say you say -main-is Foo.baz
* TcRnDriver injects the extra definition
$Mian.main :: IO t
$Main.main = baz
in the module Foo. Note the naming, which is a bit different than before;
previously the extra defn was for Main.$main. The RTS invokes
zdMain_main_closure.
* CodeGen injects an extra initialisation block into module Foo, thus
stginit_zdMain {
stginit_Foo
}
That ensures that the RTS can initialise stginit_zdMain.
Revision Changes Path
1.58 +0 -1 fptools/ghc/compiler/absCSyn/CLabel.lhs
1.55 +27 -7 fptools/ghc/compiler/codeGen/CodeGen.lhs
1.40 +11 -12 fptools/ghc/compiler/hsSyn/HsSyn.lhs
1.116 +17 -1 fptools/ghc/compiler/main/DriverFlags.hs
1.92 +3 -1 fptools/ghc/compiler/main/DriverState.hs
1.10 +1 -1 fptools/ghc/compiler/main/HscStats.lhs
1.127 +2 -2 fptools/ghc/compiler/main/Main.hs
1.119 +3 -13 fptools/ghc/compiler/parser/Parser.y
1.12 +1 -1 fptools/ghc/compiler/parser/ParserCore.y
1.75 +4 -4 fptools/ghc/compiler/prelude/PrelNames.lhs
1.149 +20 -4 fptools/ghc/compiler/rename/RnNames.lhs
1.36 +43 -22 fptools/ghc/compiler/typecheck/TcRnDriver.lhs
1.15 +1 -1 fptools/ghc/docs/users_guide/ffi-chap.sgml
1.17 +22 -1 fptools/ghc/docs/users_guide/phases.sgml
1.38 +3 -3 fptools/ghc/rts/Main.c
1.23 +3 -3 fptools/ghc/rts/Prelude.h
|