aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorRanjit Mathew <rmathew@hotmail.com>2003-03-10 19:39:18 +0000
committerAndrew Haley <aph@gcc.gnu.org>2003-03-10 19:39:18 +0000
commit630287af48fcf25759f9e96d0ef39db90b5fa3af (patch)
treefa4274affbe4493621a42186068b16c1747c9778 /gcc/java
parent5c2424217a35eee7fa8bf1e8456b2143af632e53 (diff)
downloadgcc-630287af48fcf25759f9e96d0ef39db90b5fa3af.zip
gcc-630287af48fcf25759f9e96d0ef39db90b5fa3af.tar.gz
gcc-630287af48fcf25759f9e96d0ef39db90b5fa3af.tar.bz2
jcf-io.c (caching_stat): Account for both DIR_SEPARATOR and DIR_SEPARATOR_2 for a target.
2003-03-10 Ranjit Mathew <rmathew@hotmail.com> * jcf-io.c (caching_stat): Account for both DIR_SEPARATOR and DIR_SEPARATOR_2 for a target. Correct minor typos. * jcf-write.c (make_class_file_name): Take both DIR_SEPARATOR and DIR_SEPARATOR_2 for a target into account. From-SVN: r64110
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog9
-rw-r--r--gcc/java/jcf-io.c10
-rw-r--r--gcc/java/jcf-write.c38
3 files changed, 47 insertions, 10 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 163567c..1f8537f 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,12 @@
+2003-03-10 Ranjit Mathew <rmathew@hotmail.com>
+
+ * jcf-io.c (caching_stat): Account for both DIR_SEPARATOR
+ and DIR_SEPARATOR_2 for a target.
+ Correct minor typos.
+
+ * jcf-write.c (make_class_file_name): Take both DIR_SEPARATOR
+ and DIR_SEPARATOR_2 for a target into account.
+
2003-03-08 Neil Booth <neil@daikokuya.co.uk>
* lang.c (java_init): Update prototype, move code to java_post_options.
diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c
index 3b10f39..cb56c09 100644
--- a/gcc/java/jcf-io.c
+++ b/gcc/java/jcf-io.c
@@ -336,6 +336,7 @@ caching_stat (char *filename, struct stat *buf)
{
#if JCF_USE_SCANDIR
char *sep;
+ char origsep;
char *base;
memoized_dirlist_entry *dent;
void **slot;
@@ -349,15 +350,20 @@ caching_stat (char *filename, struct stat *buf)
/* Get the name of the directory. */
sep = strrchr (filename, DIR_SEPARATOR);
+#ifdef DIR_SEPARATOR_2
+ if (! sep)
+ sep = strrchr (filename, DIR_SEPARATOR_2);
+#endif
if (sep)
{
+ origsep = *sep;
*sep = '\0';
base = sep + 1;
}
else
base = filename;
- /* Obtain the entry for this directory form the hash table. */
+ /* Obtain the entry for this directory from the hash table. */
slot = htab_find_slot (memoized_dirlists, filename, INSERT);
if (!*slot)
{
@@ -380,7 +386,7 @@ caching_stat (char *filename, struct stat *buf)
/* Put the separator back. */
if (sep)
- *sep = DIR_SEPARATOR;
+ *sep = origsep;
/* If the file is not in the list, there is no need to stat it; it
does not exist. */
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c
index a18f062..d9fc650 100644
--- a/gcc/java/jcf-write.c
+++ b/gcc/java/jcf-write.c
@@ -3263,6 +3263,7 @@ make_class_file_name (tree clas)
const char *dname, *cname, *slash;
char *r;
struct stat sb;
+ char sep;
cname = IDENTIFIER_POINTER (identifier_subst (DECL_NAME (TYPE_NAME (clas)),
"", '.', DIR_SEPARATOR,
@@ -3274,24 +3275,45 @@ make_class_file_name (tree clas)
char *t;
dname = DECL_SOURCE_FILE (TYPE_NAME (clas));
slash = strrchr (dname, DIR_SEPARATOR);
+#ifdef DIR_SEPARATOR_2
if (! slash)
- {
- dname = ".";
- slash = dname + 1;
- }
+ slash = strrchr (dname, DIR_SEPARATOR_2);
+#endif
+ if (! slash)
+ {
+ dname = ".";
+ slash = dname + 1;
+ sep = DIR_SEPARATOR;
+ }
+ else
+ sep = *slash;
+
t = strrchr (cname, DIR_SEPARATOR);
if (t)
cname = t + 1;
}
else
{
+ char *s;
+
dname = jcf_write_base_directory;
+
+ s = strrchr (dname, DIR_SEPARATOR);
+#ifdef DIR_SEPARATOR_2
+ if (! s)
+ s = strrchr (dname, DIR_SEPARATOR_2);
+#endif
+ if (s)
+ sep = *s;
+ else
+ sep = DIR_SEPARATOR;
+
slash = dname + strlen (dname);
}
r = xmalloc (slash - dname + strlen (cname) + 2);
strncpy (r, dname, slash - dname);
- r[slash - dname] = DIR_SEPARATOR;
+ r[slash - dname] = sep;
strcpy (&r[slash - dname + 1], cname);
/* We try to make new directories when we need them. We only do
@@ -3303,7 +3325,7 @@ make_class_file_name (tree clas)
dname = r + (slash - dname) + 1;
while (1)
{
- char *s = strchr (dname, DIR_SEPARATOR);
+ char *s = strchr (dname, sep);
if (s == NULL)
break;
*s = '\0';
@@ -3312,9 +3334,9 @@ make_class_file_name (tree clas)
&& mkdir (r, 0755) == -1)
fatal_io_error ("can't create directory %s", r);
- *s = DIR_SEPARATOR;
+ *s = sep;
/* Skip consecutive separators. */
- for (dname = s + 1; *dname && *dname == DIR_SEPARATOR; ++dname)
+ for (dname = s + 1; *dname && *dname == sep; ++dname)
;
}