summaryrefslogtreecommitdiff
path: root/gcc/java/jcf-io.c
diff options
context:
space:
mode:
authorapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>2000-01-06 22:06:22 +0000
committerapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>2000-01-06 22:06:22 +0000
commit57e0b67f9099183c76590029369a537ce77e846f (patch)
treed12da492ed43c4a347224bc8279988400a99514b /gcc/java/jcf-io.c
parent6dd5d8e36d27af48e738ab1c460942b50607ea33 (diff)
downloadgcc-57e0b67f9099183c76590029369a537ce77e846f.tar.gz
Fri Dec 24 00:25:29 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* Makefile.in (LIBDEPS): Added gcc's errors.o (../jcf-dump$(exeext):): Link with gcc's errors.o (../gcjh$(exeext):): Likewise. * expr.c (expand_java_NEW): Layout the entire target type instead of laying out its methods only. (lookup_field): Layout the class after having loaded it. * java-tree.h (java_debug_context): Declared. * jcf-io.c (toplev.h): Included. (find_class): Removed assignment to jcf's outofsynch field. Force source file to be read if newer than its matching class file. Tweaked debug messages. * jcf-parse.c (jcf_out_of_synch): Deleted. (read_class): Call to jcf_out_of_synch removed. * jcf.h (typedef struct JCF): Field `outofsynch' deleted. (jcf_out_of_synch): Prototype deleted. * parse.h (struct parser_ctxt): `minus_seen', `java_error_flag', `deprecated' and `class_err': integer turned into bit fields. New bit fields `saved_data_ctx' and `saved_data'. Fixed comments. * parse.y (package_list): New global. (package_declaration:): Record newly parsed package name. (extra_ctxp_pushed_p): Static global deleted. (java_parser_context_save_global): Create buffer context for the purpose of saving globals, if necessary. (java_parser_context_restore_global): Pop context pushed for the purpose of saving globals, if necessary. (java_debug_context_do): New prototype and function. (java_debug_context): Likewise. (do_resolve_class): Use already parsed package names to qualify and lookup class candidate. (java_pre_expand_clinit): Removed unnecessary local variable. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31261 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/jcf-io.c')
-rw-r--r--gcc/java/jcf-io.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c
index 2d43a513e8e..0f650237b78 100644
--- a/gcc/java/jcf-io.c
+++ b/gcc/java/jcf-io.c
@@ -27,6 +27,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "jcf.h"
#include "tree.h"
+#include "toplev.h"
#include "java-tree.h"
/* DOS brain-damage */
@@ -286,7 +287,7 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok),
java_buffer = (char *) alloca (buflen);
- jcf->java_source = jcf->outofsynch = 0;
+ jcf->java_source = 0;
for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry))
{
@@ -352,8 +353,24 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok),
}
}
+ /* We preferably pick a class file if we have a chance. If the source
+ file is newer than the class file, we issue a warning and parse the
+ source file instead.
+ There should be a flag to allow people have the class file picked
+ up no matter what. FIXME. */
if (! java && ! class && java_buf.st_mtime >= class_buf.st_mtime)
- jcf->outofsynch = 1;
+ {
+ char *stripped_class_name = xstrdup (classname);
+ int i = strlen (stripped_class_name);
+
+ while (stripped_class_name [i] != '.')
+ i--;
+
+ stripped_class_name [i] = '\0';
+ warning ("Source file for class `%s' is newer than its matching class file. Source file used instead", stripped_class_name);
+ free (stripped_class_name);
+ class = -1;
+ }
if (! java)
dep_file = java_buffer;
@@ -382,7 +399,10 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok),
#else
if (!class)
{
- SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
+ SOURCE_FRONTEND_DEBUG ((stderr, "[Class selected: %s]\n",
+ classname+classname_length-
+ (classname_length <= 30 ?
+ classname_length : 30)));
fd = open (buffer, O_RDONLY | O_BINARY);
if (fd >= 0)
goto found;
@@ -391,7 +411,10 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok),
if (!java)
{
strcpy (buffer, java_buffer);
- SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
+ SOURCE_FRONTEND_DEBUG ((stderr, "[Source selected: %s]\n",
+ classname+classname_length-
+ (classname_length <= 30 ?
+ classname_length : 30)));
fd = open (buffer, O_RDONLY);
if (fd >= 0)
{