aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/jcf-reader.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-reader.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-reader.c')
-rw-r--r--gcc/java/jcf-reader.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/gcc/java/jcf-reader.c b/gcc/java/jcf-reader.c
index f34bddb..5df7a2e 100644
--- a/gcc/java/jcf-reader.c
+++ b/gcc/java/jcf-reader.c
@@ -120,6 +120,9 @@ DEFUN(get_attribute, (jcf),
name_length = JPOOL_UTF_LENGTH (jcf, attribute_name);
name_data = JPOOL_UTF_DATA (jcf, attribute_name);
+#define MATCH_ATTRIBUTE(S) \
+ (name_length == sizeof (S)-1 && memcmp (name_data, S, sizeof (S)-1) == 0)
+
#ifdef IGNORE_ATTRIBUTE
if (IGNORE_ATTRIBUTE (jcf, attribute_name, attribute_length))
{
@@ -128,7 +131,7 @@ DEFUN(get_attribute, (jcf),
else
#endif
#ifdef HANDLE_SOURCEFILE
- if (name_length == 10 && memcmp (name_data, "SourceFile", 10) == 0)
+ if (MATCH_ATTRIBUTE ("SourceFile"))
{
uint16 sourcefile_index = JCF_readu2 (jcf);
HANDLE_SOURCEFILE(sourcefile_index);
@@ -136,7 +139,7 @@ DEFUN(get_attribute, (jcf),
else
#endif
#ifdef HANDLE_CONSTANTVALUE
- if (name_length == 13 && memcmp (name_data, "ConstantValue", 13) == 0)
+ if (MATCH_ATTRIBUTE ("ConstantValue"))
{
uint16 constantvalue_index = JCF_readu2 (jcf);
if (constantvalue_index <= 0 || constantvalue_index >= JPOOL_SIZE(jcf))
@@ -146,7 +149,7 @@ DEFUN(get_attribute, (jcf),
else
#endif
#ifdef HANDLE_CODE_ATTRIBUTE
- if (name_length == 4 && memcmp (name_data, "Code", 4) == 0)
+ if (MATCH_ATTRIBUTE ("Code"))
{
uint16 j;
uint16 max_stack ATTRIBUTE_UNUSED = JCF_readu2 (jcf);
@@ -175,7 +178,7 @@ DEFUN(get_attribute, (jcf),
else
#endif /* HANDLE_CODE_ATTRIBUTE */
#ifdef HANDLE_EXCEPTIONS_ATTRIBUTE
- if (name_length == 10 && memcmp (name_data, "Exceptions", 10) == 0)
+ if (MATCH_ATTRIBUTE ("Exceptions"))
{
uint16 count = JCF_readu2 (jcf);
HANDLE_EXCEPTIONS_ATTRIBUTE (count);
@@ -183,7 +186,7 @@ DEFUN(get_attribute, (jcf),
else
#endif
#ifdef HANDLE_LINENUMBERTABLE_ATTRIBUTE
- if (name_length == 15 && memcmp (name_data, "LineNumberTable", 15) == 0)
+ if (MATCH_ATTRIBUTE ("LineNumberTable"))
{
uint16 count = JCF_readu2 (jcf);
HANDLE_LINENUMBERTABLE_ATTRIBUTE (count);
@@ -191,7 +194,7 @@ DEFUN(get_attribute, (jcf),
else
#endif
#ifdef HANDLE_LOCALVARIABLETABLE_ATTRIBUTE
- if (name_length == 18 && memcmp (name_data, "LocalVariableTable", 18) == 0)
+ if (MATCH_ATTRIBUTE ("LocalVariableTable"))
{
uint16 count = JCF_readu2 (jcf);
HANDLE_LOCALVARIABLETABLE_ATTRIBUTE (count);
@@ -199,7 +202,7 @@ DEFUN(get_attribute, (jcf),
else
#endif
#ifdef HANDLE_INNERCLASSES_ATTRIBUTE
- if (name_length == 12 && memcmp (name_data, "InnerClasses", 12) == 0)
+ if (MATCH_ATTRIBUTE ("InnerClasses"))
{
uint16 count = JCF_readu2 (jcf);
HANDLE_INNERCLASSES_ATTRIBUTE (count);
@@ -207,12 +210,19 @@ DEFUN(get_attribute, (jcf),
else
#endif
#ifdef HANDLE_SYNTHETIC_ATTRIBUTE
- if (name_length == 9 && memcmp (name_data, "Synthetic", 9) == 0)
+ if (MATCH_ATTRIBUTE ("Synthetic"))
{
HANDLE_SYNTHETIC_ATTRIBUTE ();
}
else
#endif
+#ifdef HANDLE_GCJCOMPILED_ATTRIBUTE
+ if (MATCH_ATTRIBUTE ("gnu.gcj.gcj-compiled"))
+ {
+ HANDLE_GCJCOMPILED_ATTRIBUTE ();
+ }
+ else
+#endif
{
#ifdef PROCESS_OTHER_ATTRIBUTE
PROCESS_OTHER_ATTRIBUTE(jcf, attribute_name, attribute_length);
@@ -362,7 +372,7 @@ DEFUN(jcf_parse_fields, (jcf),
uint16 attribute_count = JCF_readu2 (jcf);
#ifdef HANDLE_START_FIELD
HANDLE_START_FIELD (access_flags, name_index, signature_index,
- attribute_count);
+ attribute_count);
#endif
for (j = 0; j < attribute_count; j++)
{