aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorPer Bothner <bothner@cygnus.com>1998-11-15 14:12:42 +0000
committerPer Bothner <bothner@gcc.gnu.org>1998-11-15 06:12:42 -0800
commit0ef38928667f16fbf49c8a422495a7791e4340c9 (patch)
tree60f9d02b1b9c05fbbb80d07ea00e1cbb99a19cd1 /gcc/java
parent46689c0ba4807c2f85b4626972a9b6554b3bea13 (diff)
downloadgcc-0ef38928667f16fbf49c8a422495a7791e4340c9.zip
gcc-0ef38928667f16fbf49c8a422495a7791e4340c9.tar.gz
gcc-0ef38928667f16fbf49c8a422495a7791e4340c9.tar.bz2
jcf-parse.c (HANDLE_EXCEPTIONS_ATTRIBUTE): New macro.
8 * jcf-parse.c (HANDLE_EXCEPTIONS_ATTRIBUTE): New macro. * jcf-io.c (find_class): Simpler/cleaner structure fixes a bug. From-SVN: r23659
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog6
-rw-r--r--gcc/java/jcf-io.c147
-rw-r--r--gcc/java/jcf-parse.c12
3 files changed, 87 insertions, 78 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 89c7f68..56639d6 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,9 @@
+Sun Nov 15 14:10:56 1998 Per Bothner <bothner@cygnus.com>
+
+ * jcf-parse.c (HANDLE_EXCEPTIONS_ATTRIBUTE): New macro.
+
+ * jcf-io.c (find_class): Simpler/cleaner structure fixes a bug.
+
Sat Nov 14 17:19:18 1998 Per Bothner <bothner@cygnus.com>
Allow uses of interface types to verify. This is not really
diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c
index c1c5b7a..259819b 100644
--- a/gcc/java/jcf-io.c
+++ b/gcc/java/jcf-io.c
@@ -259,7 +259,7 @@ DEFUN(find_class, (classname, classname_length, jcf, do_class_file),
#else
int fd;
#endif
- int i, k, java, class;
+ int i, k, java, class = -1;
struct stat java_buf, class_buf;
char *dep_file;
void *entry, *java_entry;
@@ -341,95 +341,86 @@ DEFUN(find_class, (classname, classname_length, jcf, do_class_file),
}
class = stat (buffer, &class_buf);
- /* This is a little odd: if we didn't find the class file, we
- can just skip to the next iteration. However, if this is the
- last iteration, then we want to search for the .java file as
- well. It was a little easier to implement this with two
- loops, as opposed to checking for each type of file each time
- through the loop. */
- if (class && jcf_path_next (entry))
- continue;
+ if (class == 0)
+ break;
+ }
- /* Check for out of synch .class/.java files. */
- java = 1;
- for (java_entry = jcf_path_start ();
- java && java_entry != NULL;
- java_entry = jcf_path_next (java_entry))
- {
- int m, l;
+ /* Check for out of synch .class/.java files. */
+ java = 1;
+ for (java_entry = jcf_path_start ();
+ java && java_entry != NULL;
+ java_entry = jcf_path_next (java_entry))
+ {
+ int m, l;
- if (jcf_path_is_zipfile (java_entry))
- continue;
+ if (jcf_path_is_zipfile (java_entry))
+ continue;
- /* Compute name of .java file. */
- strcpy (java_buffer, jcf_path_name (java_entry));
- l = strlen (java_buffer);
- for (m = 0; m < classname_length; ++m)
- {
- java_buffer[m + l] = (classname[m] == '.'
- ? '/'
- : classname[m]);
- }
- strcpy (java_buffer + m + l, ".java");
-
- /* FIXME: until the `.java' parser is fully working, we only
- look for a .java file when one was mentioned on the
- command line. This lets us test the .java parser fairly
- easily, without compromising our ability to use the
- .class parser without fear. */
- if (saw_java_source)
- java = stat (java_buffer, &java_buf);
- }
+ /* Compute name of .java file. */
+ strcpy (java_buffer, jcf_path_name (java_entry));
+ l = strlen (java_buffer);
+ for (m = 0; m < classname_length; ++m)
+ java_buffer[m + l] = (classname[m] == '.' ? '/' : classname[m]);
+ strcpy (java_buffer + m + l, ".java");
+
+ /* FIXME: until the `.java' parser is fully working, we only
+ look for a .java file when one was mentioned on the
+ command line. This lets us test the .java parser fairly
+ easily, without compromising our ability to use the
+ .class parser without fear. */
+ if (saw_java_source)
+ java = stat (java_buffer, &java_buf);
+ }
- if (! java && ! class && java_buf.st_mtime >= class_buf.st_mtime)
- jcf->outofsynch = 1;
+ if (! java && ! class && java_buf.st_mtime >= class_buf.st_mtime)
+ jcf->outofsynch = 1;
- if (! java)
- dep_file = java_buffer;
- else
- dep_file = buffer;
+ if (! java)
+ dep_file = java_buffer;
+ else
+ dep_file = buffer;
#if JCF_USE_STDIO
- if (!class)
- {
- SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
- stream = fopen (buffer, "rb");
- if (stream)
- goto found;
- }
- /* Give .java a try, if necessary */
- if (!java)
+ if (!class)
+ {
+ SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
+ stream = fopen (buffer, "rb");
+ if (stream)
+ goto found;
+ }
+ /* Give .java a try, if necessary */
+ if (!java)
+ {
+ strcpy (buffer, java_buffer);
+ SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
+ stream = fopen (buffer, "r");
+ if (stream)
{
- strcpy (buffer, java_buffer);
- SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
- stream = fopen (buffer, "r");
- if (stream)
- {
- jcf->java_source = 1;
- goto found;
- }
+ jcf->java_source = 1;
+ goto found;
}
+ }
#else
- if (!class)
- {
- SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
- fd = open (buffer, O_RDONLY | O_BINARY);
- if (fd >= 0)
- goto found;
- }
- /* Give .java a try, if necessary */
- if (!java)
+ if (!class)
+ {
+ SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
+ fd = open (buffer, O_RDONLY | O_BINARY);
+ if (fd >= 0)
+ goto found;
+ }
+ /* Give .java a try, if necessary */
+ if (!java)
+ {
+ strcpy (buffer, java_buffer);
+ SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
+ fd = open (buffer, O_RDONLY);
+ if (fd >= 0)
{
- strcpy (buffer, java_buffer);
- SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
- fd = open (buffer, O_RDONLY);
- if (fd >= 0)
- {
- jcf->java_source = 1;
- goto found;
- }
+ jcf->java_source = 1;
+ goto found;
}
-#endif
}
+#endif
+
free (buffer);
return NULL;
found:
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index dd411b3..9e277da 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -155,6 +155,18 @@ set_source_filename (jcf, index)
DECL_LINENUMBERS_OFFSET (current_method) = JCF_TELL (jcf) - 2; \
JCF_SKIP (jcf, n * 4); }
+#define HANDLE_EXCEPTIONS_ATTRIBUTE(COUNT) \
+{ \
+ int n = COUNT; \
+ tree list = DECL_FUNCTION_THROWS (current_method); \
+ while (--n >= 0) \
+ { \
+ tree thrown_class = get_class_constant (jcf, JCF_readu2 (jcf)); \
+ list = tree_cons (NULL_TREE, thrown_class, list); \
+ } \
+ DECL_FUNCTION_THROWS (current_method) = nreverse (list); \
+}
+
#include "jcf-reader.c"
static int yydebug;