PATCH: gcjh fixlet

Tom Tromey tromey@cygnus.com
Fri Feb 26 11:32:00 GMT 1999


Right now gcjh will generate a declaration for the current class, even
if that class is in one of the standard packages.  I'm committing the
appended patch, which changes this.

1999-02-26  Tom Tromey  <tromey@cygnus.com>

	* gjavah.c (add_namelet): Check for standard package names here.
	(add_class_decl): Don't check for standard package names here.

Tom

Index: gjavah.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/java/gjavah.c,v
retrieving revision 1.28
diff -u -r1.28 gjavah.c
--- gjavah.c	1999/02/24 21:49:42	1.28
+++ gjavah.c	1999/02/26 19:26:49
@@ -865,6 +865,23 @@
   unsigned char *p;
   struct namelet *n = NULL, *np;
 
+  /* We want to skip the standard namespaces that we assume the
+     runtime already knows about.  We only do this at the top level,
+     though, hence the check for `root'.  */
+  if (parent == &root)
+    {
+#define JAVALANG "java/lang/"
+#define JAVAIO "java/io/"
+#define JAVAUTIL "java/util/"
+      if ((name_limit - name >= sizeof (JAVALANG) - 1
+	   && ! strncmp (name, JAVALANG, sizeof (JAVALANG) - 1))
+	  || (name_limit - name >= sizeof (JAVAUTIL) - 1
+	      && ! strncmp (name, JAVAUTIL, sizeof (JAVAUTIL) - 1))
+	  || (name_limit - name >= sizeof (JAVAIO) - 1
+	      && ! strncmp (name, JAVAIO, sizeof (JAVAIO) - 1)))
+	return;
+    }
+
   for (p = name; p < name_limit && *p != '/' && *p != '$'; ++p)
     ;
 
@@ -976,20 +993,6 @@
 	      jcf_print_utf8 (out, &s[start], i - start);
 	      fputs (">\n", out);
 	    }
-	}
-
-#define JAVALANG "java/lang/"
-#define JAVAIO "java/io/"
-#define JAVAUTIL "java/util/"
-      if ((i - start >= sizeof (JAVALANG) - 1
-	   && ! strncmp (&s[start], JAVALANG, sizeof (JAVALANG) - 1))
-	  || (i - start >= sizeof (JAVAUTIL) - 1
-	      && ! strncmp (&s[start], JAVAUTIL, sizeof (JAVAUTIL) - 1))
-	  || (i - start >= sizeof (JAVAIO) - 1
-	      && ! strncmp (&s[start], JAVAIO, sizeof (JAVAIO) - 1)))
-	{
-	  /* Skip all the standard `java.' classes.  */
-	  continue;
 	}
 
       add_namelet (&s[start], &s[i], &root);


More information about the Gcc-patches mailing list