This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: recent regression


Tom Tromey wrote:
> Anybody care to claim this one?
> 
> fleche. gcj -C a.java
> fleche. touch a.java
> fleche. gcj -C a.java
> a.java:0: warning: source file for class `a' is newer than its matching class file.  Source file `./a.java' used instead

This is a fallout of my patch for PR13948:

  http://gcc.gnu.org/ml/java-patches/2004-q2/msg00680.html


> We never used to emit that warning, which is bogus -- I specifically
> asked to compile a.java, and in this situation reading a.class would
> be wrong anyway.

This is because read_class() isn't quite equipped to handle source
files that have been parsed already and it unnecessarily calls
find_class() that emits this warning all over again.

I had submitted this patch to resolve this issue a few days
back:

  http://gcc.gnu.org/ml/gcc-patches/2004-06/msg01589.html

(For some reason this mail didn't get archived in the java-patches
archives.)

Note that some time after the original code for parsing/laying-out
was written, the meaning of CLASS_LOADED_P was changed:

  http://gcc.gnu.org/ml/java/2001-04/msg00114.html

and CLASS_PARSED_P was introduced. This meant that if you
read code like the following (that's quite common throughout
the front end):

  if (! CLASS_LOADED_P (cls))
    load_class (cls);

and naively assumed that after this CLASS_LOADED_P (cls) would
be true, you'd be wrong. :-/

What is really needed is some way to indicate that the
class is completed (analysed, references resolved, etc.) and
not necessarily that it has been laid out.

I wanted to propose adding a CLASS_COMPLETED_P flag after a
successful call to java_complete_class() in parse_source_file_2(),
but ran out of TYPE_LANG_FLAGs. :-/ (Perhaps, it can be made
an inferred "flag" like CLASS_LOADED_P is right now.)

Anyway, this was just to describe why I added the above code
for PR13948, even though it is "wrong".

Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT gmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]