aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/jcf-parse.c
diff options
context:
space:
mode:
authorAlexandre Petit-Bianco <apbianco@redhat.com>2001-03-23 11:42:25 -0800
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>2001-03-23 11:42:25 -0800
commitb124f72e29e5b0ff7b6cbd85fab0e9d4676d7b9f (patch)
tree8dad1441dc95d1c7079a19a829ac67eae0ce45ee /gcc/java/jcf-parse.c
parentb64295c4d34897ecdc398d7cacbb8f292530713f (diff)
downloadgcc-b124f72e29e5b0ff7b6cbd85fab0e9d4676d7b9f.zip
gcc-b124f72e29e5b0ff7b6cbd85fab0e9d4676d7b9f.tar.gz
gcc-b124f72e29e5b0ff7b6cbd85fab0e9d4676d7b9f.tar.bz2
re PR java/1213 (gcj should check for incorrect CLASSPATH)
2001-03-22 Alexandre Petit-Bianco <apbianco@redhat.com> * gcj.texi (Input Options): documented the check for attribute `gnu.gcc.gccj-compiled' and the `-fforce-classes-archive-check' flag. * java-tree.h (flag_force_classes_archive_check): Declared extern. * jcf-parse.c (HANDLE_GCJCOMPILED_ATTRIBUTE): New macro. (jcf_parse): Check for the right classes archive if necessary. * jcf-reader.c (get_attribute): Define `MATCH_ATTRIBUTE' and use it. (jcf_parse_fields): Fixed indentation. * jcf-write.c (append_gcj_attribute): New function. (generate_classfile): Compute the attribute count, invoke `append_gcj_attribute'. * jcf.h (typedef struct JCF): `seen_in_zip' and `java_source' turned into bit fields. New bit field `right_zip.' (JCF_ZERO): Set `right_zip' to zero. * lang-options.h (-fforce-classes-archive-check): Added flag. * lang.c (flag_force_classes_archive_check): New flag. (lang_f_options): New entry `force-classes-archive-check.' Fixes PR java/1213. (http://gcc.gnu.org/ml/gcc-patches/2001-03/msg01662.html) From-SVN: r40788
Diffstat (limited to 'gcc/java/jcf-parse.c')
-rw-r--r--gcc/java/jcf-parse.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index 0b3a4b5..f235f6d 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -236,6 +236,12 @@ set_source_filename (jcf, index)
DECL_ARTIFICIAL (current_method) = 1; \
}
+#define HANDLE_GCJCOMPILED_ATTRIBUTE() \
+{ \
+ if (current_class == object_type_node) \
+ jcf->right_zip = 1; \
+}
+
#include "jcf-reader.c"
static int yydebug;
@@ -710,7 +716,15 @@ jcf_parse (jcf)
layout_class (current_class);
if (current_class == object_type_node)
- layout_class_methods (object_type_node);
+ {
+ layout_class_methods (object_type_node);
+ /* If we don't have the right archive, emit a verbose warning.
+ If we're generating bytecode, emit the warning only if
+ -fforce-classes-archive-check was specified. */
+ if (!jcf->right_zip
+ && (!flag_emit_class_files || flag_force_classes_archive_check))
+ fatal_error ("The `java.lang.Object' that was found in `%s' didn't have the special zero-length `gnu.gcj.gcj-compiled' attribute. This generally means that your classpath is incorrect set. Use `info gcj \"Input Options\"' to see the info page describing how to set the classpath.", jcf->filename);
+ }
else
all_class_list = tree_cons (NULL_TREE,
TYPE_NAME (current_class), all_class_list );