This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: java snafu cleanup
- To: egcs-patches at cygnus dot com
- Subject: PATCH: java snafu cleanup
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 22 Oct 1998 17:31:11 -0600
- Reply-To: tromey at cygnus dot com
I'm committing the appended patch. It fixes a couple stupid mistakes
in the java front end. First, the `-fclasspath' option needs to be
looked for before the other `-f' option processing is done. Second,
we don't want to add the directory separator to the end of a `.zip'
file's name.
1998-10-22 Tom Tromey <tromey@cygnus.com>
* jcf-path.c (add_entry): Don't add trailing separator if entry is
a .zip file.
(add_path): Don't add trailing separator to non-empty path
elements.
* lang.c (lang_decode_option): Check for -fclasspath and
-fCLASSPATH before examining other `-f' options.
Tom
Index: jcf-path.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/java/jcf-path.c,v
retrieving revision 1.1
diff -u -r1.1 jcf-path.c
--- jcf-path.c 1998/10/22 12:05:55 1.1
+++ jcf-path.c 1998/10/22 23:27:27
@@ -152,7 +152,9 @@
n->flags |= FLAG_SYSTEM;
}
- if (filename[len - 1] != '/' && filename[len - 1] != DIR_SEPARATOR)
+ if (! (n->flags & FLAG_ZIP)
+ && filename[len - 1] != '/'
+ && filename[len - 1] != DIR_SEPARATOR)
{
char *f2 = (char *) alloca (len + 1);
strcpy (f2, filename);
@@ -186,20 +188,17 @@
{
if (! *endp || *endp == PATH_SEPARATOR)
{
- strncpy (buf, startp, endp - startp);
if (endp == startp)
{
buf[0] = '.';
buf[1] = DIR_SEPARATOR;
buf[2] = '\0';
}
- else if (endp[-1] != '/' && endp[1] != DIR_SEPARATOR)
+ else
{
- buf[endp - startp] = DIR_SEPARATOR;
- buf[endp - startp + 1] = '\0';
+ strncpy (buf, startp, endp - startp);
+ buf[endp - startp] = '\0';
}
- else
- buf[endp - startp] = '\0';
add_entry (entp, buf, is_system);
if (! *endp)
break;
Index: lang.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/java/lang.c,v
retrieving revision 1.6
diff -u -r1.6 lang.c
--- lang.c 1998/10/22 12:06:00 1.6
+++ lang.c 1998/10/22 23:27:29
@@ -126,6 +126,27 @@
char **argv;
{
char *p = argv[0];
+
+#define CLARG "-fclasspath="
+ if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
+ {
+ jcf_path_classpath_arg (p + sizeof (CLARG) - 1);
+ return 1;
+ }
+#undef CLARG
+#define CLARG "-fCLASSPATH="
+ else if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
+ {
+ jcf_path_CLASSPATH_arg (p + sizeof (CLARG) - 1);
+ return 1;
+ }
+#undef CLARG
+ else if (strncmp (p, "-I", 2) == 0)
+ {
+ jcf_path_include_arg (p + 2);
+ return 1;
+ }
+
if (p[0] == '-' && p[1] == 'f')
{
/* Some kind of -f option.
@@ -180,26 +201,6 @@
{
jcf_dependency_init (0);
dependency_tracking |= DEPEND_ENABLE;
- return 1;
- }
-
-#define CLARG "-fclasspath="
- if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
- {
- jcf_path_classpath_arg (p + sizeof (CLARG));
- return 1;
- }
-#undef CLARG
-#define CLARG "-fCLASSPATH="
- else if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
- {
- jcf_path_CLASSPATH_arg (p + sizeof (CLARG));
- return 1;
- }
-#undef CLARG
- else if (strncmp (p, "-I", 2) == 0)
- {
- jcf_path_include_arg (p + 2);
return 1;
}