This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: preprocessing java source
- To: Artur Biesiadowski <abies at pg dot gda dot pl>
- Subject: Re: preprocessing java source
- From: Tom Tromey <tromey at redhat dot com>
- Date: 24 Jun 2001 12:23:37 -0600
- Cc: Java Discuss List <java at gcc dot gnu dot org>
- References: <020b01c0fc19$bdd66420$5be6b4cd@cygnus.com> <3B351E05.5915565B@pg.gda.pl>
- Reply-To: tromey at redhat dot com
>>>>> " Artur" == Artur Biesiadowski <abies@pg.gda.pl> writes:
>> I think the only preprocessing required will be to support...
>> #ifdef USE_FINALIZATION
>> #else
>> #endif
Artur> I would suggest not forcing any preprocessor by default (for
Artur> full class). Then using some invisible tags (like //IFDEF
Artur> something ) conditionally leave something out of compilation
Artur> for smaller targets.
I like this idea better than using cpp.
I think ideally the preprocessor would simply comment out lines
instead of removing them. That way the line numbers match with the
original source.
One idea I had a long time ago was to annotate methods and fields with
conditions describing their use:
public void foo ()
throws whatever
if (JDK_VERSION == 1.2 && ! J2ME)
Of course this requires a hairier preprocessor or compiler changes.
One nice feature of this approach is that you could compile all the
alternatives and have them all in the .class file (appropriately
annotated). That way you could, say, build libgcj in its most generic
form and then let the user choose the profile at compile time with
`gcj -std=J2ME' or whatever.
Tom