Patch: Fix for PR 2369

Bryce McKinlay bryce@waitaki.otago.ac.nz
Thu Oct 11 20:16:00 GMT 2001


Tom Tromey wrote:

>This fixes PR 2369.  It adds some up-front checking to --main, so that
>gcj will give an error if the argument isn't a valid name.
>
>This patch is a bit hacky.  It duplicates some code from lex.h.  The
>alternative would require introducing a new file; I'm willing to
>rewrite this way if required.
>

If we passed the --main option through to jc1, it could verify that it 
is not only a valid class name but also an actual class that contains a 
"main" method. Since jc1 is always run before the linker, it could give 
an intelligent error message if --main wasn't valid. This wouldn't help 
when just using "gcj" for linking, though. It would also be nice if gcj 
would automatically find a "main" when no --main option is given.

So, maybe the ultimate fix would be to get rid of the jvgenmain stuff, 
and have jc1 generate the C "main" itself. The driver would pass 
"-fmain" if a main method is required but was not specified, or 
-fmain=xxx if the user specified one.

regards

Bryce.






More information about the Java-patches mailing list