Please try this.

Index: gjavah.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/gjavah.c,v
retrieving revision 1.124
diff -c -2 -p -r1.124 gjavah.c
*** gjavah.c    25 Nov 2004 11:13:37 -0000      1.124
--- gjavah.c    6 Dec 2004 19:15:39 -0000
*************** throwable_p (const unsigned char *clname
*** 1235,1239 ****
        int super_length = -1;
        const char *classfile_name = find_class ((char *) current, strlen 
((const char *) current),
!                                              &jcf, 0);
  
        if (! classfile_name)
--- 1235,1239 ----
        int super_length = -1;
        const char *classfile_name = find_class ((char *) current, strlen 
((const char *) current),
!                                              &jcf, 0, 0);
  
        if (! classfile_name)
*************** main (int argc, char** argv)
*** 2521,2525 ****
        if (! output_file)
        jcf_dependency_reset ();
!       classfile_name = find_class (classname, strlen (classname), &jcf, 0);
        if (classfile_name == NULL)
        {
--- 2521,2525 ----
        if (! output_file)
        jcf_dependency_reset ();
!       classfile_name = find_class (classname, strlen (classname), &jcf, 0, 0);
        if (classfile_name == NULL)
        {
Index: java-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/java-tree.h,v
retrieving revision 1.223
diff -c -2 -p -r1.223 java-tree.h
*** java-tree.h 26 Nov 2004 18:04:45 -0000      1.223
--- java-tree.h 6 Dec 2004 19:15:40 -0000
*************** extern int is_array_type_p (tree);
*** 1248,1251 ****
--- 1248,1252 ----
  extern HOST_WIDE_INT java_array_type_length (tree);
  extern int read_class (tree);
+ extern int read_class_from_source (tree);
  extern void load_class (tree, int);
  
Index: jcf-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-dump.c,v
retrieving revision 1.64
diff -c -2 -p -r1.64 jcf-dump.c
*** jcf-dump.c  25 Nov 2004 11:13:38 -0000      1.64
--- jcf-dump.c  6 Dec 2004 19:15:40 -0000
*************** main (int argc, char** argv)
*** 1036,1040 ****
        {
          char *arg = argv[argi];
!         const char *class_filename = find_class (arg, strlen (arg), jcf, 0);
          if (class_filename == NULL)
            class_filename = find_classfile (arg, jcf, NULL);
--- 1036,1040 ----
        {
          char *arg = argv[argi];
!         const char *class_filename = find_class (arg, strlen (arg), jcf, 0, 
0);
          if (class_filename == NULL)
            class_filename = find_classfile (arg, jcf, NULL);
Index: jcf-io.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-io.c,v
retrieving revision 1.53
diff -c -2 -p -r1.53 jcf-io.c
*** jcf-io.c    17 Oct 2004 22:51:35 -0000      1.53
--- jcf-io.c    6 Dec 2004 19:15:40 -0000
*************** static htab_t memoized_class_lookups;
*** 422,430 ****
     to it.  Returns NULL on failure.  If JCF != NULL, it is suitably
     initialized.  SOURCE_OK is true if we should also look for .java
!    file. */
  
  const char *
  find_class (const char *classname, int classname_length, JCF *jcf,
!           int source_ok)
  {
    int fd;
--- 422,431 ----
     to it.  Returns NULL on failure.  If JCF != NULL, it is suitably
     initialized.  SOURCE_OK is true if we should also look for .java
!    file.  SOURCE_ONLY is true iff we should only look for .java
!    files.  */
  
  const char *
  find_class (const char *classname, int classname_length, JCF *jcf,
!           int source_ok, int source_only)
  {
    int fd;
*************** find_class (const char *classname, int c
*** 464,468 ****
      {
        const char *path_name = jcf_path_name (entry);
!       if (class != 0)
        {
          int dir_len;
--- 465,469 ----
      {
        const char *path_name = jcf_path_name (entry);
!       if (class != 0 && ! source_only)
        {
          int dir_len;
Index: jcf-parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-parse.c,v
retrieving revision 1.180
diff -c -2 -p -r1.180 jcf-parse.c
*** jcf-parse.c 28 Nov 2004 06:49:48 -0000      1.180
--- jcf-parse.c 6 Dec 2004 19:15:41 -0000
*************** static void set_source_filename (JCF *, 
*** 107,110 ****
--- 107,111 ----
  static void jcf_parse (struct JCF*);
  static void load_inner_classes (tree);
+ static int read_class_worker (tree, int);
  
  /* Handle "Deprecated" attribute.  */
*************** int
*** 514,517 ****
--- 515,530 ----
  read_class (tree name)
  {
+   return read_class_worker (name, 0);
+ }
+ 
+ int
+ read_class_from_source (tree name)
+ {
+   return read_class_worker (name, 1);
+ }
+ 
+ static int
+ read_class_worker (tree name, int source_only)
+ {
    JCF this_jcf, *jcf;
    tree icv, class = NULL_TREE;
*************** read_class (tree name)
*** 534,538 ****
        jcf = &this_jcf;
        if (find_class (IDENTIFIER_POINTER (name), IDENTIFIER_LENGTH (name),
!                     &this_jcf, 1) == 0)
        return 0;
      }
--- 547,551 ----
        jcf = &this_jcf;
        if (find_class (IDENTIFIER_POINTER (name), IDENTIFIER_LENGTH (name),
!                     &this_jcf, 1, source_only) == 0)
        return 0;
      }
*************** load_class (tree class_or_name, int verb
*** 650,654 ****
  
    saved = name;
!   
    /* If flag_verify_invocations is unset, we don't try to load a class
       unless we're looking for Object (which is fixed by the ABI) or
--- 663,672 ----
  
    saved = name;
!   {
!     const char *classname = IDENTIFIER_POINTER (name);
!     if (strncmp (classname, "junit.runner.Sorter", strlen 
("junit.runner.Sorter")) == 0)
!     fprintf (stderr, "."), fflush (stderr);
!   }
! 
    /* If flag_verify_invocations is unset, we don't try to load a class
       unless we're looking for Object (which is fixed by the ABI) or
*************** load_class (tree class_or_name, int verb
*** 659,662 ****
--- 677,682 ----
        || TREE_CODE (class_or_name) == IDENTIFIER_NODE)
      {
+       int source_only = 0;
+ 
        while (1)
        {
*************** load_class (tree class_or_name, int verb
*** 671,679 ****
            }
        
!         if (read_class (name))
            break;
  
          /* We failed loading name. Now consider that we might be looking
!            for a inner class. */
          if ((separator = strrchr (IDENTIFIER_POINTER (name), '$'))
              || (separator = strrchr (IDENTIFIER_POINTER (name), '.')))
--- 691,701 ----
            }
        
!         if (source_only 
!             ? read_class_from_source (name)
!             : read_class (name))
            break;
  
          /* We failed loading name. Now consider that we might be looking
!            for a inner class in a source file.  */
          if ((separator = strrchr (IDENTIFIER_POINTER (name), '$'))
              || (separator = strrchr (IDENTIFIER_POINTER (name), '.')))
*************** load_class (tree class_or_name, int verb
*** 683,692 ****
              name = get_identifier (IDENTIFIER_POINTER (name));
              *separator = c;
! 
!             /* Otherwise we might get infinite recursion, if say we
!                have String.class but not
!                String$CaseInsensitiveComparator.class. */
!             if (current_jcf && current_jcf->java_source == 0)
!               break;
            }
          /* Otherwise, we failed, we bail. */
--- 705,709 ----
              name = get_identifier (IDENTIFIER_POINTER (name));
              *separator = c;
!             source_only = 1;
            }
          /* Otherwise, we failed, we bail. */
Index: jcf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf.h,v
retrieving revision 1.44
diff -c -2 -p -r1.44 jcf.h
*** jcf.h       15 Oct 2004 14:55:00 -0000      1.44
--- jcf.h       6 Dec 2004 19:15:41 -0000
*************** typedef struct JCF GTY(()) {
*** 252,256 ****
  #define DEFAULT_CLASS_PATH "."
  
! extern const char *find_class (const char *, int, JCF*, int);
  extern const char *find_classfile (char *, JCF*, const char *);
  extern int jcf_filbuf_from_stdio (JCF *jcf, int count);
--- 252,256 ----
  #define DEFAULT_CLASS_PATH "."
  
! extern const char *find_class (const char *, int, JCF*, int, int);
  extern const char *find_classfile (char *, JCF*, const char *);
  extern int jcf_filbuf_from_stdio (JCF *jcf, int count);

Reply via email to