diff options
author | apbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-03-23 19:42:25 +0000 |
---|---|---|
committer | apbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-03-23 19:42:25 +0000 |
commit | 99878175bf53f9f188f4d3ad8b6260071e7f73f6 (patch) | |
tree | 8dad1441dc95d1c7079a19a829ac67eae0ce45ee /gcc/java/jcf-write.c | |
parent | 369305ac6a54d2a29402c0ec9b16ff30b44eee80 (diff) | |
download | gcc-99878175bf53f9f188f4d3ad8b6260071e7f73f6.tar.gz |
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)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40788 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/jcf-write.c')
-rw-r--r-- | gcc/java/jcf-write.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index f819d835ad5..46f73fe9cbb 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -346,10 +346,11 @@ static char *make_class_file_name PARAMS ((tree)); static unsigned char *append_synthetic_attribute PARAMS ((struct jcf_partial *)); static void append_innerclasses_attribute PARAMS ((struct jcf_partial *, tree)); static void append_innerclasses_attribute_entry PARAMS ((struct jcf_partial *, tree, tree)); +static void append_gcj_attribute PARAMS ((struct jcf_partial *, tree)); /* Utility macros for appending (big-endian) data to a buffer. We assume a local variable 'ptr' points into where we want to - write next, and we assume enoygh space has been allocated. */ + write next, and we assume enough space has been allocated. */ #ifdef ENABLE_JC1_CHECKING static int CHECK_PUT PARAMS ((void *, struct jcf_partial *, int)); @@ -3110,8 +3111,11 @@ generate_classfile (clas, state) } ptr = append_chunk (NULL, 10, state); - i = ((INNER_CLASS_TYPE_P (clas) - || DECL_INNER_CLASS_LIST (TYPE_NAME (clas))) ? 2 : 1); + i = 1; /* Source file always exists as an attribute */ + if (INNER_CLASS_TYPE_P (clas) || DECL_INNER_CLASS_LIST (TYPE_NAME (clas))) + i++; + if (clas == object_type_node) + i++; PUT2 (i); /* attributes_count */ /* generate the SourceFile attribute. */ @@ -3126,6 +3130,7 @@ generate_classfile (clas, state) PUT4 (2); i = find_utf8_constant (&state->cpool, get_identifier (source_file)); PUT2 (i); + append_gcj_attribute (state, clas); append_innerclasses_attribute (state, clas); /* New finally generate the contents of the constant pool chunk. */ @@ -3158,6 +3163,24 @@ append_synthetic_attribute (state) } static void +append_gcj_attribute (state, class) + struct jcf_partial *state; + tree class; +{ + unsigned char *ptr; + int i; + + if (class != object_type_node) + return; + + ptr = append_chunk (NULL, 6, state); /* 2+4 */ + i = find_utf8_constant (&state->cpool, + get_identifier ("gnu.gcj.gcj-compiled")); + PUT2 (i); /* Attribute string index */ + PUT4 (0); /* Attribute length */ +} + +static void append_innerclasses_attribute (state, class) struct jcf_partial *state; tree class; |